Black Magic Probe
Usually when flashing and debugging software on STM32 one would use a ST-Link device (either original or a cheap Chinese clone). For some completely incomprehensible reason, ST are not making the source code for the ST-Link readily available. Not only do they not provide source code, but it would appear they are actively trying to prevent clones from working.
The Black Magic Probe firmware can be build for many different platforms with different pinout. The following sections list the pinout.
$ make PLATFORM=bluepill
make PROBE_HOST=stlink ST_BOOTLOADER=0 ENABLE_DEBUG=1
$ make PROBE_HOST=f4discovery BLACKPILL=1 ENABLE_RTT=1
With the blackmagic bootloader, firmware can be upgraded:
dfu-util -d 1d50:6018,:6017 -s 0x08002000:leave -D blackmagic.bin