This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Add RTT Logs to mcuboot

I am using vscode with NCS 1.9. I am trying to add RTT logs to MCUBoot as the product I am developing won't have an exposed Serial port.

I started with the hello_world example and added

# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y

To the prj.conf file. I build and flash the code to an nRF52840DK. The application logs appear in J-Link RTT viewer as expected and the mcuboot logs go to the serial console that I can observe using Coolterm.  

How can I change the logging for mcuboot from uart to RTT?

My preference would be to add a mcuboot.conf file to the hello_world application and not have to modify the mcuboot application witihin NCS 1.9

I tried the suggestion in this ticket but the mcuboot.conf file doesn't seem to be getting applied. devzone.nordicsemi.com/.../rtt-logging-with-mcuboot
  • Hi, 

    Sorry for the delay. I am working on your case and will reply later. 

    Regards,
    Amanda

  • Hi, 

    I can get the RTT mcuboot log by modifing https://github.com/nrfconnect/sdk-mcuboot/blob/main/boot/zephyr/prj.conf#L32

    CONFIG_LOG_MODE_MINIMAL=n # former CONFIG_MODE_MINIMAL

    And use these config for child_image\mcuboot.conf:

    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
    
    # Disable UART Console and enable the RTT console
    CONFIG_UART_CONSOLE=n
    CONFIG_RTT_CONSOLE=y
    CONFIG_USE_SEGGER_RTT=y
    
    # Config logger
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_MULTITHREADING=y

    RTT viewer: 

    The RTT bootload log only shows after programing the image, and RTT viewer needs to connect the DK again to get the app log. This is the normal scenario. If you have two RTT blocks in RAM, RTTViewer will only pick up one. That means it will be a bit random if it picks up MCUboot or the application. 

    Test file: 5417.hello_world_284513.7z for NCS v1.9.0.

    Regards,
    Amanda

  • I am still not getting any logs from MCUBoot.

    I changed CONFIG_LOG_MINIMAL=y -> CONFIG_LOG_MINIMAL=n in ncs\v1.9.0\bootloader\mcuboot\boot\zephyr\prj.conf

    I added the child_image\mcuboot.conf file and did a Pristine build.

    I also commented out the RTT and logging from the prj.conf file. 

    # Disable UART Console and enable the RTT console
    # CONFIG_UART_CONSOLE=n
    # CONFIG_RTT_CONSOLE=y
    # CONFIG_USE_SEGGER_RTT=y

    # Some command handlers require a large stack.
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

    # Config logger
    # CONFIG_LOG=y
    # CONFIG_LOG_BACKEND_RTT=y
    # CONFIG_LOG_BACKEND_UART=n
    Which should mean only mcuboot is placing the RTT control block into RAM. However, when I connect RTT I get no logs from it. The Firmware logs show up over UART now but no logs appear anywhere from MCUBoot. Am I missing a detail?
  • Hi, 

    Try to add CONFIG_LOG=y in the prj.conf file. Connecting the RTT viewer to DK again before programming the new image, then it would get the new log.

    -Amanda     

Related