Black Magic Probe

There are many JTAG and SWD debuggers available for the ARM Cortex-M4 processor. We have had good results using the Black Magic Probe from Black Sphere Technologies.

Black Magic Probe

Black Magic Probe

PX4 Autopilot Project Guide

As your primary resource, please read the PX4 Autopilot project wiki guide to using the Black Magic Probe.

Upgrading Firmware

We’ve found that most Black Magic Probes do not ship with the very latest firmware. In order to support the PX4FMU’s STM32F4 processor, you should please follow the instructions on the PX4 Autopilot wiki to clone and build the latest black magic firmware and load it on your device.

GDB Init Script

We use a simpler gdb init script from the one described on the PX4 wiki due to differences in operating system implementation and environment.

Copy the following to a .gdbinit script in the root directory of your smaccmpilot-stm32f4 repository:

target extended SERIAL_PORT
monitor swdp_scan
attach 1

where SERIAL_PORT is the path of the first serial device enumerated by the Black Magic probe.

Using GDB

From the root of the smaccmpilot-stm32f4 repository, after successfully building the SMACCMPilot executable, start your ARM toolchain gdb with the flight executable.

arm-none-eabi-gdb build/px4fmu17_ioar_freertos/img/flight

If you’ve created the .gdbinit script above, you are now ready to load and run the SMACCMPilot application. If not, you may enter those commands sequentially at the gdb prompt.

Once your gdb is attached to the probe, you can write the program to flash with the command:

(gdb) load

Then, to begin execution, use the command:

(gdb) run

Other GDB Resources

Your author typically uses this gdb reference card while debugging.