Member-only story
Flashing an STM32
How to load firmware on the most common ARM microcontroller family
If you landed here I’m going to assume you have a binary firmware ready to be loaded onto an STM32-like-kinda-similarish device.
If not, you should definitely prepare one! Then come back when you are ready.
There area a few options when approaching this task that are more or less valid depending on what actually is your target.
Official STM32 discovery boards (such as https://www.st.com/en/evaluation-tools/nucleo-f030r8.html) integrate an st-link download tool, so they can be just plugged in as USB devices.
If you have something like a Blue Pill you will require external tooling and some wiring to load the firmware.
Fear not, as everything is relatively inexpensive.

While most notions here apply to the vast majority of STM32 devices, I will be taking the Blue Pill as main reference.
Unless otherwise specified, I will be assuming you have a valid couple of files named application.elf
and application.bin
at hand to be loaded onto the device.
Option 1: Using an ST-Link Programmer
Most microcontrollers nowadays ship with some internal logic to be programmed on the spot by specific devices. ST-Link is a generic name that covers many variants of STM32 programmers, and any one of those should be sufficient for our purposes.
While more official tools’ cost can range from 20 to 100 Euros, the web is filled with smaller clones that get thrown at you for as low as 2 bucks — and they suffice.
As mentioned before, some demo boards already include an integrated st-link tool, so the device should popup when you plug it in through USB. You don’t need any external hardware in that case.
ATTENTION: There are some differences between official ST tools and counterfeits that you should be aware of.
The debugger connection for STM32’s SWD protocol includes four lines: GND, 3v3, SWDIO and SWCLK.
While the…