NRF52 – Not hitting breakpoints

Sysprogs forums Forums VisualGDB NRF52 – Not hitting breakpoints

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21203
    grindstaffp
    Participant

    I have a project (c++) using the NRF52832 with BSP 14.2 under Visual Studio 2017 and VisualGDB 5.4 preview 3 (have tried under the latest 5.3 as well). I am attempting to interface with an I2C sensor and am having touble debugging within the library.

    In the program main function, if I set a breakpoint before runtime on a function call to my sensor’s library, the program will bypass this breakpoint and continue to the main loop. Likewise, if a breakpoint is set on a library function call in the loop, the program runs without breaking. It is not until I remove and again place a breakpoint on the function call in the loop that the debugger hits the breakpoint. At this point I am able to step through the code as expected but not through the function I am aiming to step through.

    Per other threads, I have compiler optimizations disabled and have –ggdb set. Being new to working on embedded devices at this level I am likely doing something wrong or misunderstand how this is supposed to work so any insight is appreciated. Attached is the GDBServer output as well as an image of my breakpoints.

     

    Attachments:
    You must be logged in to view attached files.
    #21207
    support
    Keymaster

    Hi,

    Stepping through code on Nordic devices could be tricky due to the built-in watchdog that would reset the CPU each time it is stopped for a non-trivial amount of time, although it should not lead to the behavior you are describing.

    From a quick look at the log file you attached, it looks that the Segger gdb stub fails to read the CPU registers shortly after the reset command:

    Received monitor command: reset
    Resetting target
    Connected to 127.0.0.1
    Read 2 bytes @ address 0x000003B4 (Data = 0xF107)
    Read 2 bytes @ address 0x000003E2 (Data = 0x1D3B)
    Read 4 bytes @ address 0x2000DFFC (Data = 0x4B642F0A)
    Downloading 4 bytes @ address 0x2000DFFC
    Reading all registers
    ERROR: Can not read register 0 (R0) while CPU is running
    ERROR: Can not read register 1 (R1) while CPU is running
    ERROR: Can not read register 2 (R2) while CPU is running
    ERROR: Can not read register 3 (R3) while CPU is running

    This might affect the initial breakpoints or could cause other weird behavior.

    Please try updating the Segger J-Link software and/or try adding delays (e.g. mon sleep 1000) before and after the reset command under VisualGDB Project Properties -> Debug Settings -> Advanced Settings.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.