Discussion:
[OpenOCD-devel] [PATCH]: b3bd164 flash Kinetis: Add support for newer KW series
gerrit
2017-04-12 09:02:02 UTC
Permalink
This is an automated email from Gerrit.

Joakim Nohlgård (***@eistec.se) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4104

-- gerrit

commit b3bd16480f8371bbd9055ad68f8d9c071a37c857
Author: Joakim Nohlgård <***@eistec.se>
Date: Tue Apr 11 09:55:41 2017 +0200

flash Kinetis: Add support for newer KW series

Add support for flashing newer members of the NXP Kinetis KW family

Supported devices:
- KW20Z
- KW30Z
- KW40Z
- KW21Z
- KW31Z
- KW41Z

The earlier KW2xD and KW01Z devices are already supported by the code
for the older K-series.

Verified working on the FRDM-KW41Z development board.
Tested flashing both via GDB `load` and directly via OpenOCD flash
write commands.

Change-Id: I73eae477127a8b54a33005b3b526b5439450a808
Signed-off-by: Joakim Nohlgård <***@eistec.se>

diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index 49a6e27..d01cec2 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -746,9 +746,10 @@ int kinetis_disable_wdog(struct target *target, uint32_t sim_sdid)
};

/* Decide whether the connected device needs watchdog disabling.
- * Disable for all Kx and KVx devices, return if it is a KLx */
+ * Disable for all Kx and KVx devices, return if it is a KLx or newer KWx */

- if ((sim_sdid & KINETIS_SDID_SERIESID_MASK) == KINETIS_SDID_SERIESID_KL)
+ if (((sim_sdid & KINETIS_SDID_SERIESID_MASK) == KINETIS_SDID_SERIESID_KL)
+ || ((sim_sdid & KINETIS_SDID_SERIESID_MASK) == KINETIS_SDID_SERIESID_KW))
return ERROR_OK;

/* The connected device requires watchdog disabling. */
@@ -1703,6 +1704,38 @@ static int kinetis_probe(struct flash_bank *bank)
kinfo->flash_support = FS_PROGRAM_LONGWORD | FS_INVALIDATE_CACHE_L;
break;

+ case KINETIS_SDID_SERIESID_KW:
+ /* Newer KW-series (all KW series except KW2xD, KW01Z) */
+ switch (kinfo->sim_sdid & (KINETIS_SDID_FAMILYID_MASK | KINETIS_SDID_SUBFAMID_MASK)) {
+ case KINETIS_SDID_FAMILYID_K4X | KINETIS_SDID_SUBFAMID_KX0:
+ /* KW40Z */
+ case KINETIS_SDID_FAMILYID_K3X | KINETIS_SDID_SUBFAMID_KX0:
+ /* KW30Z */
+ case KINETIS_SDID_FAMILYID_K2X | KINETIS_SDID_SUBFAMID_KX0:
+ /* KW20Z */
+ /* FTFA, 1kB sectors */
+ pflash_sector_size_bytes = 1<<10;
+ nvm_sector_size_bytes = 1<<10;
+ /* autodetect 1 or 2 blocks */
+ kinfo->flash_support = FS_PROGRAM_LONGWORD | FS_INVALIDATE_CACHE_L;
+ break;
+ case KINETIS_SDID_FAMILYID_K4X | KINETIS_SDID_SUBFAMID_KX1:
+ /* KW41Z */
+ case KINETIS_SDID_FAMILYID_K3X | KINETIS_SDID_SUBFAMID_KX1:
+ /* KW31Z */
+ case KINETIS_SDID_FAMILYID_K2X | KINETIS_SDID_SUBFAMID_KX1:
+ /* KW21Z */
+ /* FTFA, 2kB sectors */
+ pflash_sector_size_bytes = 2<<10;
+ nvm_sector_size_bytes = 2<<10;
+ /* autodetect 1 or 2 blocks */
+ kinfo->flash_support = FS_PROGRAM_LONGWORD | FS_INVALIDATE_CACHE_L;
+ break;
+ default:
+ LOG_ERROR("Unsupported KW FAMILYID SUBFAMID");
+ }
+ break;
+
case KINETIS_SDID_SERIESID_KV:
/* KV-series */
switch (kinfo->sim_sdid & (KINETIS_SDID_FAMILYID_MASK | KINETIS_SDID_SUBFAMID_MASK)) {

--

Loading...