Hi,
When the flash is erased/programmed in runtime, there’s always a risk that the flash operation will be terminated by unexpected reset or power down. In this case, the flash (only areas directly modified by the erase or program operation, other flash is not affected) is left in undetermined state. In this case, it usually leads to noncorrectable ECC errors. When you access such corrupted flash later, the access is terminated by bus error and IVOR1 exception is triggered if it was core access.
The exception needs to be handled appropriately. To recover, it is necessary to erase corrupted flash blocks. There’s an application note which describes this in details:
https://www.nxp.com/docs/en/application-note/AN13179.pdf
https://www.nxp.com/docs/en/application-note-software/AN13179SW.zip
Regards,
Lukas