Debugging of blank application on Non Secure nRF9151-DK

Hello Nordic Support Team,

I am testing nRF9151-DK board. I wanted to debug an application that is created when "Create a blank application" option is chosen from nRF Connect's "Create a new application" menu.

After setting up a build configuration to target "nrf9151dk/nrf9151" board and an optimization level to "Optimize for debugging" everything works fine. Debug process stops at the first line of the main function and it is possible to debug program in step by step mode. On the other hand, when target is set to "nrf9151dk/nrf9151/ns" the debug process never stops at main function and using pause option terminates it.

I have tried turning on  CONFIG_TFM_CMAKE_BUILD_TYPE_RELWITHDEBINFO option as linked page says:
https://nrfconnectdocs.nordicsemi.com/ncs/latest/nrf/test_and_optimize/debugging.html#debugging_secure_and_non-secure_firmware

But it did not resolve my problem.

What is proper way of setting up project to be able to debug Non Secure projects? I am asking for step by step instruction for dummy.

My enviroment setup:
OS - Windows 11,
IDE - Visual Studio Code v1.109.5
SDK - nRF Connect SDK v3.4.0

Best regards,
Wojciech

  • Hi Wojciech,

    I think you are experiencing the same thing as on this other ticket.

    Basically, as we just moved from "partition manager" to devicetree partitioning, we currently have in the v3.4.0 an inconvenient setup for the nRF9151/ns builds. The problem is that the default partition is the one to use with a bootloader. But by default when creating a project, no bootloader is selected.

    So the reason why your program can't be debugged, is that it doesn't even start in the first place as the MCU never reaches the actual code as the partition are not correct.

    You can see on the ticket I linked, that there are 2 possible way to deal with it; You have to either enable a bootloader (SB_CONFIG_BOOTLOADER_MCUBOOT=y) or redefine the partitions in your project (adding nrf9151dk_nrf9151_ns.overlay).

    I would recommend you to enable the bootloader as you will most likely need to enable it further in your development when you will implement DFU.

    If you need more precision on how to do it, feel free to ask me again :)

    Best regards,

    Simon

Related