Firmware uploader for ST-Link
  • C 94.8%
  • Makefile 5.2%
Find a file
2026-04-06 07:52:01 +02:00
docs fix : only v2-1 checks for the magic number 2026-04-06 07:52:01 +02:00
src fix : only v2-1 checks for the magic number 2026-04-06 07:52:01 +02:00
tiny-AES-c@12e7744b49 Update tiny-Aes 2021-11-08 20:37:46 +01:00
.clang-format misc : update .clang_format 2026-04-04 23:45:11 +02:00
.clang-tidy Added clang-tidy and clang-format configurations matching Black Magic Debug 2024-01-26 18:29:13 +00:00
.gitignore feat : allow booting straight to the app 2026-04-04 22:14:55 +02:00
.gitmodules Initial commit 2018-01-20 21:34:48 +01:00
Makefile Fixed the build errors caused by implicit decls becoming invalid by going to C11 2024-01-26 20:18:29 +00:00
README.md fix : only v2-1 checks for the magic number 2026-04-06 07:52:01 +02:00

stlink-tool

libusb tool for flashing chinese ST-Link dongles. Please note that similarly to ST's updater, the uploaded firmware won't replace the bootloader (meaning that you should be able to reflash the original afterwards using ST's firmware update utility).

Usage: ./stlink-tool [options] firmware.bin
Options:
	-p	Probe the ST-Link adapter
	-m	Embed magic number to make STLink V2-1 application start on power on
	-h	Show help

stlink-tool has been tested under Linux and macOS. With sakana280's fork you can use it under Windows.

Compiling

Required dependencies :

  • C compiler (both clang and gcc seems to work great)
  • libusb1
  • git
git clone https://github.com/jeanthom/stlink-tool
cd stlink-tool
git submodule init
git submodule update
make

Firmware upload protocol

ST's firmware upload protocol is USB's DFU protocol with some twists. Every DFU command is issued with the 0xF3 prefix, and the command set does not exactly match USB's.

Some documentation :