flash Kinetis: fix devices with smallest program flash (8 and 16 kB) 73/4173/2
authorTomas Vanek <vanekt@fbl.cz>
Thu, 29 Jun 2017 21:06:55 +0000 (23:06 +0200)
committerPaul Fertser <fercerpav@gmail.com>
Mon, 24 Jul 2017 12:09:37 +0000 (13:09 +0100)
Change-Id: I2692b9877a7f877104528f279a69e8cc1cfbcdbf
Reported-by: David Miller Lowe <milhead@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4173
Tested-by: jenkins
Reviewed-by: Miller Lowe <miller.lowe@trailtech.net>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
src/flash/nor/kinetis.c

index 12efefbd9fa79f2cd56cc5dc32eab8631453bebb..f57579dda3efe72a201c30e9ee31eb45b343c59c 100644 (file)
@@ -2461,6 +2461,10 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
        }
 
        switch (fcfg1_pfsize) {
+       case 0x00:
+               k_chip->pflash_size = 8192;
+               break;
+       case 0x01:
        case 0x03:
        case 0x05:
        case 0x07:
@@ -2471,6 +2475,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
                break;
        case 0x0f:
                /* a peculiar case: Freescale states different sizes for 0xf
+                * KL03P24M48SF0RM      32 KB .... duplicate of code 0x3
                 * K02P64M100SFARM      128 KB ... duplicate of code 0x7
                 * K22P121M120SF8RM     256 KB ... duplicate of code 0x9
                 * K22P121M120SF7RM     512 KB ... duplicate of code 0xb
@@ -2562,7 +2567,7 @@ static int kinetis_probe(struct flash_bank *bank)
                 * parts with more than 32K of PFlash. For parts with
                 * less the protection unit is set to 1024 bytes */
                k_bank->protection_size = MAX(k_chip->pflash_size / 32, 1024);
-               bank->num_prot_blocks = 32 / k_chip->num_pflash_blocks;
+               bank->num_prot_blocks = bank->size / k_bank->protection_size;
                k_bank->protection_block = bank->num_prot_blocks * k_bank->bank_number;
 
                size_k = bank->size / 1024;

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)