Hardware setup:
Ubuntu <--USB--JLink--TagConnect--> nRF51822
Software:
- gcc-arm-none-eabi 4.9.3.2015q2-1preci A GNU-based tool chain for arm embedded processors
- arm-none-eabi-gcc4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288]
- GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
- OpenOCD 0.9.0-rc1 (2015-06-22-12:07)
Verified that nRF51822 Region 0 Readback Protection is disabled:
nRF51822 Reference Manual: Section 8, User Information Configuration Register
UICR BaseAddr:0x10001000
UICR Code Region 0 Length
UICR.CLENR0 Offset:0x0 (For 0xffff.ffff, CLENR0 is interpreted as 0.)
UICR Readback Configuration
UICR.RBCONF Offset:0x4 DisProtectReg0:0x00ff DisProtectAll:0xffXX
JLinkExe -SelectEmuBySN XXXXXXXX -If swd -Device nrf51822 -speed auto
*J-Link>*mem8 0x10001000 4
10001000 = FF FF FF FF <<< Means that Code Region 0 Length is 0.
*J-Link>*mem8 0x10001004 2
10001004 = FF FF <<< Means that Readback protection is completely disabled.
OpenOCD startup:
openocd --search <..>/openocd-0.9.0-rc1/share/openocd/scripts/interface --file jlink.cfg -c "transport select swd" --search <..>/openocd-0.9.0-rc1/share/openocd/scripts/target --file nrf51.cfg -c "adapter_khz 2000" -c "gdb_port" &
--- Log
Info : JLink SWD mode enabled
swd
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
adapter speed: 2000 kHz
3333
Info : J-Link V9 compiled May 22 2015 17:20:50
Info : J-Link caps 0xb9ff7bbf
Info : J-Link hw version 93000
Info : J-Link hw type J-Link
Info : J-Link max mem block 70840
Info : J-Link configuration
Info : USB-Address: 0x0
Info : Kickstart power on JTAG-pin 19: 0xffffffff
Info : Vref = 1.801 TCK = 0 TDI = 0 TDO = 0 TMS = 1 SRST = 1 TRST = 0
Info : J-Link JTAG Interface ready
Info : clock speed 2000 kHz
Info : SWD IDCODE 0x0bb11477
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
...
Info : accepting 'gdb' connection on tcp/3333
Gdb startup (in Emacs):
arm-none-eabi-gdb -i=mi2
set non-stop off
set directories <..>:<..>
file <..>/nrf51822_xxaa_s110.out
Reading symbols from <..>/nrf51822_xxaa_s110.out...done.
target remote :3333
break spi_event_handler
monitor reset
continue
Program received signal SIGINT, Interrupt. 0x000119ce in ?? ()
(gdb) c
Continuing.
Program received signal SIGINT, Interrupt.
spi_event_handler (accel_data=0x20002428 <m_rx_buf> "\026", amount=1) at ../main.c:213
213 switch(accel_data[0])
(gdb) step
Program received signal SIGINT, Interrupt.
0xfffffffe in ?? ()
(gdb) step
Cannot find bounds of current function
(gdb) bt
0 0xfffffffe in ?? ()
1 0x000196d0 in app_error_handler (error_code=3735928559, line_num=1377, p_file_name=0x20001d54 "src\rem.c") at ../main.c:167
2 0x00019760 in assert_nrf_callback (line_num=1377, p_file_name=0x20001d54 "src\rem.c") at ../main.c:193
3 0x0001b51e in softdevice_assertion_handler (pc=77664, line_num=1377, file_name=0x20001d54 "src\rem.c") at ../../../../../../../Nordic/common/Nordic/components/softdevice/common/softdevice_handler/softdevice_handler.c:62
4 signal handler called
5 0x00014fd2 in ?? ()
6 0x00012f64 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
What am I doing wrong? I cannot step through the code. And yes I am stepping through the event handler. I really don't care if the BLE connection times out. I simply want to debug a small portion of the code in the event handler. Is this even possible?