Hi there,
Here is the Xiao family debugger in Operation, showing command line and GUI. Openocd, GDB, PlatformIO (can be used in both) “.pio run -t Upload” and finally Visual Studio & PlatformIO.
How It Works (In Embedded Projects)
- You compile your firmware with
-g
to include debug symbols.
(the PLIO.INI file has a flag to build it with debug) - You connect GDB to a hardware target (e.g. MCU) using a debugger like CMSIS-DAP, ST-Link, or J-Link.
- GDB communicates with OpenOCD or a similar server to control the chip over SWD/JTAG.
First up is OpenOCD (Open On-Chip Debugger) is a bridge between your debugger hardware and the CPU or microcontroller you’re trying to debug. It acts as the middleware that allows tools like GDB, PlatformIO, or VSCode to communicate with chips over JTAG or SWD (Serial Wire Debug).
Next…
is GDB (GNU Debugger) is a powerful debugging tool used by developers to inspect and control the execution of programs on supported architectures like ARM, x86, RISC-V, and more.
GDB lets you:
- Start and stop a program (pause, continue, reset)
- Set breakpoints to pause at specific lines of code
- Step through code line-by-line or instruction-by-instruction
- Inspect variables and memory
- Modify variables or registers during runtime
- Watch expressions and see when values change
- Analyze crashes by examining stack traces, registers, or core dumps
Enjoy…
Typical Workflow:
- Start OpenOCD with a config that matches your MCU and debugger.
openocd -f interface/cmsis-dap.cfg -f target/nrf52.cfg
- Connect with GDB:
arm-none-eabi-gdb firmware.elf
(gdb) target remote :3333
(gdb) load
- Debug live, inspect variables, set breakpoints, etc.
Example Supported Debug Adapters:
- CMSIS-DAP (Seeed Studio debugger, DAPLink, etc.)
- ST-Link (STM32 boards)
- J-Link (Segger)
- FTDI-based dongles (with manual config)
- Raspberry Pi GPIO (as a JTAG/SWD master — yep!)
OpenOCD even lets you do live memory editing, custom scripts, and advanced JTAG/SWD diagnostics. It’s the Swiss Army knife of embedded debugging.
Why I Use It:
- It’s open-source, widely supported, and works with tons of chips and boards.
- It’s the backbone of debugging in PlatformIO, Zephyr RTOS, and many embedded IDEs.
- Without OpenOCD (or something like it), GDB can’t control the chip.
- Will work with future Nrf54L15 Xiao - Game Changer.
HTH
GL PJ
AMA
250724-arduino-blinker.zip (419.1 KB)
Be sure to build it first, then use Your" path>" with the GDB to the Elf file
(mYn was “c:\Users\Dude”)