Content originally posted in LPCWare by DPeters on Mon Mar 19 09:38:18 MST 2012
Yes, the unexpected reset is the concern, where I need to ensure the program is properly bootloaded. I've discovered a solution whereby all SPIFI operations are encapsulated in routines that have wrapper calls. Basically the SPIFI is enabled only during the routine, then disabled afterwards. As long as the reset happens outside of the SPIFI routine, the SPIFI will successfully bootload after the reset. To do this, add the following routine declarations to the spifi_rom_aph.h file:
void set_mem_mode (SPIFIobj *obj);
void cancel_mem_mode (SPIFIobj *obj);
Before any SPIFI operation, call set_mem_mode(). When done, call cancel_mem_mode().
NOTE: Memory mapped spifi address reads/writes are off-limits following a cancel_mem_mode() call, otherwise a hard-fault occurs.
There is still a chance a reset will happen between the time set_mem_mode() and cancel_mem_mode() are called, and thus a double reset would still be needed, but I think this is the best that can be done with the current errata.