diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2017-06-29 23:06:55 +0200 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2017-07-24 13:09:37 +0100 |
commit | dbd0d90af9ba12934eabd68d82aac9d7eb7e1e6a (patch) | |
tree | 5fd46ef075bb784d8af7c3eef794b8e7a04961ad /src/flash/nor/kinetis.c | |
parent | 29cfe9c5eede2cd2fb3a62f44bdaf4f58377b027 (diff) | |
download | riscv-openocd-dbd0d90af9ba12934eabd68d82aac9d7eb7e1e6a.zip riscv-openocd-dbd0d90af9ba12934eabd68d82aac9d7eb7e1e6a.tar.gz riscv-openocd-dbd0d90af9ba12934eabd68d82aac9d7eb7e1e6a.tar.bz2 |
flash Kinetis: fix devices with smallest program flash (8 and 16 kB)
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>
Diffstat (limited to 'src/flash/nor/kinetis.c')
-rw-r--r-- | src/flash/nor/kinetis.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c index 12efefb..f57579d 100644 --- a/src/flash/nor/kinetis.c +++ b/src/flash/nor/kinetis.c @@ -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; |