← 返回命令列表

Linux command

st-flash 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Flash binary

st-flash write [firmware.bin] [0x8000000]

Read flash

st-flash read [output.bin] [0x8000000] [0x1000]

Erase flash

st-flash erase

Reset device

st-flash reset

Verify write

st-flash --verify write [firmware.bin] [0x8000000]

说明

st-flash is a command-line tool for reading, writing, and erasing the flash memory of STM32 microcontrollers through an ST-Link programmer/debugger. It is part of the open-source stlink toolset. The tool works with raw binary files and requires explicit memory addresses for read and write operations. The flash base address for most STM32 devices is 0x8000000. Write verification can be enabled with --verify to confirm the programmed data matches the input file. The erase command clears the entire flash memory, and reset restarts the microcontroller after programming.

参数

write
Write to flash.
read
Read from flash.
erase
Erase all flash.
reset
Reset chip.
--verify
Verify after write.
--reset
Reset after operation.
--serial _SN_
Device serial.

FAQ

What is the st-flash command used for?

st-flash is a command-line tool for reading, writing, and erasing the flash memory of STM32 microcontrollers through an ST-Link programmer/debugger. It is part of the open-source stlink toolset. The tool works with raw binary files and requires explicit memory addresses for read and write operations. The flash base address for most STM32 devices is 0x8000000. Write verification can be enabled with --verify to confirm the programmed data matches the input file. The erase command clears the entire flash memory, and reset restarts the microcontroller after programming.

How do I run a basic st-flash example?

Run `st-flash write [firmware.bin] [0x8000000]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does write do in st-flash?

Write to flash.