Embedded Debugging with the Black Magic Probe
The “Black Magic Probe” is a combined hardware & software project. At the hardware level, it implements JTAG and SWD interfaces for ARM Cortex A-series and M-series micro-controllers. At the software level, it provides a “gdbserver” implementation and Flash programmer support for ranges of micro-controllers of various brands. Both the hardware & software components of the Black Magic Probe are open source projects, designed by 1BitSquared in collaboration with Black Sphere Technologies.
The distinguishing feature of the Black Magic Probe is that it has native support for the GDB “Remote Serial Protocol”. In other words, it embeds the “gdbserver” stub. This means that you can directly connect to the debug probe with GDB, any IDE or front-end that uses GDB in the background, or any program that supports the Remote Serial Protocol. The Black Magic Probe requires neither drivers nor any middle-ware.
Debugging with the Black Magic Probe
To support the Black Magic Probe, we wrote a book on how to use the debug probe and associated software, with troubleshooting tips, plus several more advanced debugging techniques. Like the Black Magic Probe project itself, this book is open source (more accurately: CC BY-NC-SA). It can be downloaded in PDF and ODF formats from its GitHub project. If you prefer a printed version of the book, you can buy it from from Lulu.
Together with the book, we developed a number of utilities to use with the Black Magic Probe. There is a front-end for GDB, that scans for available debug probes, automatically attaches to the selected one and handles the querying & set-up for the selected micro-controller in the background. Plus, this front-end supports semihosting, serial terminal viewer and SWO tracing —features that are typically needed for embedded debugging (but that general-purpose front-ends often lack).
Other utilities handle firmware downloading (with options for serialization and code protection), or generating code for efficient run-time tracing, or diagnosing your set-up if the Black Magic Probe does not work as expected.
All utilities are available as ready-to-run binaries for Windows and Linux, in addition to the full source code (under the Apache v.2 open source license). Both can be found on the same GitHub project as for the book.
Links and downloads
- Black Magic Probe project on GitHub
- “Embedded Debugging with the Black Magic Probe” project on GitHub
- “Embedded Debugging with the Black Magic Probe” ; paperback; ISBN 9789090349879; August 2021; 113 pages.