STM32 stlink_flash_loader_run(0x8000000) failed! == -1

Good afternoon, I was trying to debug a program on my new stm32f103C8T6 chip using the st-link v2 programmer, but i always get some weird errors about the flash memory.

  • STM32Cube outputs that “Flash size : 63.999 MBytes”

  • st-flash command on terminal indicates "

SRAM size: 0x5000 bytes (20 KiB), Flash: 0x1904000 bytes (25616 KiB) in pages of 1024 bytes"

When I attempt to debug on stm32cube i have this :

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 9]

Error: failed to erase memory

Error: failed to erase memory

Encountered Error when opening /Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.macos64_1.0.0.201904021149/tools/bin/STM32_Programmer_CLI

Error in STM32CubeProgrammer

Error! Failed to read target status 

Debugger connection lost.

Shutting down…


Which is normal because there is no 64Mbytes of flash on the chip, and why i try to program with the st-flash command i get :

adams-143:Debug Danny$ st-flash write Arm\ board.bin 0x8000000

st-flash 1.5.1

2019-08-15T21:24:52 INFO common.c: Loading device parameters…

2019-08-15T21:24:52 INFO common.c: Device connected is: F1 Medium-density device, id 0x20036410

2019-08-15T21:24:52 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x1904000 bytes (25616 KiB) in pages of 1024 bytes

2019-08-15T21:24:52 INFO common.c: Attempting to write 4572 (0x11dc) bytes to stm32 address: 134217728 (0x8000000)

Flash page at addr: 0x08001000 erased

2019-08-15T21:24:52 INFO common.c: Finished erasing 5 pages of 1024 (0x400) bytes

2019-08-15T21:24:52 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id

2019-08-15T21:24:52 INFO flash_loader.c: Successfully loaded flash loader in sram

2019-08-15T21:24:55 ERROR flash_loader.c: flash loader run error

2019-08-15T21:24:55 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1

stlink_fwrite_flash() == -1


Can someone help me out please ?

2 Likes