So I couldn't get the mbed software debugging to work but I was able to connect the ST -LINK to the Opta and get it to hardware debug.
-
Add connection to the Opta PCB:
-
Make sure that the pcb interconnect is plugged correctly when reassembling. I found it was easy to misalign this and cause it to fail.
-
Set the programmer to "STMicroelectronicsSTLINK" under Tools>Programmer. If you're using the PlatformIO VS Code plugin (highly recommend. It's brilliant), open the project's platformio.ini and add
debug_tool = stlink
upload_protocol = stlink
debug_build_flags = -O0 -g -ggdb
to the [env:opta] section.
- Debug!
-With ArduinoIDE, starting debugging and uploading can be painful. Only one IDE window can be open at a time. For the very first debug session, you'll have to click the Debug button. This should open the Debug pane and should show "Opta (stlink)" in the dropdown. Make sure the debugger is not running, set Opta to Upload mode, by double tapping the Reset button, Upload (not Debug) via USB in DFU mode, once finished, click the "Start Debugging" green triangle. This won't reset the Opta, so press the Reset button on the Opta if you wish to reset. It will pause on the reset, so make sure you click Continue. Note that Variables might get optimized out even with "Optimize for Debugging" turned on.
-With PlatformIO, everything pretty much works as expected. Open Debug pane and click Start Debug triangle. It will pause on the very first instruction and you can step through even the library code. Variables won't be optimized out. Debugging with PlatformIO is so much better.
If anyone knows anyone at Finder- kindly light a fire under their bum to get them to add a proper external debug port!



