RL-ARM User's Guide

Allocation Information

Allocation Information is stored at the top of a Flash Block and is written in descending order. Each allocation information record consists of 8 bytes. Each file fragment has its own allocation record. The first file fragment starts in Flash Block at offset 0. It is always assumed that the first file block starts at the beginning of a Flash Block.

Flash Block

The file allocation information record has the following components:

  • end is the end address of the file fragment.
  • fileID is the file identification number and is associated with the file name.
  • index is the file fragment ordering number, which starts at 0 for each file.
struct falloc {
  U32 end;
  U16 fileID;
  U16 index;
};

The file allocation information is written when:

  • The file is opened for writing and RL-FlashFS creates a Filename information record.
  • The file is closed and the file handle released.
  • The file is flushed and the number of bytes from a file buffer is not a multiple of 4.
  • The Flash Block is full and there is no more free space.