Re: Debugging NRF51822 (OpenOCD + GDB)


Scott Nelson <scott@...>
 

I’ve previously left it with a serial port connected but, oddly, it never ends up in the _SysFatalErrorHandler when I do that. I currently turn on an LED so I know when the code has entered _SysFatalErrorHandler and was hoping to connect the debugger after the fact. I’ll look into the RAM console. Thanks.

-Scott

On Aug 22, 2017, at 3:25 PM, Cufi, Carles <Carles.Cufi@nordicsemi.no> wrote:

Hi Scott,

I don’t know why you are getting the gdb error (here at Nordic we all use Segger debug ICs), but if the _SysFatalErrorHandler is getting called because of BLE then it’s highly likely that there is a preceding printk() statement giving the cause. I understand you don’t have a serial port connected, so could you try enabling the RAM console and dumping the memory with gdb once you hit the fatal error?

You should be able to do so with this option:
https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/console/Kconfig#L106

Regards,

Carles

On 22/08/2017, 21:16, "zephyr-users-bounces@lists.zephyrproject.org on behalf of Scott Nelson" <zephyr-users-bounces@lists.zephyrproject.org on behalf of scott@scottnelson.co> wrote:

Hello,

I wrote into the list about an issue I was having with an NRF51822 board a couple days ago. It’s occasionally ending up in _SysFatalErrorHandler but I’m still not sure why (though I suspect it may be something BLE related). I’m trying to attach a debugger with the ultimate goal of printing a stack trace when the code ends up in the error handler. First I’m starting an OpenOCD server:

$ openocd -f interface/stlink-v2.cfg -f target/nrf51.cfg

And then trying to connect GDB:

$ arm-none-eabi-gdb outdir/nrf51_blenano/zephyr.elf
(gdb) set verbose on
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
warning: platform-specific solib_create_inferior_hook did not load initial shared libraries.
Reading in symbols for /Users/scott/Code/bms/zephyr/lib/libc/minimal/source/stdout/fprintf.c...done.
fprintf (F=<optimized out>, Abort trap: 6

The OpenOCD logs show:

accepting 'gdb' connection on tcp/3333
dropped 'gdb' connection

Any idea why I’m getting this error? I’m new to OpenOCD and GDB so I’m not sure if this is an issue with my toolchain setup or if it is something related to Zephyr. Any help would be much appreciated!

Thanks,
Scott
_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users

Join users@lists.zephyrproject.org to automatically receive all group messages.