Hi, I'm using LPC2468 I want to replace all the flash code in the internal flash at site. I have an external flash that I can download the new firmware to it (using serial or ethernet) then I want to run an IAP function that replace ALL the existing code (in Internal flash) with the new firmware. Can anyone suggest me the steps to follow. I know that while I program the flash if there will be power fail I will get into trouble - How to avoid them?
Regards, Doron
Sorry, I think I missed your point.
"But a powerloss while filling the external flash from elsewhere, would be."
If the external flash is just used as a scratch buffer for the transfer+reprogramming cycle, a power loss during the transfer to external flash should not be dangerous.
A working boot loader should be able to notice that it has a valid crc for the main application, but a broken crc for the new application and then just start the application in the internal flash. That application can then restart the transfer of a new application into the external flash.
If the boot loader do find a valid image in both internal and external flash, it can compare the two images and see if a copy is needed. After a full copy is done, the boot loader may decide to erase the external flash or toggle a flag in EEPROM or similar, just to speed up following reboots.