Go to file
SId Price cf2bd66a62 Add required quotes to st-link udev rules 2022-09-24 16:46:56 -04:00
.github workflows: add size diff workflow 2022-08-24 17:24:28 -04:00
.vscode misc: Added recomendations for VSCode extensions to be used with the project 2022-06-26 22:28:31 -07:00
contrib/zsh hosted: Documented the new command line option and added it to the ZSH completions 2022-06-26 14:28:35 -07:00
driver Add required quotes to st-link udev rules 2022-09-24 16:46:56 -04:00
libopencm3@44e142d4f9 misc: Switched to using C11 2022-07-18 20:59:15 -07:00
scripts workflows: add size diff workflow 2022-08-24 17:24:28 -04:00
src stm32f4: fix wrong idcode when probing (#1242) 2022-09-20 19:03:27 +01:00
upgrade misc: Cleanup include guards. 2022-08-23 15:06:21 -04:00
.clang-format misc: Removed the executable bit from the clang-format configuration 2022-08-07 20:16:04 -07:00
.clang-tidy misc: Made an exception in the clang-tidy config for memcpy/memmove/etc 2022-07-18 20:59:15 -07:00
.gitattributes gitattributes: add attributes file 2020-12-16 12:51:09 +01:00
.gitignore Move all files from "pc" folder to "hosted", update Makefile.inc 2022-06-26 12:04:21 -04:00
.gitmodules Changed libopencm3 url to https. 2012-10-24 07:34:30 +13:00
CODE_OF_CONDUCT.md misc: Added a code of conduct based on the Contributors Covenant 2022-06-26 16:39:31 -07:00
CONTRIBUTING.md misc: Added advice on how contribution licensing should be done and works 2022-08-28 14:25:04 -07:00
COPYING Added README and COPYING 2011-02-07 11:01:10 +13:00
COPYING-BSD misc: Added a license file for BSD-3-Clause that covers the SFDP code and any other additions made under that license 2022-08-07 13:35:10 -07:00
COPYING-MIT misc: Added a file with the MIT license as stm32g0.c is licensed under MIT 2022-08-15 22:16:15 -07:00
Makefile misc: Added a clang-tidy Makefile target so enforcing the formatting is easier 2022-06-26 18:55:04 -07:00
README.md misc: change old wiki links to point to website instead 2022-08-09 13:01:13 -04:00
UsingRTT.md rtt: Cleaned up updated and improved the RTT usage documentation. 2022-08-22 20:36:20 -04:00
UsingSWO.md swo-docs: Converted to markdown and cleaned up a bit. 2022-08-23 10:19:43 -04:00
shell.nix add blackmagic package itself 2022-05-31 21:39:16 -04:00

README.md

Black Magic Probe

Discord

Firmware for the Black Magic Debug Probe.

The Black Magic Probe is a modern, in-application debugging tool for embedded microprocessors. It allows you see what is going on 'inside' an application running on an embedded microprocessor while it executes. It is able to control and examine the state of the target microprocessor using a JTAG or Serial Wire Debugging (SWD) port and on-chip debug logic provided by the microprocessor. The probe connects to a host computer using a standard USB interface. The user is able to control exactly what happens using the GNU source level debugging software, GDB. Serial Wire Output (SWO) allows the target to write tracing and logging to the host without using usb or serial port. Decoding SWO in the probe itself makes SWO viewing as simple as connecting to a serial port.

Resources

Toolchain specific remarks

Building the firmware is done with the most recent toolchain available from ARM's GNU-RM toolchains. If you have a toolchain from other sources and find problems, check if it is a failure of your toolchain and if not open an issue or better provide a pull request with a fix.

OS specific remarks for BMP-Hosted

Most hosted building is done on and for Linux. BMP-hosted for windows can also be build with Mingw on Linux.

Building hosted for BMP firmware probes only with "make PROBE_HOST=hosted HOSTED_BMP_ONLY=1" does not require libusb, libftdi and evt. libhidapi development headers and libraries for running.

On BSD/Macos, using dev/tty.usbmodemXXX should work but unresolved discussions indicate a hanging open() call on the second invocation. If that happens, try with cu.usbmodemXXX.

Reporting problems

Before reporting issues, check against the latest git version. If possible, test against another target /and/or debug probe. Consider broken USB cables and connectors. Try to reproduce with bmp-hosted with at least debug bit 1 set (blackmagic -v 1 ...), as debug messages will be dumped to the starting console. When reporting issues, be as specific as possible!

Sample Session

> arm-none-eabi-gdb gpio.elf
...<GDB Copyright message>
(gdb) tar ext /dev/ttyACM0
Remote debugging using /dev/ttyACM0
(gdb) mon s
Target voltage: 2.94V
Available Targets:
No. Att Driver
 1      STM32F40x M3/M4
(gdb) att 1
Attaching to program: /devel/en_apps/gpio/f4_discovery/gpio.elf, Remote target
0x08002298 in UsartIOCtl ()
(gdb) load
Loading section .text, size 0x5868 lma 0x8000000
Loading section .data, size 0x9e0 lma 0x8005868
Loading section .rodata, size 0x254 lma 0x8006248
Start address 0x800007c, load size 25756
Transfer rate: 31 KB/sec, 919 bytes/write.
(gdb) b main
Breakpoint 1 at 0x80000e8: file /devel/en_apps/gpio/f4_discovery/../gpio.c, line 70.
(gdb) r
Starting program: /devel/en_apps/gpio/f4_discovery/gpio.elf
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, main () at /devel/en_apps/gpio/f4_discovery/../gpio.c:70
70      {

Black Magic Debug App

You can also build the Black Magic Debug suite as a PC program called Black Magic Debug App by running make PROBE_HOST=hosted

This builds the same GDB server that is running on the Black Magic Probe. While connection to the Black Magic Probe GDB server is via serial line, connection to the Black Magic Debug App is via TCP port 2000 for the first GDB server and higher for more invokations. Use "tar(get) ext(ented) :2000" to connect.

Black Magic Debug App can talk to

  • Black Magic Probe firmware probes via the USB-serial port
  • ST-LinkV2 and V3 with recent firmware
  • CMSIS-DAP compatible probes
  • JLINK probes
  • FTDI MPSSE based probe.

When connected to a single BMP supported probe, starting "blackmagic" w/o any arguments starts the server. When several BMP supported probes are connected, their types, position and serial number is displayed and the program exits. Add "-P (position)" to the next invocation to select one. For the setup from the sample session above:

In another terminal:

> blackmagic
Black Magic Debug App v1.8.0
 for Black Magic Probe, ST-Link v2 and v3, CMSIS-DAP, JLink and libftdi/MPSSE
Using 1d50:6018 8BB20A03 Black Magic Debug
 Black Magic Probe  v1.8.0
Listening on TCP: 2000

And in the GDB terminal:

(gdb) tar ext :2000
Remote debugging using :2000
(gdb) mon s
...

Black Magic Debug App also provides for Flashing, reading and verification of a binary file, by default starting at lowest flash address. The -t argument displays information about the connected target. Use -h/--help to get a list of supported options.