Flash File System Integration Guide
The following are the steps to integrate or enable AWE Flash File System. Make sure the flash device is fully erased for the first time before enabling AWE Flash File System.
Define the following macros corresponding to flash memory size in bytes, erasable block size and the start offset for the Flash File System. Make sure the start offset does not overlap with other applications usage. It is recommended to use the free space in the flash from the end. Following are the example macros of a 64MB flash device:
/* ---------------------------------------------------------------------- ** Specify flash memory available for flash file system ** ------------------------------------------------------------------- */ #define FLASH_MEMORY_SIZE_IN_BYTES 0x4000000 #define ERASEABLE_SECTOR_SIZE 0x10000 #define FILE_SYSTEM_START_OFFSET 0xB0000 #define SECTOR_ERASE_TIME_MS 400
Declare a global AWE Flash File System instance:
/** Flash file system instance */ AWEFlashFSInstance g_AWEFlashFSInstance;
Initialize global AWE Flash File System instance to zero:
// Setup the flash file system */ memset(&g_AWEFlashFSInstance, 0, sizeof(AWEFlashFSInstance) );
Initialize the callbacks for ‘cbInit’, ‘cbEraseSector’, ‘cbFlashWrite’ and ‘cbFlashRead’:
Initialize flash memory size, erasable block size, start offset and block erase time:
Initialize the Flash File System by calling awe_initFlashFS:
Assign pFlashFileSystem in AWE Instance to Flash File System instance:
Define callback functions for ‘Init’, ‘Erase’, ‘Write’ and ‘Read’: