1. write unprotected P-Flash area
2. protect target P-Flash area
3. tries to write protected P-Flash area
4. call Protection Override command for temporary modify P-Flash protection
5. write into temporary unprotected P-Flash area
6. restore original P-Flash protection scheme
The part of P-Flash memory used in this example for writing tests (0xFF8000..0xFF8FFFUL) is excluded from linker using. Please look at prm linker file for more details.
The flash_array constant with Protection Override Comparison Key is not directly referenced in the code, therefore we must enter the constant name into ENTRIES section in prm linker file for avoiding stripping it out as unused.
Please look at P-Flash Protection Register (FPROT) chapter in the reference manual for more details about P-Flash protection.
The key for Protection Override should be rather received from external source and used as PFLASH_Protection_Override() parameter. The correct Protection Override key is here hard-coded (err = PFLASH_Protection_Override(0xCAFE, 0xF...) for example code simplifying.
I hope it helps you.
Original Attachment has been moved to: S12ZVC192-FLASH-Override-Protection-CW107.zip