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

Already on GitHub? Sign in to your account

Impossible to flash large file on stm32f4 #68

ardf69 opened this Issue Mar 9, 2012 · 3 comments


None yet
4 participants

ardf69 commented Mar 9, 2012

If I flash a file of 0x74000 size with the following command

st-flash write file.bin 0x08080000

I obtain the following error:

2012-03-09T15:48:20 INFO src/stlink-common.c: Loading device parameters....
2012-03-09T15:48:20 INFO src/stlink-common.c: Device connected is: F4 device, id 0x20006411
2012-03-09T15:48:20 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 16384 bytes
2012-03-09T15:48:20 INFO src/stlink-common.c: Ignoring 1 bytes of Zeros at end of file
2012-03-09T15:48:20 INFO src/stlink-common.c: Attempting to write 475135 (0x73fff) bytes to stm32 address: 134742016 (0x8080000)
2012-03-09T15:48:20 WARN src/stlink-common.c: unaligned addr or size
stlink_fwrite_flash() == -1

Ciao Angelo


karlp commented Jun 26, 2012

This should be closed, F4 flashing has been rewritten to use an sram based flash loader, so this should no longer be an issue.

rewolff commented Aug 6, 2013

@karlp : NOPE!
the problem is (I think) a different one.
At least.. I was intending to report a bug(and fix) I found, but it looks suspiciously like this one (mentioning the EXACT same byte address where my bug begins)....

Here is the patch:

--- a/gdbserver/gdb-server.c
+++ b/gdbserver/gdb-server.c
@@ -271,7 +271,7 @@ static const char* const memory_map_template_F4 =
   "  <memory type=\"flash\" start=\"0x08010000\" length=\"0x10000\">"          
   "    <property name=\"blocksize\">0x10000</property>"                        
   "  </memory>"
-  "  <memory type=\"flash\" start=\"0x08020000\" length=\"0x70000\">"          
+  "  <memory type=\"flash\" start=\"0x08020000\" length=\"0xE0000\">"          
   "    <property name=\"blocksize\">0x20000</property>"                        
   "  </memory>"
   "  <memory type=\"ram\" start=\"0x40000000\" length=\"0x1fffffff\"/>"        

As ardf69 seems to be using the "st-flash" program and this is located in the gdb-server code, it seems a similar bug exists in the st-flash code.

Update. F*** github. Can't put a patch in a comment.
On line 274 of gdb-server.c change 0x70000 to 0xe0000 .


karlp commented Aug 6, 2013

  1. try reading the "GitHub Flavoured Markdown" help box on the top right of the comment form, it would show you how to put your code inline, with highlighting, instead of using [code] from wordpress or something.
  2. actually, that's all, I don't use stlink at all anymore, so I'm not looking at this.

@xor-gate xor-gate closed this May 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment