Hello,
I am trying to adapt the RL-ARM example "SD_File" to use the flash on the M3 itself. I tried to partition the on-board flash into two equal pieces, one for code and one for the flash drive.
I cannot find a FS_FlashPrg.c for my dev board. All that I see is for LPC2xxx, nothing for LPC17xx.
Can anyone tell me where to find one?
Does anyone have an example project that does this?
Thanks, Vic
Unfortunately it is not possible to use embedded file system for LPC17xx internal flash. The reason is ECC algorithm, which is implemented in the device to improve the long-term reliability. The ECC is able to correct single bit errors in flash page, but on the other hand, it prevents the embedded file system from being successfully used on this device.
Is that just specific to Keil's embedded file system, or would it apply generally to any embedded file system ?
It's possible to implement file systems even if the chip has ECC. But it will not work well unless you have a chip with many tiny sectors, since ECC requires full sector rewrites for every single bit of change so the flash would very quickly wear down.
For chips without ECC, it's possible to just use a part of the flash sector and then append more information without any erase cycle. And without ECC, it is possible to leave "NULL" pointers within the used area of a flash sector and later rewrite this pointer to indicate that the following information have been invalidated and that the pointer gives the new address (in same sector or in another sector) where the modified copy of the data is stored.
With partial flash sector updates, many writes can be done incrementally before the file system makes a "garbage collect" and rewrites just the current data content to the beginning of the sector again, leaving the end of the sector free for new updates.
So a flash file system designed for flash sector updates can not work with flash memory that always requires full sector erase/rewrite.