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:

STM32Raspberry Pi
NRSTGPIO 4[*]
JTDO / PB3GPIO 9
TMS / PA13GPIO 25
JTCK / PA14GPIO 11
JTDI / PA15GPIO 10
[*] GPIO 4 is probably already connected to NRST with a jumper.

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.

PinDescriptionDesignation
1 VDD_TARGETVDD from applicationVDD, DNC when powered from Pi
2 SWCLKWD clockJTCK / PA14
3 GNDGroundGND
4 SWDIOSWD data input/outputTMS / PA13
5 NRSTRESET of target MCUNRST
6 SWOReservedJTDO / 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