B0 secure bootloader logging with RTT not working.

Hi,

I’m facing an issue with RTT logging on my nRF52840 using NCS 2.6.0. I’m trying to log output from the B0 bootloader, but so far, I’m only able to capture logs from the application and the MCUboot.

I want to verify the MCUbootloader version, and as I understand it, I need to log output from B0 as described in the example: https://docs.nordicsemi.com/bundle/ncs-2.6.0/page/nrf/config_and_build/bootloaders/bootloader_testing.html

b0.conf: 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Marks this image as B0
CONFIG_IS_SECURE_BOOTLOADER=y
CONFIG_FW_INFO=y
# Disables multithreading — B0 runs in a single-threaded mode (smaller + simpler).
CONFIG_MULTITHREADING=n
CONFIG_GPIO=n
CONFIG_ASSERT=n
# Enables Nordic's Flash Protect driver — used by B0 to lock flash regions after boot.
#CONFIG_FPROTECT=y
# Enables cryptographic support for signature verification
CONFIG_SECURE_BOOT_CRYPTO=y
# Enables validation of second-stage bootloader (MCUboot) via signature check.
CONFIG_SECURE_BOOT_VALIDATION=y
# Enables debug logging in B0 (useful for RTT/UART messages during boot).
CONFIG_SECURE_BOOT_DEBUG=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

mcuboot.conf:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Bootloader version (monotonic counter for B0). Must increment on updates.
CONFIG_FW_INFO=y
CONFIG_FW_INFO_FIRMWARE_VERSION=1
# Signature Type: RSA
CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
CONFIG_BOOT_SIGNATURE_TYPE_RSA_LEN=2048
# Application update procedure
CONFIG_BOOT_UPGRADE_ONLY=y
#CONFIG_BOOT_SWAP_USING_SCRATCH=y
# Enable Multithreading. Required for RC calibration
CONFIG_MULTITHREADING=y
# Debug
CONFIG_MCUBOOT_LOG_LEVEL_INF=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Relevant prj.conf:

Fullscreen
1
2
3
4
5
6
7
8
9
10
# --------------------------------------------------------------------
# ------------------------------------------------------- Bootloader --
# - Enables the immutable bootloader (NSIB)
CONFIG_SECURE_BOOT=y
# - Adds MCUboot as an upgradable second-stage bootloader
CONFIG_BOOTLOADER_MCUBOOT=y
# - Enable second slot (S1) for MCUboot for OTA bootloader update
CONFIG_BUILD_S1_VARIANT=y
# - Include firmware info metadata (required for B0 chain)
CONFIG_FW_INFO=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

EDIT: When I erase the chip and flash only b0_container.hex, I get the following log output:

Fullscreen
1
2
3
4
5
6
*** Booting nRF Connect SDK v3.5.99-ncs1 ***
Attempting to boot slot 0.
No fw_info struct found.
Attempting to boot slot 1.
No fw_info struct found.
No bootable image found. Aborting boot.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This makes sense, since there’s no valid image yet.
However, when I then flash the signed_by_mcuboot_and_b0_s0_image_signed.hex, I only see MCUboot logging output — the B0 logging no longer appears:

Fullscreen
1
2
3
4
5
6
7
8
9
00> Device: XXX, HW Rev: UNKNOWN, Platform #: -1
00> -- Bootloader Firmware --
00> Firmware Version: 3.13.0
00> Firmware Build Time: May 5 2025 13:44:57
00> * SPI Flash ID: 17951 *
00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
00> I: Starting bootloader
00> I: Image index: 0, Swap type: perm
00> E: Unable to find bootable image
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

PS: Debugging MCUboot is also a bit tricky — sometimes it works if I reconnect the debugger at exactly the right moment (immediately after power-up), but other times it doesn’t work at all.

BR Daniel