Unable to debug with BOOTLOADER_MCUBOOT and SECURE_BOOT enabled

Hi,

I just ran into a strange issue and traced it back to a KCONFIG problem... It seems that if I have BOOTLOADER_MCUBOOT and SECURE_BOOT configured "y" I end up getting a problem when I try to boot into debug mode, is this expected? If so, what is the canonical way to enable/disable relevant KCONFIG options when debugging the application (but having them automatically on when creating a production build)?

Thanks
Josh

P.S. Here's my prj.conf for completeness

# debug config
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_DEBUG_THREAD_INFO=y

# bootloader
# CONFIG_BOOTLOADER_MCUBOOT=y
# CONFIG_SECURE_BOOT=y

# Enable RTT
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y

# enable uart driver
CONFIG_SERIAL=y

# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y

# enable i2s light driver
CONFIG_SPI=n
CONFIG_I2S=y
CONFIG_LED_STRIP=y

# threading
CONFIG_HEAP_MEM_POOL_SIZE=256

Parents Reply Children
  • Hi,

    I am not able to reproduce that. I am also able to set breakpoints in all threads of the Basic thread manipulation sample also if I build witht these additional configs:

    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_SECURE_BOOT=y

    Are you setting the breakpoint in the while loop inside blink()? If not, and you for isntance set it at the call to blink() you will only hit the breakpoint once for each call after reset as this function does not return.

    Regarding finding the samples that is good input. I will share it with our technical writers. One way to find the code is to search for a string from the documentation for the sample, as that is generated from the README.rst file that is located in the sample directory. But that should not have to be nessesary.

  •    Did you try this in a project with a threaded process? e.g.

    K_THREAD_DEFINE(blink0_thread_id, STACKSIZE, blink0, NULL, NULL, NULL,
    		PRIORITY, 0, 0);

    When I comment out these threads (see original post), I can debug with/without SECURE_BOOT/MCU_BOOT. However, when the threads are enabled, I can only debug if SECURE_BOOT/MCU_BOOT is false.

    I'd note that the application runs fine when flashed in all cases that aren't debugged.

  • Hi,

    Yes, there was a typo in my previous post regardign which sample I tested (I will update it after posting this). I saw that your code looked like it came from the Basic thread manipulation sample (zephyr/samples/basic/threads). So I tested that from nRF Connect SDK 2.6.1, and I am able to set breakpoints in all three threads.

    Is this the sample you were not ablet o debug? Can you test again?  And if stil not able to, can you share a detailed description on how you build and debug the project, includign version of toolchain, SDK, VS Code plugion, etc?

Related