For programming the STM32 there are different possibility that are:
- SWD – is ARM specification, useful for developing a FW, it use only 2 pins (SWDIO and SWCLK) + GND, VCC, /RST pin and optionally SWO pin
- JTAG – is ARM specification, useful for developing a FW
- DFU or DFUSE – is STM utility that use USB interface for program the STM32.
The STM32 must be put in boot mode. - Flash Loader – is STM utility that use UART interface for program the STM32.
The STM32 must be put in boot mode.https://www.emcu-homeautomation.org/how-to-program-the-stm32/
For more info see here.