Hi,
I have a K22F device which contains :
loader application at offset 0x00
primary application at offset x
secondary application at offset y
Default startup file provided by mcuxpresso contains Flash configuration block of four words which is placed at relative offset of 0x400 and contains Backdoor key/Program protection adn Fsec settings.
I wan to secure the device according to the following settings:
- Backdoor Key disabled
- Mass Erase disabled
- Freescale factory access is denied
- Flash security is enabled ( Jtag/Swd is disabled )
This implies that FSEC needs to be set to 0xC4. So as far as I understand flash configuration in the startup file needs to be modified to:
__attribute__ ((used,section(".FlashConfig"))) const struct {
unsigned int word1;
unsigned int word2;
unsigned int word3;
unsigned int word4;
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFC4};
What I do not understand is if these settings needs to be applied to x+400 and y+400 too or only to loader part of flash region 0+400? My reasoning is as follows:
1. MCU goes out of reset and Flash Security is configured according to settings stored at 0x00+0x400
2. Loader application jumps to application at offset x or y depending on configuration
3. Flash Security is reconfigured according to settings stored at x+400 or y+400?
My primary objective is to disable access to device (flash-dump, swd/jtag access)