I am using Kinetis k64 and configuring it's internal flash memory to be secured.
In NXP's memory security application notes AN4507.pdf its written that "This means that firmware residing in the flash that enables security can still modify the flash because read, erase, and program operations to the flash itself are not changed"
However, in the SDK 2.7 flash operations example the erase and program methods are called only of the memory is not secured
if (kFTFx_SecurityStateNotSecure == securityStatus)
When removing this restriction the operations seems to works OK
What is the reason for this restriction?
This means when flash is secured, your firmware, your code running in the chip can still read flash erase program, internal.Not programmer .If you want to operate flash, you need a mass erase first,or if you enable backdoor key ,you can use a backdoor key to make flash unsecure.Or if you disable mass erase .Your debugger is disable,you can not launch a mass erase,but if you make a function that can get the command to change the 0x40C via a uart or a spi ,and so. That is possible to unsecure the flash.