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

Segmentation fault when debugging nRF52840-DK

Hello, I am developping on a nrf52840-DK board and try to debug using a Black Magic probe. Software is based on softdevice, GCC build chain and Visual Studio Code with Cortex-debug extension. For now, we advertise on BLE and send the battery voltage when connected, we go to sleep when the voltage is too low. All this works well as long as we don't try debugging. The execution is stopped at the beginning of main() until the button 4 is pressed, in order to have enough time to start the debugger (the code is downloaded using USB, I did not manage yet to do this through the Black Magic probe). Then most of the routines do not return when skipping them (F10) and some even don't allow entering them (F11). I can go (F5) and stop later if still at the beginning. But if the system is fully initialized when I debug, I get a segmentation fault. Extract:

Program
 received signal SIGINT, Interrupt.
debug_wait_loop () at ./main.c:1116
1116            if((drop & 0x02000000) == 0)

Program
 received signal SIGSEGV, Segmentation fault.
0x00015522 in ?? ()

Did I miss something obvious?
My background: I am new to ARM and particularly Nordic but 40 years of low level development, embedded, Windows device drivers and several years of BIOS, including debugger development.

Parents
  • It is possible that there are compatibility issues with the black magic probe (and this is likely the reason why you cannot flash with it). If you have that alternative, use openocd, e.g. with an STLink programmer or a CMSIS DAP programmer or even bit banging from a raspberry PI, all work great, also for flashing.

    As much as I like the concept of BMP, it remains limited since all targets must be known in the firmware. OpenOCD remains more universal.

Reply
  • It is possible that there are compatibility issues with the black magic probe (and this is likely the reason why you cannot flash with it). If you have that alternative, use openocd, e.g. with an STLink programmer or a CMSIS DAP programmer or even bit banging from a raspberry PI, all work great, also for flashing.

    As much as I like the concept of BMP, it remains limited since all targets must be known in the firmware. OpenOCD remains more universal.

Children
No Data
Related