As your primary resource, please read the PX4 Autopilot project wiki guide to using the Black Magic Probe.
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.
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
target extended SERIAL_PORT monitor swdp_scan attach 1
SERIAL_PORT is the path of the first serial device enumerated by the Black Magic probe.
From the root of the
smaccmpilot-stm32f4 repository, after successfully building the SMACCMPilot executable, start your ARM toolchain gdb with the
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:
Then, to begin execution, use the command:
Your author typically uses this gdb reference card while debugging.