|
From: openocd-gerrit <ope...@us...> - 2026-10-13 13:09:23
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 2075427d1585dc1bc17f75a51df91a1b20b4ad4b (commit)
from 60343e5cf960c68731353c5ad47307d3341aa313 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2075427d1585dc1bc17f75a51df91a1b20b4ad4b
Author: Jasper v. Blanckenburg <ja...@me...>
Date: Mon Sep 28 17:59:16 2026 +0200
flash/nor/kinetis: support nvm_partition on S32K1
The Program Partition command of the S32K1xx FTFC takes the same FCCOB
layout for FlexRAM load option, EEPROM size and DEPART as on Kinetis,
with two differences:
- There is no EEPROM split: FCCOB4[7:4] must be 0, otherwise the
command fails with ACCERR.
- DEPART is in SIM_FCFG1[15:12], so 'nvm_partition info' has to use
kinetis_fcfg1_depart().
Move the NULL check of k_chip to the start of the handler, as k_chip is
now dereferenced for the chip type check before any other use.
Tested on S32K118 after 'kinetis mdm mass_erase' and reset:
- eebkp 32 2048: FCFG1 DEPART 0x3, FlexRAM loaded as EEPROM after reset
(FCNFG[EEERDY]) and EEPROM contents survive a reset
- eebkp 32 1024 1024 off: FlexRAM not loaded (FCNFG[RAMRDY])
- dataflash 8 2048, dataflash 32: DEPART 0x9 / 0xb, 'info' reports
data flash 8 KB / 32 KB
- repartitioning without mass erase, eebkp 32 512 1536, dataflash 32
2048 and eebkp 32 (without EEPROM) are rejected
Checkpatch-ignore: BAD_SIGN_OFF
Change-Id: Iea6dbc930cfb2d57a18aa64b802cc019af3af333
Co-authored-by: Claude Opus 5.5 <no...@an...>
Signed-off-by: Jasper v. Blanckenburg <ja...@me...>
Reviewed-on: https://review.openocd.org/c/openocd/+/10078
Tested-by: jenkins
Reviewed-by: Tomas Vanek <tom...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index c5c353572..21af250f9 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -7574,8 +7574,7 @@ command completes.
@end deffn
@deffn {Command} {kinetis nvm_partition}
-For FlexNVM devices only (KxxDX and KxxFX).
-Not supported (yet) on S32K1 devices.
+For FlexNVM devices only (KxxDX, KxxFX and S32K1xx).
Command shows or sets data flash or EEPROM backup size in kilobytes,
sets two EEPROM blocks sizes in bytes and enables/disables loading
of EEPROM contents to FlexRAM during reset.
@@ -7602,6 +7601,14 @@ of 1024 bytes and its contents is not loaded to FlexRAM during reset:
@example
kinetis nvm_partition eebkp 16 1024 1024 off
@end example
+
+S32K1xx devices have a single EEPROM block, so specify the total EEPROM size
+only. Use @command{kinetis mdm mass_erase} to clear an existing partition. Set
+32 KB EEPROM backup (no data flash) with 2 KB EEPROM, loaded to FlexRAM during
+reset:
+@example
+kinetis nvm_partition eebkp 32 2048
+@end example
@end deffn
@deffn {Command} {kinetis mdm reset}
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index 6f3dad5d2..c18f16646 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -3186,9 +3186,8 @@ COMMAND_HANDLER(kinetis_nvm_partition)
uint32_t sim_fcfg1;
k_chip = kinetis_get_chip(target);
-
- if (k_chip->chip_type == KINETIS_CT_S32K) {
- LOG_ERROR("NVM partition not supported on S32K1xx (yet).");
+ if (!k_chip) {
+ command_print(CMD, "[%s] is not a Kinetis chip", target_name(target));
return ERROR_FAIL;
}
@@ -3204,10 +3203,6 @@ COMMAND_HANDLER(kinetis_nvm_partition)
}
switch (sz_type) {
case SHOW_INFO:
- if (!k_chip) {
- LOG_ERROR("Chip not probed.");
- return ERROR_FAIL;
- }
result = target_read_u32(target, k_chip->sim_base + SIM_FCFG1_OFFSET, &sim_fcfg1);
if (result != ERROR_OK)
return result;
@@ -3273,6 +3268,11 @@ COMMAND_HANDLER(kinetis_nvm_partition)
}
}
+ if (k_chip->chip_type == KINETIS_CT_S32K && ee1 != ee2) {
+ LOG_ERROR("S32K1xx EEPROM cannot be split into two blocks");
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+
if (ee1 * 3 == ee2)
ee_split = 1;
else if (ee1 * 7 == ee2)
@@ -3290,6 +3290,10 @@ COMMAND_HANDLER(kinetis_nvm_partition)
if (enable)
load_flex_ram = 0;
+ /* S32K1xx has no EEPROM split and rejects the command if split bits are set */
+ if (k_chip->chip_type == KINETIS_CT_S32K)
+ ee_size_code &= 0x0f;
+
LOG_INFO("DEPART 0x%" PRIx8 ", EEPROM size code 0x%" PRIx8,
flex_nvm_partition_code, ee_size_code);
@@ -3310,13 +3314,11 @@ COMMAND_HANDLER(kinetis_nvm_partition)
command_print(CMD, "FlexNVM partition set. Please reset MCU.");
- if (k_chip) {
- first_nvm_bank = k_chip->num_pflash_blocks;
- num_blocks = k_chip->num_pflash_blocks + k_chip->num_nvm_blocks;
- for (bank_idx = first_nvm_bank; bank_idx < num_blocks; bank_idx++)
- k_chip->banks[bank_idx].probed = false; /* re-probe before next use */
- k_chip->probed = false;
- }
+ first_nvm_bank = k_chip->num_pflash_blocks;
+ num_blocks = k_chip->num_pflash_blocks + k_chip->num_nvm_blocks;
+ for (bank_idx = first_nvm_bank; bank_idx < num_blocks; bank_idx++)
+ k_chip->banks[bank_idx].probed = false; /* re-probe before next use */
+ k_chip->probed = false;
command_print(CMD, "FlexNVM banks will be re-probed to set new data flash size.");
return ERROR_OK;
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 11 +++++++++--
src/flash/nor/kinetis.c | 30 ++++++++++++++++--------------
2 files changed, 25 insertions(+), 16 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|