S9KEAZ128 Code securing

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

S9KEAZ128 Code securing

1,097 Views
walfridodalmazz
Contributor II
Hi, I need to protect the code of a S9KEAZ128, I read both the user manual and various application
notes but did not find the solution.
To program it I use a PEmicro Multilink Universal and the PROGACMP program, I need a
step-by-step guide to do this.

It's the first time I use this microprocessor to design.
Thanks to those who will help me.
7 Replies

908 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Walfrido Damazzo,

   Do you want to secure the SWD debug port, then the other people can't read your clock through the SWD interface, or you want to do the flash protection.

  Please note, flash protection is protect regions in the flash memory from accidental programing or erasing.

  Please confirm the question at first.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

908 Views
walfridodalmazz
Contributor II

Thanks a lot Kerry for your answer, I use the  "S32 Design Studio" as IDE and I think that to modify the FSEC register I have to edit the file "SKEAZ1284.h" by changing the value of "#define FTMRE_FSEC_SEC_MASK" from 0x3u to 0x0u.
It's right ?

"==============================================="
#define FTMRE_FSEC_SEC_MASK         0x3u
#define FTMRE_FSEC_SEC_SHIFT         0
#define FTMRE_FSEC_SEC_WIDTH        2
#define FTMRE_FSEC_SEC(x)                 ((uint8_t)(((uint8_t)(x))<<FTMRE_FSEC_SEC_SHIFT))&FTMRE_FSEC_SEC_MASK)
#define FTMRE_FSEC_KEYEN_MASK     0xC0u
#define FTMRE_FSEC_KEYEN_SHIFT    6
#define FTMRE_FSEC_KEYEN_WIDTH    2
#define FTMRE_FSEC_KEYEN(x)            (((uint8_t)(((uint8_t)(x))<<FTMRE_FSEC_KEYEN_SHIFT))&FTMRE_FSEC_KEYEN_MASK)
"==============================================="


Thank you again.

0 Kudos

908 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Walfrido Dalmazzo,

   No, totally wrong.

   If you are using S32DS, in my memory, you can modify the .s file, please check your project, find out the .s file, then modify the FSEC or the according flash address 0X40E.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

908 Views
walfridodalmazz
Contributor II

Hi Kerry,
I modified the startup_SKEAZ1284.s file as you suggested, changing the value from 0xFE to 0xFC of the FEC register its  no longer possible to debug the program but only delete the entire flash memory.

Many thanks again, you've been really helpful to me.


Walfrido.

0 Kudos

908 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Walfrido,

 You are welcome. 

That's good to hear you can realize the secure function.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

908 Views
vigneshbalaji
Senior Contributor I

Hi Kerry,

               I want to know both about SWD secure and Flash protection. Please explain me how to do both?

0 Kudos

908 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi VIGNESH BALAJI,

Please check this figure at first.

pastedImage_1.png

1. MCU Secure

Flash address: 0X40E

The data meaning

pastedImage_2.png

So, if you just want to secure the board, you can set flash address 0X40E address data as: 0XFF

Code location:

pastedImage_3.png

I don't know what the IDE and code you are using, please tell me, then I will tell you the details.

2. Flash protection

Flash address 0x40d, the data is determined by reference manual chapter 18.3.6 Protection,

Please read it carefully, you will know how to set the flash protection data.

About the code modification, the same as FSEC, should modify in vector.h or .s, it is determined by your code.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos