Difficulty in understanding how to implement secure boot and bootloader

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Difficulty in understanding how to implement secure boot and bootloader

跳至解决方案
2,926 次查看
baseerahmadpiracha
Contributor III

I want to implement bootloader with secure boot to check bootloader for integrity and authenticity on S32K146. After reading AN4501.pdf I found that there are 5 steps in Programming the CSEc Security Module with 5 examples as well.

List of Examples:
1. Configure part and Load keys
2. Update user keys
3. Basic operations
4. Secure boot add BOOT MAC manual
5. Resetting flash to the factory state

So my question is for implementing above what steps I have to perform and how? My aim is to only implement bootloader and check bootloader for integrity and authenticity.

标记 (1)
0 项奖励
回复
1 解答
2,872 次查看
baseerahmadpiracha
Contributor III

@lukaszadrapa @Keane I was able to resolve the issue by connecting the RESET pin of microcontroller with ground and when I clicked on connect Jlink showed that microcontroller is resetting. And after removing the reset pin from ground microcontroller started working fine. Thanks for the time

在原帖中查看解决方案

0 项奖励
回复
5 回复数
2,913 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @baseerahmadpiracha 

to enable the secure boot, it's necessary to enable the CSEc by executing Program Partition command and then it is necessary to load MASTER_ECU_KEY. These operations can be found in 1_Configure_part_and_Load_keys project.

Then you can skip directly to the 4_secure_boot_add_BOOT_MAC_manual which shows how to load BOOT_MAC_KEY, how to enable the secure boot and how to load BOOT_MAC (either automatically or manually). Notice that only manual option is possible in case of strict sequential secure boot mode.

 

If sequential or parallel boot mode fail, it does not affect the booting and application at all. The only effect is that boot protected keys cannot be used by the application. In this case BOK bit in FCSESTAT register will be '0' after boot.

The device will not start up only if strict sequential boot mode fails. In this case, the device will never leave reset and there’s no way to recover. The device must be replaced.

I recommend to thoroughly read AN5401 before your tests to avoid bricking of the device.

Regards,

Lukas

0 项奖励
回复
2,892 次查看
baseerahmadpiracha
Contributor III

Hi @lukaszadrapa 

I have tried to execute 1_Configure_part_and_Load_keys project on S32K144 and after programming when I tried to program again I am facing this error can you please guide what can be the possible reason?

 

baseerahmadpiracha_0-1677829940606.png

 

0 项奖励
回复
2,875 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

There's one problem with J-Link - when you load new project to the device by J-Link, it tries to perform mass erase. However, the mass erase is not allowed if CSEc is enabled. The CSEc needs to be disabled by CMD_DBG_CHAL and CMD_DBG_AUTH command (you need to know MASTER_ECU_KEY for this) and after that the mass erase is possible.

If Multilink or OpenSDA interface from Pemicro is used, then the flash is erased block by block, mass erase is not used, so it is possible to load new project to the flash even if CSEc is enabled.

As far as I know, Segger didn't change it until now. You can try to contact them if needed.

Regards,

Lukas

0 项奖励
回复
2,873 次查看
baseerahmadpiracha
Contributor III

@lukaszadrapa @Keane I was able to resolve the issue by connecting the RESET pin of microcontroller with ground and when I clicked on connect Jlink showed that microcontroller is resetting. And after removing the reset pin from ground microcontroller started working fine. Thanks for the time

0 项奖励
回复
2,886 次查看
Keane
Contributor I
It's probably because you erased FlexNVM(0x1000 0000~)
0 项奖励
回复