#debugging #swd #stlink #black-magic-probe

app stlink-tool-rs

A tool to flash chinese ST-link dongles

2 unstable releases

0.2.0 Mar 11, 2023
0.1.0 Mar 11, 2023

#727 in #debugging

MIT license

19KB
384 lines

stlink-tool-rs

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-rs [options] firmware.bin
Options:
	-p	Probe the ST-Link adapter
	-h	Show help

stlink-tool-rs has been tested under Linux.

Compiling

Prerequisite - Rust toolchain.

cargo build

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 :

Thanks

This is a reimplementation in rust of https://github.com/UweBonnes/stlink-tool/tree/stlinkv21 Mainly for the purpose of learning some Rust, with a real project.

Dependencies

~6–8MB
~150K SLoC