You are reading a single comment by @user156811 and its replies. Click here to read the full conversation.
  • I'm confused as to why it's trying to do a remote session

    gdb runs on PC and the debugged code runs on ARM device so it needs to be a bit complicated, there is remote GDB server running somewhere. It can be OpenOCD running on your PC translating gdb commands to SWD/JTAG commands. It can be Segger GDB server for J-Link, it can be even running inside your debug probe for speed (Blackmagic probe has one).

    As for debugging Espruino I did it few times but there is issue with nrf52 with BLE stack running - you cannot stop and continue as it breaks Bluetooth timing and device reboots. With bluetooth turned off ( at least NRF.sleep()) it is better. But even with bluetooth turned on one can set breakpoint and has one shot at investigating stack trace and variables before rebooting and trying again.

    I used command line gdb with the elf file which is produced in each build, no extra compile flags are needed. I think the elf file produced by gcc should also work in any IDE but don't have any guide, try Google.

    EDIT: see also this post https://forum.espruino.com/conversations/369539/#16249545

  • As for debugging Espruino I did it few times but there is issue with nrf52 with BLE stack running - you cannot stop and continue as it breaks Bluetooth timing and device reboots. With bluetooth turned off ( at least NRF.sleep()) it is better.

    So now i think i'm at this step.

    When i'm stepping through the program from the very start.
    In targets/nrf5x/jshardware.c - once i hit jsble_init() the software crashes. It seems to happen both my NRF52840 dev board and my pinetime. Just in different spots.

    I just don't know were to stick this NRF.sleep() call?

  • I just don't know were to stick this NRF.sleep() call?

    well if you need to debug startup then I don't know about such way, in theory we could add some option to not start advertising automatically. You can also compile bluetooth module out for debugging startup. In other cases just run it fully, then execute NRF.sleep() in console or NRF.sleep() /wake() mapped to something like button click and then set breakpoints as you wish when it is sleeping. it is easier to do this with console over serial (or usb with that 52840 devboard), then you can type it directly as needed

    BTW som more info here https://devzone.nordicsemi.com/f/nordic-q-a/9622/application-debug-with-softdevice
    I've seen some macro somewhere for gdb for setting PRIMASK automatically when beakpoint is hit

About

Avatar for user156811 @user156811 started