Keil Logo

SPI Sector Layout

The SPI Sector Layout description file, FS_SPI_FlashDev.h, specifies the memory map of a SPI Flash device. Every device has its own description file, which is located in the folder \ARM\RL\FlashFS\Flash.

To generate a description file, copy the flash sector layout information from the Flash Device datasheet, specify a sector size in bytes, and a sector base address relative to an SPI Flash Device. The Macro DSB converts this information into the RL-FlashFS compatible sector description.

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.

The following example shows a Flash sector layout configuration for the Intel SPI Flash device 25F160S33 with 2MByte memory:

#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

It is not optimal to define lots of small sectors (256 bytes or smaller). A more optimal solution for the RL-FlashFS is to join several physical sectors into bigger virtual sectors. In this case, the function EraseSector must be modified to erase a virtual sector, not a single physical sector.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.