File System Component
Version 6.6
MDK-Professional Middleware for Devices with Flash File System
|
The Embedded File System (EFS) is a proprietary file system used on the NOR flash devices. Basic features are:
A flash device is divided into sectors which are named blocks in the File System Component. Typically, a block is a 64 KB memory page. Blocks can be divided into memory cells, which are written sequentially. The memory cell size depends on the device architecture and is 8- (byte), 16- (half word) or 32-bit wide (word).
Each block contains its own allocation Information written to the file allocation table located on top of the memory. The file name and file content are stored in lower memory regions. If the file size exceeds a single block, then the file is stored across several blocks. Several smaller files are stored into a single block.
When the file content is modified, the old file content is invalidated and a new memory block is allocated. Block is erased when all the data stored in it have been invalidated.
Allocation Information is stored at the top of a 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 block at offset 0. It is always assumed that the first file block starts at the beginning of a flash block.
The file allocation information record has the following components:
The file allocation information is written when:
File Data Fragments are of variable size and are fully defined through the file allocation information record.
To make the best use of the Flash block, create big file fragments to reduce the total number of file fragments. It is not optimal to open a file for appending or writing a byte to it and close the file again. This approach creates huge file allocation information records, which consume 12 bytes of Flash in total; 8 bytes for the file allocation information and 4 bytes for the information. In addition, such an approach creates slow access times to files.
The following restrictions are applicable to the EFS: