2016-06-28 20:56:09 +00:00
|
|
|
Black Magic Probe
|
|
|
|
=================
|
|
|
|
|
|
|
|
[![Build Status](https://travis-ci.org/blacksphere/blackmagic.svg?branch=master)](https://travis-ci.org/blacksphere/blackmagic)
|
2019-08-27 00:22:02 +00:00
|
|
|
[![Discord](https://img.shields.io/discord/613131135903596547?logo=discord)](https://discord.gg/P7FYThy)
|
2016-12-03 21:26:25 +00:00
|
|
|
[![Donate](https://img.shields.io/badge/paypal-donate-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=N84QYNAM2JJQG)
|
2016-12-03 21:47:01 +00:00
|
|
|
[![Kickstarter](https://img.shields.io/badge/kickstarter-back%20us-14e16e.svg)](https://www.kickstarter.com/projects/esden/1bitsy-and-black-magic-probe-demystifying-arm-prog)
|
2016-06-28 20:56:09 +00:00
|
|
|
|
|
|
|
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.
|
2020-05-14 11:01:48 +00:00
|
|
|
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](https://github.com/blacksphere/blackmagic/wiki/Serial-Wire-Output).
|
2016-06-28 20:56:09 +00:00
|
|
|
|
|
|
|
See online documentation at https://github.com/blacksphere/blackmagic/wiki
|
|
|
|
|
2016-10-22 21:32:35 +00:00
|
|
|
Binaries from the latest automated build are at http://builds.blacksphere.co.nz/blackmagic
|
2020-05-09 16:14:18 +00:00
|
|
|
|
2020-06-09 09:28:32 +00:00
|
|
|
Sample Session
|
|
|
|
=============
|
|
|
|
```console
|
|
|
|
> 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 {
|
|
|
|
```
|
|
|
|
|
2020-05-09 16:14:18 +00:00
|
|
|
BLACKMAGIC
|
|
|
|
==========
|
|
|
|
|
|
|
|
You can also build blackmagic as a PC hosted application
|
|
|
|
"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 PC-Hosted GDB server is via TCP port 2000 for the first
|
|
|
|
GDB server and higher for more invokations. Use "tar(get) ext(ented) :2000"
|
|
|
|
to connect.
|
2020-06-09 09:28:32 +00:00
|
|
|
PC-hosted BMP GDB server 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.
|
2020-05-09 16:14:18 +00:00
|
|
|
|
|
|
|
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.
|
2020-06-09 09:28:32 +00:00
|
|
|
Add "-P (position)" to the next invocation to select one.
|
|
|
|
For the setup from the sample session above:
|
|
|
|
In another terminal:
|
|
|
|
```console
|
|
|
|
> blackmagic
|
|
|
|
Using 1d50:6018 E2E489E7 Black Sphere Technologies Black Magic Probe (STLINK), (Firmware v1.6.1-477-g70bb131-dirty)
|
|
|
|
Remote is Black Magic Probe (STLINK), (Firmware v1.6.1-477-g70bb131-dirty) v1.6.1-477-g70bb131-dirty
|
|
|
|
Listening on TCP: 2000
|
|
|
|
And in the GDB terminal:
|
|
|
|
(gdb) target ext :2000
|
|
|
|
Remote debugging using :2000
|
|
|
|
(gdb) mon s
|
|
|
|
...
|
|
|
|
```
|
2020-05-09 16:14:18 +00:00
|
|
|
|
|
|
|
PC hosted BMP also allows to flash, read and verify a binary file, by default
|
2020-06-09 09:28:32 +00:00
|
|
|
starting at lowest flash address. The "-t" argument displays information about the
|
2020-05-09 16:14:18 +00:00
|
|
|
connected target. Use "-h " to get a list of supported options.
|
2020-06-09 09:28:32 +00:00
|
|
|
|