Discussion:
[OpenOCD-devel] [PATCH]: 64adac4 flash Kinetis: fix probe for FlexNVM partitioned as EEPROM backup
gerrit
2017-07-13 20:16:45 UTC
Permalink
This is an automated email from Gerrit.

Tomas Vanek (***@fbl.cz) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4180

-- gerrit

commit 64adac4bf1dbf9351a43c1700fca34fdfd854b68
Author: Tomas Vanek <***@fbl.cz>
Date: Thu Jul 13 21:35:22 2017 +0200

flash Kinetis: fix probe for FlexNVM partitioned as EEPROM backup

If a MCU has FlexNVM partitioned as EEPROM backup only
(no data flash), kinetis_probe_chip() detects zero fcfg2_maxaddr1
and adjusts flash banks count to 1, what is obviously wrong.
The change limits the test to devices without FlexNVM.

Also missing case 0x07 is added to switch (fcfg1_depart)

Change-Id: I0bd6030a0fe1ab62aeb0223bbdf2aee1505bf6a0
Reported-by: ***@scalardata.com
Signed-off-by: Tomas Vanek <***@fbl.cz>

diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index f57579d..fc17543 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -2387,7 +2387,9 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)

if (num_blocks == 0)
num_blocks = k_chip->fcfg2_maxaddr1_shifted ? 2 : 1;
- else if (k_chip->fcfg2_maxaddr1_shifted == 0 && num_blocks >= 2) {
+ else if (k_chip->fcfg2_maxaddr1_shifted == 0 && num_blocks >= 2 && fcfg2_pflsh) {
+ /* fcfg2_maxaddr1 may be zero due to partitioning whole NVM as EEPROM backup
+ * Do not adjust block count in this case! */
num_blocks = 1;
LOG_WARNING("MAXADDR1 is zero, number of flash banks adjusted to 1");
} else if (k_chip->fcfg2_maxaddr1_shifted != 0 && num_blocks == 1) {
@@ -2444,6 +2446,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
case 0x06:
k_chip->dflash_size = k_chip->nvm_size - (4096 << fcfg1_depart);
break;
+ case 0x07:
case 0x08:
k_chip->dflash_size = 0;
break;

--

Loading...