IAP Gotcha( Don't do this) and Internal Flash question
2006-05-19 by lhaddix
Hi, I'm working with an LPC2138 and spent the day getting IAP and interrupts all working at the same time. In the course of this I think I scanned every IAP post on the list. Lots of folks reported erratic behavior afterward. I too had 'erratic behavior', the cause was the IAP API using the top 32 bytes of RAM. Nothing up there anyhow right? Well my stack was up there and it's much better now that stack top is at 0x40007FE0. Also you need to go into the .ld file and say the size of RAM is 0x7fe0 not 0x8000. I'll bet this same problem has harpooned more than one programmer. My remaining problem... Now what I'm up against is that to do a read sector into ram/ modify/ write back to flash sequence needs a full 32k for the large sectors. It looks like just as with many flash device you can only set bits to zero, not restore ones. It takes a sector erase to get them back to ones which kills all of the data in the sector unless you can buffer it and write it back. Anybody been here and worked around this? Landrum