How to avoid illegal data reading

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to avoid illegal data reading

1,290 Views
814420552
Contributor III

hello,

   Program flash and EEPROM are not read-protected. So how do you prevent others from reading the code? I see that STM32 allows users to set read protection, so that the data read is AAAAAAAA, but it does not affect the operation of the program. In your reference manual, I did not see an introduction to read protection. How does S32k146 do read protection?

0 Kudos
7 Replies

1,142 Views
814420552
Contributor III

hello, now my device S32K146 state as the first picture , D1 LED is light always.

Debug status as the second and third pictures, press "Yes" in the second picture it will jump to the third picture,  then press " retry"  in the third picture, it will jump to the second picture.

how can i resolve this problem?

pastedImage_1.jpg

pastedImage_2.png

pastedImage_3.png

0 Kudos

1,142 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello 814420552@qq.com,

Is the MCU partitioned with CSEc keys allocated?

https://www.nxp.com/docs/en/application-note/AN12130.pdf 

pastedImage_3.png

BR, Daniel

0 Kudos

1,142 Views
814420552
Contributor III

Hello,

   I remember that execute the following code

pastedImage_1.png

     this is my test code, after this operation, The device  security.

     pastedImage_2.png

from the manual i found configuration is erased after execute erase all block command , so all the following data is changed to 0xFF, when reset the device is secured,  MEEN = 11b, KEYEN = 11b,SEC = 11b.

current device is secured so this command executed succcessfully. so it is no need to consider whether to enable CSEc.

pastedImage_3.png

pastedImage_4.png

    

when switch to KEIL 5, run debug  tips the following 

pastedImage_5.png

then  press “确定”

pastedImage_6.png

    I don't  know why, wish your help

0 Kudos

1,142 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello 814420552@qq.com,

Please refer to the reference manual.

pastedImage_2.png

It has been already discussed, for example, here:

Flash protection S32k144 

You can use the Backdoor key feature to remove the protection without erasing the MCU:

Example S32K144 Verify Backdoor Access Key S32DS1.3 

Regards,

Daniel

0 Kudos

1,142 Views
814420552
Contributor III

<1>  is  the backdoor key defined by NXP when the device produced?

<2>  does the backdoor key can be updated by user?

you said:You can use the Backdoor key feature to remove the protection without erasing the MCU:

my question is the follow

<3> can i  call the API backdoor_key_verify(Key)   remove the protection?   

<4> if i want to remove partition and not erase MCU,  the  steps  are 

         I.  call API backdoor_key_verify(Key).

         II. call erase all block command

         are  the steps right?  if  not can you tell me the right step?

pastedImage_1.png

0 Kudos

1,142 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello 814420552@qq.com,

I believe that it is explained in the example.

The backdoor key is defined by the user in the startup_S32K144.S file.

pastedImage_2.png

At 0x400 in the S32K1xx_flash.ld linker file. 

pastedImage_3.png

pastedImage_4.png

The Backdoor Key Verify FTFC command (0x45) can be used only if the flash configuration field has the key defined.

The command unlocks the MCU so that the debugger can access the memory/registers of the MCU.

If the key is not defined and the MCU is locked, the debugger can only mass erase the MCU. 

Regards,

Daniel

0 Kudos

1,142 Views
814420552
Contributor III

hi  Daniel,

  how can I know the backdoor key?and if my device S32K148 demo board executed erase all block command the

device will be secured, openSDA can't connect with Device  and D1 led keep light, then how can i resove this problem?

if execute backdoor command, but I don't konw the backdoor key.  onthe other hand if i know the backdoor key how can i execute this backdoor command in the deviec?(Debug can't connect)

wish your henlp, thanks very much!

0 Kudos