Keil™, An ARM® Company

RL-ARM User's Guide

Using Memory Card Devices

You can configure RL-FlashFS to store files in a standard SD/MMC flash memory card. All drives (Flash drive, RAM drive, and MC drive) can be used at the same time with no limitations, as long as each drive is properly configured. To configure the memory card drive, you must copy the configuration file File_Config.c and the SPI interface driver SPI.c to your project directory.

The RL-FlashFS supports standard SD and MMC flash memory cards with sizes ranging from a few MBytes up to 4 GBytes. The system can read or write to the Root directory of the drive and to any subdirectories created. The root directory typically has 512 entries. This limitation applies to FAT12 and FAT16 file system only. This means that 512 files plus root subdirectories together may be stored on the root directory of the drive. This limitation does not apply to the FAT32 file system.

RL-FlashFS fully support support directories, subdirectories and long filenames. The system can handle standard 12-bit, 16-bit and 32-bit File Allocation Tables. When accessing files located in subdirectories a complete path must be specified in the file reference. For example:

fopen ("logs\\work\\temp.log","r");

Before a memory card is removed from the system, all files that have been opened for writing have to be closed. Flash File System uses a simple FAT Table Caching and Data Caching to speed-up memory card data access. Data Cache Buffer size and location is configured in the configuration file. If the files are not closed, modified data that is still in the FAT Cache is not written to the memory card. This makes the affected FAT table invalid and corrupts the file system.

note

  • All files opened for writing must be closed before the memory card is removed from the socket. Otherwise, a FAT file system might be corrupted.