Code Readout protection on MKE04Z8

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Code Readout protection on MKE04Z8

ソリューションへジャンプ
1,846件の閲覧回数
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,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 件の賞賛
返信
8 返答(返信)
1,241件の閲覧回数
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,738件の閲覧回数
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,733件の閲覧回数
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,715件の閲覧回数
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,697件の閲覧回数
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,671件の閲覧回数
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,764件の閲覧回数
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,815件の閲覧回数
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 件の賞賛
返信