Keil™, An ARM® Company

RL-ARM User's Guide

FS_FlashDev.h

The memory map is specified in the FS_FlashDev.h description header file. Every device has it's own description file. Those files are located in the \Keil\ARM\RL\FlashFS\Flash folder.

To generate a FS_FlashDev.h description file, copy the flash sector layout information from the Flash Device datasheet.

You need to specify a sector size in bytes and a sector base address relative to a Flash Device Start address. Macro DSB converts this information into the RL-FlashFS compatible sector description.

The following example shows a Flash Sector layout configuration description for the 25F160S33 Intel SPI Flash Device:

#define SPI_FLASH_DEVICE                             \ 
  DSB(0x10000, 0x000000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x010000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x020000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x030000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x040000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x050000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x060000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x070000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x080000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x090000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x0A0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x0B0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x0C0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x0D0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x0E0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x0F0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x100000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x110000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x120000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x130000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x140000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x150000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x160000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x170000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x180000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x190000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x1A0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x1B0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x1C0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x1D0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x1E0000),     /* Sector Size 64kB */ \ 
  DSB(0x10000, 0x1F0000),     /* Sector Size 64kB */ \ 

#define SF_NSECT    32

To improve the RL-FlashFS performance, the sector information is stored as a table in the code. The RL-FlashFS scans this table when accessing files from the SPI Flash Device.

Flash File System writes allocation information at the top of each sector. It is not optimal to use Flash Devices with a lot of small sectors. In this case more optimal solution for the FlashFS would be to join several physical sectors into bigger virtual sectors. In this case a fs_EraseSector() function shall be modified to erase a virtual sector, not a physical sector.