Content originally posted in LPCWare by MikeSimmonds on Tue Mar 24 00:16:36 MST 2015
Yes, but with reservations.
You would probably have to copy the boot loader update code in to internal SRAM and execute from there.
[Because you cannot read (i.e prefetch code) from the flash while it is being erased or programmed.]
Also, (simplistically) ALL interrupts must be disabled. [Because an interrupt will read the vector table in flash.]
Ideally, the replacement image should also be completely saved (also in RAM) to make things easier.
THE BIG ISSUE IS that if the update fails, you then have an un-bootable device, and to recover from
that situation, you will need ISP mode and e.g. FlashMagic with a known good boot loader.
If you do go for this scenario, I would suggest adding the 'boot update' code say at the end of the actual
boot loader. The application (in your scenario) would copy that to RAM and execute as outlined above.
This way, you don't have update code added to every application, but just once in the boot loader.
Cheers, MIke