Hello,
I'm writing this huge Forum request because the Keil support didn't answer my email support request in a proper way, yet. I'm a bit disappointed, so I hope somebody else might help me...Maybe I'm not the only one, who has problems with the flashfilesystem.
I want to use the flashfilesystem delivered with the RealTime Libary on the on the MCB2300 board (with LPC2378 from NXP). Using ARM-MDK (3.04) and RL-ARM (3.04).
First I'm describing my configuration of the FFS and after that I explain my problems.
The flashfilesystem should be placed in the upper 5 sectors of the internal flash of the microcontroller.
So this is my device configuration file FS_FlashDev.h:
... //Definition of the FlashSectors used by the Flash File System // DFB( size , baseadr ), /* Comment */ \ <-- macro continuation sign (Don't forget) #define FLASH_DEVICE \ DFB(0x001000, 0x000000), /* Sector Size 4kB */ \ DFB(0x001000, 0x001000), /* Sector Size 4kB */ \ DFB(0x001000, 0x002000), /* Sector Size 4kB */ \ DFB(0x001000, 0x003000), /* Sector Size 4kB */ \ DFB(0x001000, 0x004000), /* Sector Size 4kB */ \ // Number of previously defined sectors #define FL_NSECT 5
I setup the File_Config.c like this:
Flash Drive Option checked Target device Base address 0x0007 8000 Device Size in bytes 0x0001 0000 CPU Clock Frequency[Hz] 48000000 Initial Content of Erased Memory 0xFF Device Description File FS_FlashDev.h Default Drive: Flash
Comment: I'm not sure if I configured the Target device Base address correctly. According to the documentation it specifies the device base address in the memory space of ARM processor I guess in my case it's the absolute starting address of the first Sector defined in the FS_FlashDev.h.
LPC2148 uses ECC flash data protection algorithm. This means it has a hidden byte where a control code for the flash page is stored. Based upon this data, an automatic error correction of a few bits in a page is possible. This makes the flash data reliability much better, but on the other hand has a side effects. You can not write tha flash page twice, this means you must write the whole page only once and then erase the whole sector. I think that one page is 16 (or maybe 32) bytes. IAP routines are able to write only 512/1024 byte blocks.
Flash File System does not work with ECC pages so this is the reason it is unusable for internal flash on devices using ECC.