Content originally posted in LPCWare by ahp on Mon Jul 02 01:27:00 MST 2012
Hi,
I am working on something similar and have just posted a thread with the title "Replace application at runtime with IAP and boot switch".
I can answer a few of your questions:
1. The Flash has a limited number of writes (Clear+Program). In LPC it is 100000. A Flash write is performed by clearing the entire sector and then writing the data. Only the data which results in a bit change from 1 -> 0 causes wear (so if you are writing 0xFF it does not deteriorate that part of the Flash). You can also write the sector in multiple writes after a clear over a period of time. Wear Leveling may be used to improve Flash life expectancy, but I have never found it necesarry. After all, 100000 writes means you can update your program once a day for almost 274 years before the Flash has reached its limit.
2. LPC executes directly from Flash (reading do not degrade the Flash like writes do), so the execution is never from RAM. RAM is only used for the stack and any buffers and local variables you may allocate.
I hope this helps, and if you have found a solution for the main question I will greatly appreciate a note, as I have been struggling with the same issue for a while.