The Flash Container Interface (FCI) filesystem is defined in <<DOCUMENT>> and is summarized here. Its physical form is ~32 MB of flash split into 2048 blocks of 32 pages. Block 0 is used for the filesystem bookkeeping, with the remainder used for data storage. This documentation is mostly concerned with the contents of Block 0.

Page Layout:

  Data:  512 bytes
  Flag:  4 bytes  (protected and normally unreadable)
  Link:  4 bytes

Block 0 Layout:

   0:     Boot Options Vector      (16*4 words -->  256 bytes)   
          File Handle Vector       (64*1 word  -->  256 bytes)
   1:     Factory Good Block List  (2048 bits  -->  256 bytes)
          RESERVED                 (                256 bytes)
   2:     Container Lookup Table   (64*1 byte +                // Data
                                     8*1 byte +                // Task
                                    64*1 byte +                // Configuration
                                     2*1 byte                  // System
                                               -->  138 bytes)
          RESERVED                 (                374 bytes)
   3-18:  Block Erase Count        (2048 words --> 8192 bytes --> 16 pages)
   19-26: RESERVED
   27-30: Metadata Vector          (64*8 words --> 2048 bytes --> 4 pages)
   31:    Good Block List          (2048 bits  -->  256 bytes)
          Free Block List          (2048 bits  -->  256 bytes)
          File System Version      (   1 word  -->    4 bytes)
          Note:  Version is stored in the Flag word.

Boot Options Vector (BOV):

This is constrained by the boot code to be the first 256 bytes of Page 0, Block 0. Each of the 16 boot options corresponds to one setting of the front panel rotary switch. Each contains 4 words: Flags, file number, load address and transfer address. The File number is an index into the File Handle Vector.

File Handle Vector (FHV):

The second half of Page 0, Block 0 is constrained by the boot code to be the FHV. Each of the 64 words corresponds to one FileHandle in FCI. The FileHandle is a bitfield:

        SSSSSSSS SSSSSSSS LLLLLBBB BBBBBBBB
        S --> Size of file in *Pages*
        L --> Last used page in the block
        B --> Block number of first Block

Good Block List (GBL and FGBL):

The FGBL (in Block 1) is what was supplied by the factory on the flash chip as the list of good blocks. It is a simple bitfield and is treated as readonly by FCI. The GBL is a copy of the FGBL which is updated if a block fails during usage.

Free Block List (FBL):

The FBL is a bitfield indicating which blocks currently are used by FCI.

Container Lookup Table (CLT):

FCI has 4 types of "Containers" (or Files): Data, System, Task and Configuration. There are max 64 Data, 2 System, 8 Task and 64 Configuration Containers. Each Container Entry is a bitfield:

      TTMM MMMM
      T --> Type of container
      M --> MetaData name (number)

Type is not used other than for allocation of new entries. A type of "3" means that the container is unallocated. Note: This conflicts with the Type enumeration in Container.hh, but was useful for allocation. The MetaData name is the index in the MetaData Table where this container's MetaData is stored

MetaData Table (MDT):

The MDT spans 4 Pages towards the end of Block 0 and contains MetaData for the containers. A MetaDataEntry object is a File Handle followed by 7 words of type-dependent data.

Container Structure:

An actual container is a series of pages in a series of blocks. The FileHandle in the MDT/FHV references the first block of each Container, and the last page in that block that is used. Each block references the next block in the chain (through the Link (a FileHandle) in the last used page of the block). The blocks in a container do not have to be contiguous, and in general will not be.

For example:

MD Entry 2 references a Container with 0x0EE1 pages with the first block being 0x0F1, the last written page of which is 31. The last page of Block 0x0F1 references (0x0F0,31), and so on for another 116 block references. (0x0EE1 / 32 pages per block == 119.) The last block (in this case 0x7B) references block (0x7A,1) as the container size % 32 is 1.

  • No labels