Code Readout protection on MKE04Z8

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

Code Readout protection on MKE04Z8

跳至解决方案
1,845 次查看
Chrigolat
Contributor II

Dear all

 

I have an MKE04Z8 and use Keil to program it. The MKE04Z4_DFP Package have Version 14.0.0.

How can I turn on the code readout protection in the device?

 

Here is what I tried:

When I try to set the read out protection the MCU does not start anymore. I tried the following:

In "startup_MKE04K4.S" I altered the flash config from

/* Flash Configuration */
.section .FlashConfig, "a"
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFEFFFF

.text
.thumb

 

to

 

/* Flash Configuration */
.section .FlashConfig, "a"
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFDFFFF

.text
.thumb

 

Where's my mistake? 

Any help appreciated.

Kind regards

Christian

 

0 项奖励
回复
1 解答
1,239 次查看
Chrigolat
Contributor II

Ok, I found it...

I download the code with KEIL. When I activate the Reaout Protection, Keil cannot start the debug session. It's very peculiar, but Keil then erases the code without special notice. Having done so, the CPU does not have any code to start.

Probably there's some higher sense behind that behaviour. Since I usually work with Crosswoks, I did not expect that at all.

Hope that helps 

Chris

在原帖中查看解决方案

0 项奖励
回复
8 回复数
1,240 次查看
Chrigolat
Contributor II

Ok, I found it...

I download the code with KEIL. When I activate the Reaout Protection, Keil cannot start the debug session. It's very peculiar, but Keil then erases the code without special notice. Having done so, the CPU does not have any code to start.

Probably there's some higher sense behind that behaviour. Since I usually work with Crosswoks, I did not expect that at all.

Hope that helps 

Chris

0 项奖励
回复
1,737 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you change the flash configure from .long 0xFFFEFFFF to .long 0xFFFDFFFF, it means that only the FTMRE_FSEC register has chnanged, especially, SEC bits change from 10 in binary(unsecure mode) to 01 in binary(secure mode). After reset, the chip is in secure mode, the SWD port is blocked, you can not read code/data from SWD port.

But the secure or unsecure mode does NOT take effect on the chip running.

As a test, after you restore to unsecure mode after mass erasing and redownloading, can the KE04 run fine again?

 

xiangjun_rong_0-1724233868901.png

Hope it can help you
BR

XiangJun Rong

0 项奖励
回复
1,732 次查看
Chrigolat
Contributor II

Hi XiangJun Rong

Thank you for your answer. When I do this, the code does not start anymore.

Do you have a smple project, where it works?

Kind regards

Chris

0 项奖励
回复
1,714 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Pls download SDK from the website for FRDM-KE04 board, there is a lot of examples.

Hope it can help you

BR

XiangJun Rong

 

xiangjun_rong_0-1724292697467.png

 

0 项奖励
回复
1,696 次查看
Chrigolat
Contributor II

Hi XiangJun Rong

I followed you advice, but I could not find an example using the Read-Out protection. Could you point me to the one you're talking about?

Kind regards

Chris

0 项奖励
回复
1,670 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Case 1:

After you download the SDK package, pls try to load/run the example code without any change, the chip is in unsecurity mode.

xiangjun_rong_0-1724394057724.png

then run a uart terminal, and check if the terminal can echo the input character.

Then you can power off and connect for example  J-Link device and tools, and check if you can read code or data with J-link via SWD port

 

case2:

You can change the security to

__attribute__ ((used,section(".FlashConfig"))) const struct {

unsigned int word1;

unsigned int word2;

unsigned int word3;

unsigned int word4;

} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFDFFFF};

 

then run a uart terminal, and check if the terminal can echo the input character.

Then you can power off and connect for example  J-Link device and tools, and check if you can read code or data with J-link via SWD port. In the case, because the SWD is blocked, the J-Link device can not be read.

 

Hope it can help you

BR

Xiangjun Rong

0 项奖励
回复
1,763 次查看
Chrigolat
Contributor II

Dear XuZhang

Thank you for working on the question. 

As to my understanding, this is something every Product in the market needs to have. I tried different flags but I was not successful. Maybe you could ask the designer of the startup file.

Just to add.. It worked in previous versions of the library.

Kind regards

Chris

0 项奖励
回复
1,814 次查看
Joey_z
NXP Employee
NXP Employee

hi,Chrigolat

Sorry for replying to your email so late. I have received your question and will deal with it as soon as possible.

BR

Xu Zhang

0 项奖励
回复