Hi Roger
The memory in the LPC2xxx tends to have a large granularity (eg. 32k). This is not always very practical (other devices have typically 512 byte, 1k or 2k granularity) for the file system since a single file, however small, occupies a compete 32k block. The work-around to this is to activate "sub-file system" support [activated by default in the LPC2XXX project]. This is described in the following document:
http://www.utasker.com/docs/STR91XF/FileSystemSTR91X.PDF (
not for the LPC2XXX specifically but the same technique).
Sub-file system use allows multiple small files to share one single FLASH sector. Its use is however a bit more complicated since it not not always possible to delete one single file. It is also not always possible to update a single sub-file without first deleting a complete sector.
The LPC2XXX FLASH is also a bit special in how it is internally organized and how it works. For example, it has a check sum for each line of 16 bytes as described in the following:
http://www.utasker.com/forum/index.php?topic=136.0, which points to the best explanation of internal workings ever found, by Philips Apps on the Yahoo forum!
The FLASH programming rules mean that one has to be very careful to not cause any changes to an existing 16 byte line since, although the change may be correctly made, the line's internal check sum is corrupted and so the chip reads back incorrect data.
What the simulator is telling you is that you have performed something which has not respected a FLASH programming rule. (The target will not cause an exception but instead may have corrupted FLASH content after doing this and so could behave strangely). Usually this occurs when trying to upload a new file to a sub-file space without first deleting the sector - this is basically not allowed by the FLASH controller in the chip.
If you initially perform a delete (eg. DEL *.* via FTP) it will clear all FLASH file-system content and then you should never have such a problem. Once you understand the internal workings (after reading the sub-file system document) you will then be able to decide when overwriting files is possible and when it is first necessary to perform a delete of an area to be copied to.
Regards
Mark