Thanks to the help of Martin Frb latest trunk has support for the Black Magic Debug-Probe.
More Info on BMP can be found here:
https://github.com/blacksphere/blackmagic/wikiThe main advantages of BMP are:
- Works on ST-Link Hardware (also Cheap Chinese ST-Link V2 Clones and BluePill boards)
- Supports not only debugging STM32 Chips, but also Atmel, NXP and Freescale chips
- Does not need additional Software, it directly connects to gdb over COM Port, so no more need to install st-link software or ST Toolchain for debugging.
To convert your Chinese clone check here (you need to scroll down on the page to find instructions for the Clones):
http://embdev.net/articles/STM_Discovery_as_Black_Magic_Probeand
https://madnessinthedarkness.transsys.com/blog:2017:0122_black_magic_probe_bmp_on_st-link_v2_clonesnow compile trunk of lazarus and fire up the debugger settings.
To find out correct configuration check
/dev/cu.usbmodem* device entries on Mac, the right port to connect to is the first found
open Device Manager on Windows and check for COM Ports, on my PC the 2nd COM Port (COM5) was the correct one to connect to.
Now go to Debugger Backend Settings and configure according to the screenshot attached.
Here's the complete script that needs to go into EventProperties->AfterConnect:
monitor swdp_scan
#!timeout=1000
#!timeoutwarn=false
attach 1
#!timeout=default
#!timeoutwarn=true
set mem inaccessible-by-default off
After this debugging should work.
For troubleshooting fire up gdb and enter the following:
(gdb) target extended-remote COM5
Remote debugging using COM5
(gdb)
(gdb)
(gdb) monitor
Black Magic Probe (Firmware v1.6.1-352-g3a6947a) (Hardware Version 0)
Copyright (C) 2015 Black Sphere Technologies Ltd.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
(gdb) monitor swdp_scan
Target voltage: unknown
Available Targets:
No. Att Driver
1 STM32F1 medium density M3/M4
don't bother trying to troubleshoot connectivity issues from within lazarus, firing up gdb is far more efficient and faster to use!
You will need to adjust the settings in "AfterConnect" if your microcontroller does not show enumerate as Target No. 1, change the "attach 1" line to the number that you see for your controller.
If gdb seems to hang after target extended-remote command unplug and re-plug the debug probe and try the other port.
Please note that I was NOT able to connect to the Debug Probe inside of VMWare Fusion, so if you use a virtual Machine to run Windows then BMP is perhaps not the first choice.
Have fun,
Michael