Well, Arduinos can be used to program other arduinos when you load the right firmware, you can even find firmwares to program other devices (in example, the "JTag whisperer" project uses an arduino as XSVF player to program some xilinx devices).
With the same idea in mind, but (I think) less complicated than emulating a jtag, we could program a generic STM32 board without messing with the boot jumpers or the reset button (that could be managed by the firmware in the AVR arduino) and making use of hardware you might have already.
If I get it correctly, when you compile the sketch and load it to an AVR arduino with onboard USB to TTL chip (a simple com port for the SO), a control signal is triggered on that chip, allowing to reset the MCU and OR put it in program mode (not sure if only reset and the bootloader works with timing or other signal is involved). So, there should be an usable flag in the upload script to diferentiate between normal serial comunication and programming.
If the firmware on the AVR arduino can detect and use that flag to tie Boot0 to high and then send a short pulse to reset to make the STM32 enter in the program mode using the embedded serial bootloader, upload the program using simple serial communication, ans when the upload finish turn back Boot0 to low and send another short pulse to reset to put the STM32 back in normal operation mode.
That way we would not mess with changing jumpers, reseting the MCU, or attaching/detaching the programmer. Is really annoying to have to do that things when we only correct little pieces of code and want to try fast the result.
The main advantages might be:
- dont have to mess with Boot jumpers
- dont have to mess with the reset button
- use hardware you might already have
- dont have to detach/attach the programmer after each upload
- need voltage level adaptation
- capable of only basic debug using the same serial
- may need other power source for the MCU at least for operation mode
For me it looks well even with the disvantages. Maybe someone with the stlink v2 (clone or not) can help me to make a comparison table between the 3 options, as for now I only have accesss to try the USB to serial TLL.