Document toolboxDocument toolbox

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.

  1. 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
  2. Declare a global AWE Flash File System instance:

    /** Flash file system instance */ AWEFlashFSInstance g_AWEFlashFSInstance;
  3. Initialize global AWE Flash File System instance to zero:

    // Setup the flash file system */ memset(&g_AWEFlashFSInstance, 0, sizeof(AWEFlashFSInstance) );
  4. Initialize the callbacks for ‘cbInit’, ‘cbEraseSector’, ‘cbFlashWrite’ and ‘cbFlashRead’:

  5. Initialize flash memory size, erasable block size, start offset and block erase time:

  6. Initialize the Flash File System by calling awe_initFlashFS:

  7. Assign pFlashFileSystem in AWE Instance to Flash File System instance:

  8. Define callback functions for ‘Init’, ‘Erase’, ‘Write’ and ‘Read’: