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

breakpoints stopped working with nrf51-dk, gdb and JLinkGDBServer

At some point in the past I had nrf51+gdb+breakpoints working just fine. I even have a bunch of __BKPT() calls in my various error handlers to trap into the debugger.

At some point in the past I noticed that my __BKPT() traps in my debug code stopped waking up gdb. The breakpoints seem to happen but JLinkGDBServer seems doesn't seem to be detecting the CPU halting. If I ctrl-c in gdb and run 'where' it shows the PC at the __BKPT() instruction (and the CPU is halted).

So tonight I'm trying to track down an issue and I wanted to use breakpoints and guess what? The break point trips, but JLinkGDBServer doesn't seem to be notifying the connected gdb.

This effects both the nrf51dk and my custom hardware with a j-link.

I did the obvious and upgrade to the lastest jlink package from segger.

My problem is I have no clue what configuration actually worked. I'm not sure I ever actually had breakpoints working with the -dk.

Does anyone have this working?

Here is what I'm using:

SEGGER J-Link GDB Server V4.98d Command Line Version
JLinkARM.dll V4.98d (DLL compiled Apr 28 2015 14:00:36)
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Apr 24 2015 21:08:18
Hardware: V1.00

gcc-arm-none-eabi-4_9-2015q1-20150306-linux
GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.1.20141128-cvs

I startup gdbserver with:

JLinkGDBServer -strict -SettingsFile $dir/jlink.settings \
        -select USB=$sn -device "$dev" -if SWD -speed $speed -port $port -vd

dev is "nrf51422" for the -dk and "nrf51822" for my hardware speed is 4000 for the -dk and 2000 for my hardware sn/port depends on which jlink I'm talking to

jlink.settings is:

[FLASH]
AllowCaching     = 0
CacheExcludeAddr = 0x00000000
CacheExcludeSize = 0x00040000
VerifyDownload   = 1

My gdb init script connects with:

target extended-remote 127.0.0.1:$port

I figure I'd have a better chance of asking if anyone here has this working vs the Segger forum.


Before posting this I did some more testing and found that I could get it to work if I used the 'remote' target instead of the 'extended-remote' target. But without the remote target doesn't support important commands like 'run', it only seems to support 'continue'. I ended up having to do 'mon reset' and then 'c' to restart the program, even after loading a new elf file.

I am pretty sure at one point it worked. I looked back over the commits to my gdb.init file and I never used anything other then 'extended-remote'. Any ideas?

Related