Running a debugger

This is how you do it on Linux, I will try to figure out how to do it on other Mac and Windows later:

  1. get an ST-link V2
  2. hook SWDIO, SWDCLK and GND to the corresponding pads on the proffieboard
  3. Start openocd, which is a bridge server between gdb and the st-link.
cd $HOME/.arduino15/packages/proffieboard/hardware/stm32l4/*.*.*/
sudo ./tools/linux/openocd/bin/openocd -s tools/share/openocd/scripts/ -f  ./variants/STM32L433CC-Proffieboard/openocd_scripts/stm32l433cc_butterfly.cfg 
  1. Compile and upload ProffieOS (or some other program) to your Proffieboard
  2. In the compilation output, find the generated elf file, also make sure to remember your source dirctory.
  3. Run gdb-multiarch
gdb-multiarch -d  /path/to/ProffieOS /tmp/arduino_build_250572/ProffieOS.ino.elf -ex 'target remote localhost:3333' 
  1. When you first connect, the state will be kind of weird and the program will still be running. Type cont and then press ctrl-c to stop the program. Now you can inspect variables and generally use gdb as you would normally.

One day this might all become easier, but right now, not a lot of people actually use this, so it’s not been a high priority for me.

1 Like