This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Eclipse CDT, GDB debugging with nRF51822: breaks on every line.

I have Eclipse CDT set up for debugging the ble_app_proximity sample code on a Mac. I can start the GDB server on the console and connect to it. Flashing the code seems to work. I've already flashed the softdevice from a Windows machine. Disconnecting GDB and powering up without debugging, I can connect to the device from the Master Control Panel on a Windows machine. So the device is working without debugging.

But when I try to debug from Eclipse, the debugger is stopping on every line within timers_init(). See thread screenshot attached. I would expect clicking the Resume (play) button to take me to my next breakpoint, or resume fully if I have no breakpoints. But no progress is made out of NVIC_SetPendingIRQ().

screenshot_nordic_gdb.png

Parents
  • I still can't get this to work.

    Following your suggestion here...

    devzone.nordicsemi.com/.../strange-behaviour-with-nrf51822-and-s110

    ... gdb gets very confused:

    monitor speed 30
    monitor flash device = nRF51822
    load
    Loading section .text, size 0xab90 lma 0x14000
    Loading section .ARM.exidx, size 0x8 lma 0x1eb90
    Loading section .data, size 0x94 lma 0x1eb98
    Start address 0x1e6e1, load size 44076
    Transfer rate: 21521 KB/sec, 8815 bytes/write.
    mon reset
    monitor flash download = 1
    The target endianness is set automatically (currently little endian)
    No symbol table is loaded.  Use the "file" command.
    No symbol table is loaded.  Use the "file" command.
    No symbol table is loaded.  Use the "file" command.
    
    monitor halt
    continue
    Continuing.
    
    Temporary breakpoint 1, 0x000157bc in main ()
    No breakpoint number 5.
    

    If I instead use "Load image" and "Load symbols" and point to the .elf file (I'm now using the GNU ARM Eclipse plugin, which seems to produce both an .elf file and a .hex file), then reduce my gdb startup commands to simply "mon reset", I get the same errors.

    If I then add the following back in for startup commands...

    mon speed 10000
    mon endian little
    mon flash download = 1
    mon flash device = NRF51822
    mon reset 0
    

    ... I do get the same errors on the gdb console, but at least some code executes on the device. The debugger doesn't show me the breakpoint in the code, it creates a "Source not found" window at an address in my main() (0x157bc).

    I've also followed your advice here...

    devzone.nordicsemi.com/.../uart-application-problem

    ...and put address 114CD in for "Set program counter at".

    And I've removed the default NVIC_SystemReset() call in the app_error_handler() and instead called ble_debug_assert_handler(), as you suggested somewhere.

    Am out of ideas.

Reply
  • I still can't get this to work.

    Following your suggestion here...

    devzone.nordicsemi.com/.../strange-behaviour-with-nrf51822-and-s110

    ... gdb gets very confused:

    monitor speed 30
    monitor flash device = nRF51822
    load
    Loading section .text, size 0xab90 lma 0x14000
    Loading section .ARM.exidx, size 0x8 lma 0x1eb90
    Loading section .data, size 0x94 lma 0x1eb98
    Start address 0x1e6e1, load size 44076
    Transfer rate: 21521 KB/sec, 8815 bytes/write.
    mon reset
    monitor flash download = 1
    The target endianness is set automatically (currently little endian)
    No symbol table is loaded.  Use the "file" command.
    No symbol table is loaded.  Use the "file" command.
    No symbol table is loaded.  Use the "file" command.
    
    monitor halt
    continue
    Continuing.
    
    Temporary breakpoint 1, 0x000157bc in main ()
    No breakpoint number 5.
    

    If I instead use "Load image" and "Load symbols" and point to the .elf file (I'm now using the GNU ARM Eclipse plugin, which seems to produce both an .elf file and a .hex file), then reduce my gdb startup commands to simply "mon reset", I get the same errors.

    If I then add the following back in for startup commands...

    mon speed 10000
    mon endian little
    mon flash download = 1
    mon flash device = NRF51822
    mon reset 0
    

    ... I do get the same errors on the gdb console, but at least some code executes on the device. The debugger doesn't show me the breakpoint in the code, it creates a "Source not found" window at an address in my main() (0x157bc).

    I've also followed your advice here...

    devzone.nordicsemi.com/.../uart-application-problem

    ...and put address 114CD in for "Set program counter at".

    And I've removed the default NVIC_SystemReset() call in the app_error_handler() and instead called ble_debug_assert_handler(), as you suggested somewhere.

    Am out of ideas.

Children
  • As for the first part, you haven't included the first line in my suggestion, the file line. When you haven't, GDB will for sure be confused.

    Also, if you hardcode the reset handler, you must be certain that it is correct for your softdevice version. It seems to me that the reset handler for 6.0.0 is on 0x12B99, so if you then try to use 0x114CD, nothing will work correctly.

    If you struggle with Eclipse, you may be better off starting out with command line GDB, get that working, and only then move to Eclipse.

    Finally, you can ignore all the other monitor commands in the application note, as they are not strictly required.

Related