Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L0xx: st-util flashing is very slow #274

Closed
ghost opened this issue Oct 14, 2014 · 2 comments · Fixed by #675
Closed

L0xx: st-util flashing is very slow #274

ghost opened this issue Oct 14, 2014 · 2 comments · Fixed by #675

Comments

@ghost
Copy link

ghost commented Oct 14, 2014

Build ChibiOS' ARMCM0-STM32L0 demo. Try flashing it using st-flash, and with gdb connected to st-util. You get two very different scenarios, with the latter resorting to all half-page writes and being very very slow (note the timestamps). st-flash takes 6 seconds and st-util takes 1.5 minutes.

Using st-flash to load ch.bin

$ ./st-flash ch.bin 0x8000000
2014-10-14T13:51:43 INFO src/stlink-common.c: Loading device parameters....
2014-10-14T13:51:43 INFO src/stlink-common.c: Device connected is: L0x3 device
...
2014-10-14T13:51:43 INFO src/stlink-common.c: Attempting to write 2200 (0x898) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000880 erased
2014-10-14T13:51:43 INFO src/stlink-common.c: Finished erasing 18 pages of 128 (0x80) bytes
2014-10-14T13:51:43 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:51:43 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:51:47 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:51:47 WARN src/stlink-common.c: l1_run_flash_loader(0x8000000) failed! == -1
2014-10-14T13:51:47 WARN src/stlink-common.c: 
write_half_pages failed == -1
 16/ 17 pages written
2014-10-14T13:51:49 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:51:49 INFO src/stlink-common.c: Flash written and verified! jolly good!

Using gdb to load ch.elf with st-util

$ ./st-util
2014-10-14T13:33:23 INFO src/stlink-common.c: Loading device parameters....
2014-10-14T13:33:23 INFO src/stlink-common.c: Device connected is: L0x3 device
...
2014-10-14T13:33:23 INFO gdbserver/gdb-server.c: Listening at *:4242...
2014-10-14T13:33:39 ERROR gdbserver/gdb-server.c: [FP_CTRL] = 0x00000041 expecting 0x00000261
2014-10-14T13:33:39 INFO gdbserver/gdb-server.c: GDB connected.
2014-10-14T13:33:45 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2014-10-14T13:33:45 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:33:45 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:33:45 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:33:49 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:33:49 WARN src/stlink-common.c: l1_run_flash_loader(0x8000000) failed! == -1
2014-10-14T13:33:49 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:33:49 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:33:49 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:33:49 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134217856 (0x8000080)
Flash page at addr: 0x08000080 erased
2014-10-14T13:33:49 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:33:49 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:33:49 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:33:52 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:33:52 WARN src/stlink-common.c: l1_run_flash_loader(0x8000080) failed! == -1
2014-10-14T13:33:52 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:33:52 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:33:52 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:33:52 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134217984 (0x8000100)
Flash page at addr: 0x08000100 erased
2014-10-14T13:33:52 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:33:52 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:33:52 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:33:55 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:33:55 WARN src/stlink-common.c: l1_run_flash_loader(0x8000100) failed! == -1
2014-10-14T13:33:55 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:33:55 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:33:55 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:33:55 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134218112 (0x8000180)
Flash page at addr: 0x08000180 erased
2014-10-14T13:33:55 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:33:55 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:33:55 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:33:58 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:33:58 WARN src/stlink-common.c: l1_run_flash_loader(0x8000180) failed! == -1
2014-10-14T13:33:58 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:33:58 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:33:58 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:33:58 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134218240 (0x8000200)
Flash page at addr: 0x08000200 erased
2014-10-14T13:33:58 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:33:58 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:33:58 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:01 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:01 WARN src/stlink-common.c: l1_run_flash_loader(0x8000200) failed! == -1
2014-10-14T13:34:01 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:01 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:01 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:01 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134218368 (0x8000280)
Flash page at addr: 0x08000280 erased
2014-10-14T13:34:01 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:01 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:01 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:04 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:04 WARN src/stlink-common.c: l1_run_flash_loader(0x8000280) failed! == -1
2014-10-14T13:34:04 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:04 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:04 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:04 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134218496 (0x8000300)
Flash page at addr: 0x08000300 erased
2014-10-14T13:34:04 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:04 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:04 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:07 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:07 WARN src/stlink-common.c: l1_run_flash_loader(0x8000300) failed! == -1
2014-10-14T13:34:07 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:07 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:07 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:07 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134218624 (0x8000380)
Flash page at addr: 0x08000380 erased
2014-10-14T13:34:07 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:07 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:07 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:10 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:10 WARN src/stlink-common.c: l1_run_flash_loader(0x8000380) failed! == -1
2014-10-14T13:34:10 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:11 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:11 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:11 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134218752 (0x8000400)
Flash page at addr: 0x08000400 erased
2014-10-14T13:34:11 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:11 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:11 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:14 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:14 WARN src/stlink-common.c: l1_run_flash_loader(0x8000400) failed! == -1
2014-10-14T13:34:14 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:14 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:14 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:14 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134218880 (0x8000480)
Flash page at addr: 0x08000480 erased
2014-10-14T13:34:14 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:14 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:14 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:17 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:17 WARN src/stlink-common.c: l1_run_flash_loader(0x8000480) failed! == -1
2014-10-14T13:34:17 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:17 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:17 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:17 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219008 (0x8000500)
Flash page at addr: 0x08000500 erased
2014-10-14T13:34:17 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:17 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:17 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:20 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:20 WARN src/stlink-common.c: l1_run_flash_loader(0x8000500) failed! == -1
2014-10-14T13:34:20 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:20 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:20 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:20 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219136 (0x8000580)
Flash page at addr: 0x08000580 erased
2014-10-14T13:34:20 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:20 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:20 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:23 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:23 WARN src/stlink-common.c: l1_run_flash_loader(0x8000580) failed! == -1
2014-10-14T13:34:23 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:23 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:23 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:23 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219264 (0x8000600)
Flash page at addr: 0x08000600 erased
2014-10-14T13:34:23 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:23 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:23 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:26 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:26 WARN src/stlink-common.c: l1_run_flash_loader(0x8000600) failed! == -1
2014-10-14T13:34:26 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:26 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:26 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:26 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219392 (0x8000680)
Flash page at addr: 0x08000680 erased
2014-10-14T13:34:26 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:26 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:26 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:29 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:29 WARN src/stlink-common.c: l1_run_flash_loader(0x8000680) failed! == -1
2014-10-14T13:34:29 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:29 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:29 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:29 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219520 (0x8000700)
Flash page at addr: 0x08000700 erased
2014-10-14T13:34:29 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:29 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:29 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:32 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:32 WARN src/stlink-common.c: l1_run_flash_loader(0x8000700) failed! == -1
2014-10-14T13:34:32 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:32 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:32 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:32 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219648 (0x8000780)
Flash page at addr: 0x08000780 erased
2014-10-14T13:34:33 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:33 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:33 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:35 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:35 WARN src/stlink-common.c: l1_run_flash_loader(0x8000780) failed! == -1
2014-10-14T13:34:35 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:36 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:36 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:36 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219776 (0x8000800)
Flash page at addr: 0x08000800 erased
2014-10-14T13:34:36 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:36 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:36 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:39 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:39 WARN src/stlink-common.c: l1_run_flash_loader(0x8000800) failed! == -1
2014-10-14T13:34:39 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:39 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:39 INFO src/stlink-common.c: Flash written and verified! jolly good!
2014-10-14T13:34:39 INFO src/stlink-common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134219904 (0x8000880)
Flash page at addr: 0x08000880 erased
2014-10-14T13:34:39 INFO src/stlink-common.c: Finished erasing 1 pages of 128 (0x80) bytes
2014-10-14T13:34:39 INFO src/stlink-common.c: Starting Half page flash write for STM32L core id
2014-10-14T13:34:39 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2014-10-14T13:34:42 ERROR src/stlink-common.c: flash loader run error
2014-10-14T13:34:42 WARN src/stlink-common.c: l1_run_flash_loader(0x8000880) failed! == -1
2014-10-14T13:34:42 WARN src/stlink-common.c: 
write_half_pages failed == -1
  0/  1 pages written
2014-10-14T13:34:42 INFO src/stlink-common.c: Starting verification of write complete
2014-10-14T13:34:42 INFO src/stlink-common.c: Flash written and verified! jolly good!
@xor-gate
Copy link
Member

xor-gate commented May 5, 2016

Please try with latest stlink tools in master, and with latest stlink firmware from ST (2.27).

@xor-gate
Copy link
Member

I'm closing this due to inactivity of the original issuer, feel free to open a new issue when the problem still exists. And is tested against the latest version v1.2.0 or master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants