From 1896ea7336cb2db3a59be031cf15d5d6e1db5f40 Mon Sep 17 00:00:00 2001 From: texane Date: Fri, 14 Jan 2011 10:49:59 -0600 Subject: [PATCH] [fix] unknown bug, must use 0x40 instead of pgsize when writing flash --- src/stlink-access-test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/stlink-access-test.c b/src/stlink-access-test.c index e40bac8..1fa6e5f 100644 --- a/src/stlink-access-test.c +++ b/src/stlink-access-test.c @@ -1551,12 +1551,13 @@ static int stlink_fwrite_flash goto on_error; } - /* write each page */ - for (off = 0; off < mf.len; off += sl->flash_pgsz) + /* write each page. above WRITE_BLOCK_SIZE fails? */ +#define WRITE_BLOCK_SIZE 0x40 + for (off = 0; off < mf.len; off += WRITE_BLOCK_SIZE) { - /* adjust last page size */ - size_t size = sl->flash_pgsz; - if ((off + sl->flash_pgsz) > mf.len) + /* adjust last write size */ + size_t size = WRITE_BLOCK_SIZE; + if ((off + WRITE_BLOCK_SIZE) > mf.len) size = mf.len - off; if (run_flash_loader(sl, &fl, addr + off, mf.base + off, size) == -1) -- 2.30.2