Option 1: Command-Line (Windows/Mac/Linux)
https://github.com/texane/stlink/releases/tag/1.3.0
USB Drivers: (Windows)
https://zadig.akeo.ie
Code: Select all
st-flash.exe write stm32_loader.bin 0x08000000 --reset
Code: Select all
st-flash.exe write stm32_loader.hex --reset
Bootloader: 0x08000000
Firmware: 0x08001000
Option 2: GUI (Windows Only)
https://www.st.com/en/development-tools ... nk004.html (registration required)
![Image](https://www.st.com/content/ccc/fragment/product_related/rpn_information/board_photo/group0/34/3d/b5/98/e2/6d/41/48/stm32-st-link-utility.jpg/files/stm32-st-link-utility.jpg/_jcr_content/translations/en.stm32-st-link-utility.jpg)
How does it work?
By default STM32 operates with JTAG. ST-Link is a SWD (Serial over Wire) only needs 2 pins - clock and data in/out
To start SWD we need to send "magic" sequence.
First it sends 50+ ones
Code: Select all
wireWrite(0xFFFFFFFF, 32);
wireWrite(0xFFFFFFFF, 32);
Code: Select all
wireWrite(0xE79E, 16); // 0b0111100111100111
Code: Select all
wireWrite(0xFFFFFFFF, 32);
wireWrite(0xFFFFFFFF, 32);
Code: Select all
wireWrite(0, 32);
wireWrite(0, 32);
There is more after (like getting ID code) but this is the basics.