Debugging
Debugging is done with either OpenOCD's sysfsgpio interface on the Raspberry Pi or with an ST-Link V2 compatible programmer/debugger.
OpenOCD
Choosing "Update/Install OpenOCD" from the 'setup' menu, downloads the OpenOCD source code from github, and builds/installs it automatically. This takes about 45 minutes. It needs to be built from source, because the OpenOCD version from the Raspbian repository doesn't support the Raspberry Pi sysfsgpio interface yet.
Make the following connections between pins on the ARMinARM board:
STM32 | Raspberry Pi |
---|---|
NRST | GPIO 4[*] |
JTDO / PB3 | GPIO 9 |
TMS / PA13 | GPIO 25 |
JTCK / PA14 | GPIO 11 |
JTDI / PA15 | GPIO 10 |
Debugging with OpenOCD
In 1 terminal:
arminarm openocd
In another terminal:
arm-none-eabi-gdb
(gdb) target extended-remote localhost:3333
(gdb) [do your thing]
Change 'localhost' to 'raspberrypi' or its IP address to connect to it remotely.
ST-Link flash & debug
Choose 'Update/Install ST-Link' from the 'setup' menu. Make SWD connections with an ST-Link V2 or Fx-Discovery.
Pin | Description | Designation |
---|---|---|
1 VDD_TARGET | VDD from application | VDD, DNC when powered from Pi |
2 SWCLK | WD clock | JTCK / PA14 |
3 GND | Ground | GND |
4 SWDIO | SWD data input/output | TMS / PA13 |
5 NRST | RESET of target MCU | NRST |
6 SWO | Reserved | JTDO / PB3 (optional) |
Flashing with an ST-Link V2 or Fx-Discovery.
st-flash --reset write build/leds.bin 0x08000000
Debugging with an ST-Link V2 or Fx-Discovery.
In 1 terminal:
st-util
In another terminal:
arm-none-eabi-gdb
(gdb) target extended-remote :4242
(gdb) load build/leds.elf
(gdb) r