Kinetis: properly pad flash section writes 94/2994/2
authorTomas Vanek <vanekt@fbl.cz>
Fri, 2 Oct 2015 12:31:30 +0000 (14:31 +0200)
committerFreddie Chopin <freddie.chopin@gmail.com>
Thu, 5 Nov 2015 22:14:46 +0000 (22:14 +0000)
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>
src/flash/nor/kinetis.c

index 484bc479375e884af0ef14fe74adef3e71c4d194..73ba586a0fc1d6c7be0aa927b3c694092d2c7f73 100644 (file)
@@ -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);

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)