Hi @Kris_chao
to destroy the partition (to reset the device back to factory state), it is necessary to run CMD_DBG_CHAL and CMD_DBG_AUTH commands with knowledge of MASTER_ECU_KEY.
If you use software from AN5401, you can run 5_Resetting_flash_to_the_factory_state project. If you modified default MASTER_ECU_KEY, you need to update the key in DBG_AUTH function in CSEc_functions.c file.
If you use SDK code, you can run this project:
c:\NXP\S32DS.3.4\S32DS\software\S32SDK_S32K1XX_RTM_4.0.3\examples\S32K146\driver_examples\system\csec_keyconfig\
Just change this definition from:
#define ERASE_ALL_KEYS 0
to
#define ERASE_ALL_KEYS 1
And again, if you changed the MASTER_ECU_KEY, make sure it is updated in file csec_utils.c accordingly (g_authIdKey).
And if you want to update BOOT_MAC without destroying the partition, it is possible to - you can update it using standard key update protocol. It's described in section "4.4.4.2 Scenario 2: One or more keys is write protected and all user
keys cannot be erased. (or not all user keys are known)" in AN5401.
Regards,
Lukas
Hi @Kris_chao
to destroy the partition (to reset the device back to factory state), it is necessary to run CMD_DBG_CHAL and CMD_DBG_AUTH commands with knowledge of MASTER_ECU_KEY.
If you use software from AN5401, you can run 5_Resetting_flash_to_the_factory_state project. If you modified default MASTER_ECU_KEY, you need to update the key in DBG_AUTH function in CSEc_functions.c file.
If you use SDK code, you can run this project:
c:\NXP\S32DS.3.4\S32DS\software\S32SDK_S32K1XX_RTM_4.0.3\examples\S32K146\driver_examples\system\csec_keyconfig\
Just change this definition from:
#define ERASE_ALL_KEYS 0
to
#define ERASE_ALL_KEYS 1
And again, if you changed the MASTER_ECU_KEY, make sure it is updated in file csec_utils.c accordingly (g_authIdKey).
And if you want to update BOOT_MAC without destroying the partition, it is possible to - you can update it using standard key update protocol. It's described in section "4.4.4.2 Scenario 2: One or more keys is write protected and all user
keys cannot be erased. (or not all user keys are known)" in AN5401.
Regards,
Lukas