Flash Memory Protection/Violation

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

Flash Memory Protection/Violation

2,216 Views
thanhtruong
Contributor III

How are protected memory configured in KDS?  I am trying to update my bootloader and I notice that I am unable to write to internal flash memory from 0x00000000 to 0x00004000.  I look at the linker file and .map file to see where this is configure with no luck.  

Can someone please point me to the right direction?

Much Appreciated,

Thanh

6 Replies

1,170 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Thanh,

About the Flash protection code on KDS, there is a DOC I attached it ,please check

the part of "3.3.6. Flash Protection" .

And it is download from Kinetis Bootloader to Update Multiple Devices in a Network for Cortex-M4  ,

you can find the code this DOC mentioned from this URL.

Hope it helps


Have a great day,
TIC

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

1,170 Views
thanhtruong
Contributor III

Thanks, Alice, following the documentation that you provided I am able to figure out how memory is protected on my M0+.  Its different than the M0+ you worked with, but similar enough that I know where to look in the processor documentation.  Unfortunately, as it is documented for my processor, the memory protection area can only be expanded, not remove (or reduce).  The documentation also mention that you can use an 8 bytes backdoor key to remove the lock, however, Processor Expert configuration for the flash memory API currently does not allow me to select the implementation of this method. 

It's a little confusing since this key is configured in the CPU part of the configuration, while the implementation/use of this key is configured in the "flash memory" component of Processor Expert.  I tried making several changes in hope that Processor Expert would allow me to enable the creation of the flash memory "SetKeys" method with no luck.

Outside of reading all the documentation and figuring out how to write the 8 bytes key myself, would you happen to know what is needed for Processor Expert to enable the "SetKeys" method for the "flash memory" component?

Thanh

0 Kudos

1,170 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Thanh,

About the Processor Expert project on KDS, you can enable and configure the backdoor in the "Security setting" field :

pastedImage_1.png

Hope it helps


Have a great day,
TIC

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

0 Kudos

1,170 Views
thanhtruong
Contributor III

Hey Alice, I am aware of where to set the backdoor key, it the how to the make use of it that I am unable to find out.  It looks like the PE Internal Flash component is where you'll make use of the key.  However, as you can see below, it is grayed out so I can't tell PE to implement this method.

pastedImage_1.png

For this method to be enabled, is there a other requirements that I am unaware of? 

Thanh

0 Kudos

1,170 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Thanh,

I think maybe this Method "SetKeys" is not support for your chip.

After configure the backdoor in the cpu component,  you need do nothing,  the generated code

will be on Cpu.c file , and when download project, the flash configuration field code will be flashed into

.cfmconfig section, please check below picture:

pastedImage_1.png

And from the linker file you can see, the .cfmconfig section placed on 0x400-0x40F.

pastedImage_2.png

Check reference manual :

pastedImage_3.png

Hope it helps


Have a great day,
TIC

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

0 Kudos

1,170 Views
thanhtruong
Contributor III

Thanks for your help Alice.  Unfortunately, it looks like this problem is actually not solvable remotely.  I am confusing memory Protection with Memory Security.  Memory security could be overridden with a backdoor key, however, memory protection could only be expanded, not reduce.  

Memory Protection is used to protect memory from accidental write while Memory Security is used for protection of IP on flash memory.  Our attempt at protecting the bootloader from accidental write practically made it un-updatable remotely.  

All new unit will have their memory protection for the bootloader partition removed, but our existing unit will continue to have a locked bootloader. 

Memory Protection configuration on Processor Expert can be found at:

Processor: CPU: Common settings: Flash configuration field: Protection regions.

0 Kudos