Debug cannot go to the breakpoint for the hello world sample app

Hi,

I am new to NCS and visual studio. I created an app based on the hello world sample app. And set the break point to the line of the printk in main.c. However, when I run the debugger, it cannot go to that line. Instead, it seems to loop on some line of the file cpu_idle.S. I am using NCS 1.7.0. Could you help?

Parents
  • Hi sokui,

    It's normal behaviour if the debug entry point is not inside the actual main function. That's because your actual firmware is just a part of the whole OS.

    If you set a breakpoint as you did on line 12 and just press the proceed button  you should end up where your breakpoint is.

    If not: What hardware are you using and how did you set up the build configuration?

    Best wishes,

    Simon

  • Hi,

    I set the breakpoint on line 12, and did press the proceed button. But it did not end up that line. It keep running without stopping. If I pause, it always paused one line 158 in the figure 1. My hardware is nRF 52840 PCA10056 

Reply
  • Hi,

    I set the breakpoint on line 12, and did press the proceed button. But it did not end up that line. It keep running without stopping. If I pause, it always paused one line 158 in the figure 1. My hardware is nRF 52840 PCA10056 

Children
  • Hi Shawn,

    Really sorry for the delayed response. Could you try creating the application once more, but do not select the "Enable Debug Options" in the Generate Configuration.

    This is a bug only in few samples like "hello_world" and "blinky". Kindly let me know how it goes.

    Regards,

    PK

  • Nice. After I recreate the build without checking the enable debug options, I can go to the break point line now. So whats the point of this "enable debug options" option? Where should I use it?

  • This was mentioned at the beginning of the nRF Connect for VS Code, 5: Debugging video - Chapter: Debugging prerequisites . Enable debug options adds CONFIG_DEBUG_OPTIMIZATIONS=y and CONFIG_OPENOCD_SUPPORT=y to the build command line. It does not modify any project files.  Generate configuration does not generate prj.conf file. It generates a CMake build system. Please refer to NCS/Zephyr documentation for details on the build process. We recommend to leave it unchecked for blinky due to a bug in the build system and debug server that is causing debugger to halt on stray debug symbols.