Remote (GDB) debugging with RAKDAP1

I’m trying to figure out how to do remote debugging of a RAK4630 using the RAKDAP1 adapter. Here’s my setup:

  1. Physical hardware is a RAK4630 core on a RAK5005-O base.
  2. Development environment is PlatformIO running on macOS Monterey.
  3. I have successfully set up Mac’s local environment as per RAKDAP1 Flash and Debug Tool | RAKwireless Documentation Center QuickStart instructions.
  4. Able to flash both the bootloader and firmware using pyocd.
  5. Have installed gdb 11.2 on my Mac.

I’m struggling with the next steps. Actually, I’m not even 100% confident that I can enumerate the next steps. If I had to guess, it would be:

  1. Configure PlatformIO to build a debug firmware. From what I’ve read, this will include an ARM-compatible version of GDB that runs on the RAK4630. This debug firmware includes a gdb server that communicates with the RAKDAP1 using the SWD protocol.

  2. Configure our PlatformIO project to “use” the RAKDAP1. And here I basically have absolutely no idea.

Any pointers at all would be most appreciated.


Hello @futnuh

I didn’t try it yet, but there is some information in the PlatformIO documents about nRF52 debug.

They list CMSIS-DAP in the adapters, that should be compatible with RAKDAP1.

Tried some stuff.
I am on Windows, not sure how it is on Mac.

  1. In your project, open platformio.ini and add
debug_tool = custom

in your [env:rak4631]

  1. Start the GDB Server with pyocd-gdbserver -t nrf52840 --allow-remote from a command prompt

  2. In PlatformIO, open the debug panel and start the debugging

It will compile your application and then upload it through the GDB Server

Then the debugger starts and you app is halted at main().
Now you can start the app, set breakpoints, …

Normally it should be possible to start the GDB server from within PIO, but it didn’t work for me. the GDB server has to run as admin.