stlink: st-flash run_flash_loader(0x08000000) failed

Hello. I try to load firmare in STM32F103CBT6 using compiled st-flash.exe utility under windows 8.1.

There is used command: st-flash.exe write ${project_name}.bin 0x08000000

Here is result:

Flash page at addr: 0x08000000 erased
Flash page at addr: 0x08000400 erased
Flash page at addr: 0x08000800 erased
Flash page at addr: 0x08000c00 erased
Flash page at addr: 0x08001000 erased
Flash page at addr: 0x08001400 erased
Flash page at addr: 0x08001800 erased
Flash page at addr: 0x08001c00 erased
Flash page at addr: 0x08002000 erased
Flash page at addr: 0x08002400 erased
Flash page at addr: 0x08002800 erased
Flash page at addr: 0x08002c00 erased
Flash page at addr: 0x08003000 erased
Flash page at addr: 0x08003400 erased
Flash page at addr: 0x08003800 erased
Flash page at addr: 0x08003c00 erased
Flash page at addr: 0x08004000 erased
Flash page at addr: 0x08004400 erased
Flash page at addr: 0x08004800 erased
Flash page at addr: 0x08004c00 erased
Flash page at addr: 0x08005000 erased
Flash page at addr: 0x08005400 erased
Flash page at addr: 0x08005800 erased
Flash page at addr: 0x08005c00 erased
Flash page at addr: 0x08006000 erased
Flash page at addr: 0x08006400 erased
Flash page at addr: 0x08006800 erased
Flash page at addr: 0x08006c00 erased
Flash page at addr: 0x08007000 erased
Flash page at addr: 0x08007400 erased
Flash page at addr: 0x08007800 erased
Flash page at addr: 0x08007c00 erased
Flash page at addr: 0x08008000 erased
Flash page at addr: 0x08008400 erased
Flash page at addr: 0x08008800 erased
Flash page at addr: 0x08008c00 erased
Flash page at addr: 0x08009000 erased
Flash page at addr: 0x08009400 erased
Flash page at addr: 0x08009800 erased
Flash page at addr: 0x08009c00 erased
Flash page at addr: 0x0800a000 erased
Flash page at addr: 0x0800a400 erased
stlink_fwrite_flash() == -1
2015-12-09T22:01:57 INFO src/stlink-common.c: Loading device parameters....
2015-12-09T22:01:57 INFO src/stlink-common.c: Device connected is: F1 Medium-density device, id 0x20036410
2015-12-09T22:01:57 INFO src/stlink-common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0xb4a000 bytes (11560 KiB) in pages of 1024 bytes
2015-12-09T22:01:57 INFO src/stlink-common.c: Attempting to write 42368 (0xa580) bytes to stm32 address: 134217728 (0x8000000)
2015-12-09T22:01:57 INFO src/stlink-common.c: Finished erasing 42 pages of 1024 (0x400) bytes
2015-12-09T22:01:57 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
2015-12-09T22:01:57 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2015-12-09T22:02:18 ERROR src/stlink-common.c: flash loader run error
2015-12-09T22:02:18 ERROR src/stlink-common.c: run_flash_loader(0x8000000) failed! == -1

What is the issue? Thank you)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 40 (23 by maintainers)

Commits related to this issue

Most upvoted comments

@Nightwalker-87 The flash_loader_rework branch

anton@vivobook:~/stlink/build/Release/bin$ ./st-flash --reset --format ihex write ./STM32F103_Nucleo_Demo.hex 
st-flash 1.6.1-229-gbc9062c-dirty
2021-03-22T19:22:48 WARN usb.c: NRST is not connected
2021-03-22T19:22:48 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
2021-03-22T19:22:48 WARN usb.c: NRST is not connected
2021-03-22T19:22:48 INFO common.c: Attempting to write 19328 (0x4b80) bytes to stm32 address: 134217728 (0x8000000)
2021-03-22T19:22:48 INFO common.c: Flash page at addr: 0x08000000 erased
...
2021-03-22T19:22:49 INFO common.c: Flash page at addr: 0x08004800 erased
2021-03-22T19:22:49 INFO common.c: Finished erasing 19 pages of 1024 (0x400) bytes
2021-03-22T19:22:49 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL
2021-03-22T19:22:49 INFO flash_loader.c: Successfully loaded flash loader in sram
 19/ 19 pages written
2021-03-22T19:22:50 INFO common.c: Starting verification of write complete
2021-03-22T19:22:50 INFO common.c: Flash written and verified! jolly good!
2021-03-22T19:22:50 WARN usb.c: NRST is not connected
anton@vivobook:~/stlink/build/Release/bin$ ./st-flash --reset --format ihex write ./STM32F103_Nucleo_Demo.hex 
st-flash 1.6.1-229-gbc9062c-dirty
2021-03-22T19:22:51 WARN usb.c: NRST is not connected
2021-03-22T19:22:51 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
2021-03-22T19:22:51 WARN usb.c: NRST is not connected
2021-03-22T19:22:51 INFO common.c: Attempting to write 19328 (0x4b80) bytes to stm32 address: 134217728 (0x8000000)
2021-03-22T19:22:51 INFO common.c: Flash page at addr: 0x08000000 erased
...
2021-03-22T19:22:52 INFO common.c: Flash page at addr: 0x08004800 erased
2021-03-22T19:22:52 INFO common.c: Finished erasing 19 pages of 1024 (0x400) bytes
2021-03-22T19:22:52 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL
2021-03-22T19:22:52 INFO flash_loader.c: Successfully loaded flash loader in sram
 19/ 19 pages written
2021-03-22T19:22:53 INFO common.c: Starting verification of write complete
2021-03-22T19:22:53 INFO common.c: Flash written and verified! jolly good!
2021-03-22T19:22:53 WARN usb.c: NRST is not connected

The develop branch

anton@vivobook:~/stlink/build/Release/bin$ ./st-flash --reset --format ihex write ./STM32F103_Nucleo_Demo.hex 
st-flash 1.6.1-229-gbc9062c-dirty
2021-03-22T19:27:36 WARN usb.c: NRST is not connected
2021-03-22T19:27:36 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
2021-03-22T19:27:36 WARN usb.c: NRST is not connected
2021-03-22T19:27:36 INFO common.c: Attempting to write 19328 (0x4b80) bytes to stm32 address: 134217728 (0x8000000)
2021-03-22T19:27:36 INFO common.c: Flash page at addr: 0x08000000 erased
...
2021-03-22T19:27:36 INFO common.c: Flash page at addr: 0x08004800 erased
2021-03-22T19:27:36 INFO common.c: Finished erasing 19 pages of 1024 (0x400) bytes
2021-03-22T19:27:36 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL
2021-03-22T19:27:36 INFO flash_loader.c: Successfully loaded flash loader in sram
2021-03-22T19:27:36 ERROR flash_loader.c: Write error (R2 0x000001F8 R15 0x080049D2 DHCSR 0x00030003 DFSR 0x00000009)
2021-03-22T19:27:36 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1
stlink_fwrite_flash() == -1
anton@vivobook:~/stlink/build/Release/bin$ ./st-flash --reset --format ihex write ./STM32F103_Nucleo_Demo.hex 
st-flash 1.6.1-229-gbc9062c-dirty
2021-03-22T19:27:38 WARN usb.c: NRST is not connected
2021-03-22T19:27:38 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
2021-03-22T19:27:38 WARN usb.c: NRST is not connected
2021-03-22T19:27:38 INFO common.c: Attempting to write 19328 (0x4b80) bytes to stm32 address: 134217728 (0x8000000)
2021-03-22T19:27:38 INFO common.c: Flash page at addr: 0x08000000 erased
...
2021-03-22T19:27:38 INFO common.c: Flash page at addr: 0x08004800 erased
2021-03-22T19:27:38 INFO common.c: Finished erasing 19 pages of 1024 (0x400) bytes
2021-03-22T19:27:38 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL
2021-03-22T19:27:38 INFO flash_loader.c: Successfully loaded flash loader in sram
 19/ 19 pages written
2021-03-22T19:27:39 INFO common.c: Starting verification of write complete
2021-03-22T19:27:40 INFO common.c: Flash written and verified! jolly good!
2021-03-22T19:27:40 WARN usb.c: NRST is not connected

Will test after 23th of August.

OK, enjoy your vacation. Please do the testing, it will help to reduce the amount of open issues of this cool project.

Besides @yeswolf also high-lighting @Almaz1c and @vladiks . See #1000 for other requests how to support this project.

@Nightwalker-87 Will test after 23th of August.

@Nightwalker-87 I use v1.6.0-dirty built from sources (downloaded from releases) with STM32F103RCT6 High-density.

Yep, finally I can test it. For me it’s

2020-03-29T13:55:22 INFO flash_loader.c: Successfully loaded flash loader in sram
2020-03-29T13:55:22 ERROR flash_loader.c: write error, count == 1023
2020-03-29T13:55:22 ERROR common.c: stlink_flash_loader_run(0x8000800) failed! == -1

always on macOS, so it’s pretty stable. Tired of mass erasing before, want to help %)