Simple flashing tool for the STM32 ecosystem.
Listens for a global hotkey (Ctrl+Shift+F12) and automatically flashes an STM32 device using STM32CubeProgrammer CLI — no need to open any GUI.
- One-keystroke flashing from anywhere on your desktop
- Full chip erase before programming
- Write & verify firmware
- Automatic reset after flashing
- Real-time CLI output in the terminal
- Supports SWD (ST-LINK), DFU (USB) and UART connections
- Python 3.8+
- STM32CubeProgrammer installed (CLI must be accessible)
- Python packages:
keyboard
Install the dependency with:
pip install -r requirements/runtime.txtNote: On Windows the script must be run with administrator privileges for the global hotkey listener to work reliably.
The tool supports runtime config from a JSON file placed next to the script/exe:
stm32_easy_flash.config.json
Create stm32_easy_flash.config.json with the following content:
{
"CLI_PATH": "C:\\ST\\STM32CubeProgrammer\\bin\\STM32_Programmer_CLI.exe",
"FIRMWARE_PATH": "C:\\path\\to\\your\\firmware.hex",
"PORT": "SWD",
"HOTKEY": "ctrl+shift+f12"
}Optional environment variables (override JSON values):
STM32_EASY_FLASH_CLI_PATHSTM32_EASY_FLASH_FIRMWARE_PATHSTM32_EASY_FLASH_PORTSTM32_EASY_FLASH_HOTKEY
python stm32_easy_flash.pyThe script/exe starts and waits in the background. Whenever you press your configured hotkey (default: Ctrl+Shift+F12), it:
- Erases the entire chip
- Writes the configured firmware
- Verifies the written data
- Resets the MCU
Stop the script at any time with Ctrl+C in the terminal.
| Value | Interface |
|---|---|
SWD |
ST-LINK via SWD |
JTAG |
ST-LINK via JTAG |
USB1 |
DFU over USB |
COMx |
UART bootloader |
The pre-built executables may be flagged as suspicious by Windows Defender, macOS Gatekeeper or third-party antivirus software. This is a false positive — the source code is fully open and contains no malicious code.
The false detections are caused by how PyInstaller packages Python applications (self-extracting to a temp directory, bundled runtime, etc.). This is a well-known PyInstaller issue.
Workarounds:
| Platform | Steps |
|---|---|
| Windows | Click More info → Run anyway on the SmartScreen dialog, or add an exclusion in Windows Defender settings. |
| macOS | Right-click the app → Open → confirm the dialog. Then allow under System Settings → Privacy & Security → Accessibility. |
See Issue #11 for full details and ongoing improvements (code-signing, VirusTotal CI scans).
MIT © 2026 MootSeeker