You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--- src/stlink-common.c.orig 2015-08-08 14:44:09.630414490 +0300
+++ src/stlink-common.c 2015-08-08 15:35:47.158845463 +0300
@@ -971,16 +971,23 @@
} else if ((addr + mf.len) > (sl->sram_base + sl->sram_size)) {
fprintf(stderr, "addr too high\n");
goto on_error;
- } else if ((addr & 3) || (mf.len & 3)) {
+ } else if (addr & 3) {
/* todo */
- fprintf(stderr, "unaligned addr or size\n");
+ fprintf(stderr, "unaligned addr\n");
goto on_error;
}
+
+ int len = mf.len;
+
+ if((len % 4) > 0) {
+ len -= len % 4;
+ }
+
/* do the copy by 1k blocks */
- for (off = 0; off < mf.len; off += 1024) {
+ for (off = 0; off < len; off += 1024) {
size_t size = 1024;
- if ((off + size) > mf.len)
- size = mf.len - off;
+ if ((off + size) > len)
+ size = len - off;
memcpy(sl->q_buf, mf.base + off, size);
@@ -991,6 +998,11 @@
stlink_write_mem32(sl, addr + off, size);
}
+ if(mf.len > len) {
+ memcpy(sl->q_buf, mf.base + len, mf.len - len);
+ stlink_write_mem8(sl, addr + len, mf.len - len);
+ }
+
/* check the file ha been written */
if (check_file(sl, &mf, addr) == -1) {
fprintf(stderr, "check_file() == -1\n");
The text was updated successfully, but these errors were encountered:
a-sv
changed the title
FIX: "unaligned addr or size" in attempt of write the program in the RAM
FIX: "unaligned addr or size" when trying to write a program in RAM
Aug 8, 2015
The text was updated successfully, but these errors were encountered: