I got a bit tired of not being able to debug on the NXP LPC1114, which supports SWD only (no JTAG). I discovered Black Magic Probe (http://www.blacksphe...main/blackmagic
), which is an open source project that uses an STM32 to export a GDB server via an USB serial device. It support both JTAG and SWD and should support a wide range of Cortex-M0, M3, and M4 targets. It can be used both for debugging and flashing of the target device.
There is dedicated hardware for this, and it can be run on the F4-discovery boards as well. Unfortunately, I do not have any F4-discovery boards lying around. But I do have a couple of Stellaris Launchpads that do nothing but sit in their box. So I added the necessary code to allow the Black Magic Probe firmware to be flashed on the Stellarpad (which really wasn’t that much).
Currently, UART0 on the LM4F is used, which is connected to the on-board debugger module that exports it via USB as a CDC ACM serial device.
The pinout is as follows:
JTAG TMS / SWD IO - PB5
JTAG TCK / SWD CLK - PB0
JTAG TDI - PB1
JTAG TDO - PE4
TRST - PA5
SRST - PA6
IDLE LED - PF2 / Blue LED
ERROR LED - PF3 / Green LED
Please try it out, and let me know if there are any issues.
The quick build instructions (for Linux) are:
src$ git clone https://github.com/xpgdk/blackmagic.git
Cloning into 'blackmagic'...
remote: Counting objects: 1858, done.
remote: Compressing objects: 100% (763/763), done.
remote: Total 1858 (delta 1230), reused 1704 (delta 1084)
Receiving objects: 100% (1858/1858), 610.80 KiB | 324 KiB/s, done.
Resolving deltas: 100% (1230/1230), done.
src$ cd blackmagic
src/blackmagic$ git checkout stellaris_launchpad
Branch stellaris_launchpad set up to track remote branch stellaris_launchpad from origin.
Switched to a new branch 'stellaris_launchpad'
src/blackmagic$ git submodule init
Submodule 'libopencm3' (https://github.com/xpgdk/libopencm3.git) registered for path 'libopencm3'
src/blackmagic$ git submodule update
Cloning into 'libopencm3'...
remote: Counting objects: 12626, done.
remote: Compressing objects: 100% (6494/6494), done.
remote: Total 12626 (delta 6511), reused 11757 (delta 5726)
Receiving objects: 100% (12626/12626), 3.25 MiB | 733 KiB/s, done.
Resolving deltas: 100% (6511/6511), done.
Submodule path 'libopencm3': checked out 'f5c15fe74e438dc9cceac6543d2c180957a3dd9b'
src/blackmagic$ cd libopencm3
src/blackmagic/libopencm3$ cd ../src
src/blackmagic/src$ make PROBE_HOST=stellaris-launchpad
src/blackmagic/src$ lm4flash blackmagic.bin
Now, you should be able to connect to the GDB server:
(gdb) target extended-remote /dev/ttyACM0
(gdb) monitor swdp_scan
Target voltage: not supported
No. Att Driver
(gdb) attach 1
Attached to Remote target
0x00001066 in ?? ()