diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2015-10-02 14:31:30 +0200 |
---|---|---|
committer | Freddie Chopin <freddie.chopin@gmail.com> | 2015-11-05 22:14:46 +0000 |
commit | a780e412cc9daf7b46c107e190710f0b6c1ac1ad (patch) | |
tree | c85dc9c3e61895352eaafdcde7d2d9d061b1b784 | |
parent | 5355ec627f9791dc82e8d6e7135ec77756731ab0 (diff) | |
download | riscv-openocd-a780e412cc9daf7b46c107e190710f0b6c1ac1ad.zip riscv-openocd-a780e412cc9daf7b46c107e190710f0b6c1ac1ad.tar.gz riscv-openocd-a780e412cc9daf7b46c107e190710f0b6c1ac1ad.tar.bz2 |
Kinetis: properly pad flash section writes
kinetis_write() with byte count not divisible by prog_section_chunk_bytes
computed wrong wc and therefore paded section chunk by some
random data instead of 0xff
Change-Id: Ic7c66d8a3ceacda9e611e98b9fbf943b8001774b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2994
Tested-by: jenkins
Reviewed-by: Thomas Schmid <thomas@rfranging.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
-rw-r--r-- | src/flash/nor/kinetis.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c index 484bc47..73ba586 100644 --- a/src/flash/nor/kinetis.c +++ b/src/flash/nor/kinetis.c @@ -1054,7 +1054,7 @@ static int kinetis_write(struct flash_bank *bank, const uint8_t *buffer, unsigned residual_bc = (count-i) % prog_section_chunk_bytes; /* number of complete words to copy directly from buffer */ - wc = (count - i) / 4; + wc = (count - i - residual_bc) / 4; /* number of total sections to write, including residual */ section_count = DIV_ROUND_UP((count-i), prog_section_chunk_bytes); |