Trying to program an STM32 device with ST-LINK_CLI.exe


I have a project developed using STM32IDE, all is well and I want to develop a test script to program the devices in bulk, using the STLINK/V2. To do this I want to invoke ST0LINK_CLI.exe

I can connect to the device and erase it fine like this:


When I take the .bin file from my project I can program it onto the device but the chip does not run. In addition if I add the -V option to verify, there is a problem:

C:\my_dir>ST-LINK_CLI.exe -P C:\Temp\my_img.bin -V
STM32 ST-LINK CLI v3.5.0.0
STM32 ST-LINK Command Line Interface

ST-LINK SN: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ST-LINK Firmware version: V2J37S7
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 3.2 V
Connection mode: Normal
Reset mode: Hardware reset
Device ID: 0x413
Device flash Size: 512 Kbytes
Device family: STM32F405xx/F407xx/F415xx/F417xx
Loading file...
Flash Programming:
  File : C:\Temp\my_img.bin
  Address : 0x00000000
Memory programming...
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 100%
Memory programming...
No OnChip verification function found. Verify after programming will be performed.
Reading and verifying device memory...
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 0%
Programming error @: 0x00000188

What's the issue? The bin file should be a memory image, right, it does not need to be loaded at a specific address? I've searched and looked in the docs, I don't find a reason that this would not work.

Many thanks.

Best Answer

OK, solved. The .bin file needs in fact to be loaded at address 0x08000000 then all is well. Correct command is :

ST-LINK_CLI.exe -P C:\Temp\my_code.bin 0x08000000 -V
Related Topic