Content originally posted in LPCWare by david.harper on Fri Aug 01 16:35:39 MST 2014
Did not try the bootloader example directly - my scenario is a bit different - but the flash related code is very similar. I've looked at all of the examples of flash programming code I can find - not much variation and all similar/equivalent to mine.
I "know" the erase isn't working by checking the flash contents at the page I'm trying to program. I look at it before erase, after erase, and after writing. When I do the erase, the contents are unchanged. When I have the Keil tool do the erase, I see 0xff as expected and I see my write modify the bytes as expected.
I don't dump the entire flash space so I could be erasing a different sector than I think I am - that would be a surprise since I've checked the sector value, it seems correct, and I'm using the same sector number for the write which is showing up where I expect it to show up.
I guess a next step could be to do a diff on the entire flash address space.