cd /opt/src/ apt-get install build-essential git cmake libusb-1.0-0-dev rehash git clone https://github.com/stlink-org/stlink cd stlink cmake . make make install ldconfig cp config/udev/rules.d/49-stlinkv* /etc/udev/rules.d/ cp config/modprobe.d/stlink_v1.conf /etc/modprobe.d/ udevadm control --reload-rules udevadm trigger
On linux we can disable the built in mass storage devices STLINK compatible boards contain, see here.
A simple way to test a device is to read nothing from the device.
st-flash read /dev/null 0 0
Various boards have been tested in this manner below.
vcc-gnd (STM32F103R8)
INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
Maple mini clone (STM32F103R8)
INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
Nucleo STM32F302 (STM32F302R8T6)
INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F3 small device, id 0x10016439 INFO src/stlink-common.c: SRAM size: 0xa000 bytes (40 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 2048 bytes
Nucleo STM32F411 (STM32F411RET6)
INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F4 device (low power) - stm32f411re, id 0x10006431 INFO src/stlink-common.c: SRAM size: 0x20000 bytes (128 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 16384 bytes
STM32F4 Discovery (STM32F407VGT6)
INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F4 device, id 0x10016413 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 16384 bytes
STM32 Value Line Discovery (STM32F100RBT6B)
INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F1 Medium/Low-density Value Line device, id 0x10016420 INFO src/stlink-common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
STM32F030 DEMO BOARD V1.0 (STM32F030F4P6)
INFO src/stlink-common.c: Loading device parameters.... INFO src/stlink-common.c: Device connected is: F0 small device, id 0x10006444 INFO src/stlink-common.c: SRAM size: 0x1000 bytes (4 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 1024 bytes
Programming interface
For these programming interfaces two jumpers must be removed to disable the internal board connections and allow external programming.
STLink SWD | VL discovery | F4 discovery | Nucleo CN4 |
---|---|---|---|
1 | VDD | VDD | VDD |
2 | SWCLK | SWCLK | SWCLK |
3 | GND | GND | GND |
4 | SWDIO | SWDIO | SWDIO |
5 | NRST | NRST | |
6 | SWO | SWO |
Target interface
STLink SWD | vcc-gnd | Maple mini | Generic |
---|---|---|---|
1 | VDD | ||
2 | DCLK | 21 | PA14 |
3 | GND | GND | GND |
4 | DIO | 22 | PA13 |
5 | NRST | ||
6 |