3 File System Guidelines
As the file system may be used by customers for their own purposes, it is essential to understand the constraints and recommendations so the file system is designed and maintained properly.
The guidelines are:
- The minimum flash resolution is one 4KB block
- The file system itself requires three blocks for a total of 12KB
- There are two reserved blocks that cannot be used
- The total number of files is limited to 128 files, including system and configuration files
- The maximum size for a file is 1MB
- The maximum size for the serial flash is 16MB
- Each file will consume at a minimum:
- One block (4KB) for file without fail-safe support
- Two blocks (8KB) for file with fail safe support (double the original size)
- It is required to set the maximum size attribute upon file creation (the file system reserves space). In this case, the actual size of the file is irrelevant as file system occupies the allocated space.
- The file system reserves space per file at file creation. It is required to specify the maximum size of a file at creation, that maximum size is the space occupied by the file in serial flash, regardless of the actual size of the contents.
- The maximum file size and space reserved by the file system for a file cannot be changed after a file is created.
- File attributes (currently, only fail-safe) cannot be modified after the file has been created
- There is no fragmentation in the file system. This means that an existing file which is removed will leave a hole in memory. This hole may be reallocated by the file system if a newly created file can fit.
- When file is created, the minimal size memory hole that can hold the file is allocated to it.
- The actual size of a file may increase depending on its size. For more information on this mapping, see Section 4.
- Each file has a header while enlarges the actual size of the file. This overhead is 400 bytes. If the file size is close to a multiple of the 4KB block size, this may result in an additional block being allocated. For example, a file with an actual size of 4000 bytes would result in two blocks being allocated one the header is taken into account as 4000 + 440 bytes > 4096 bytes. For more information, see Section 5.
- Some system/configuration files may be created internally by the device. For more information, see Section 5.
- Some system and configuration files may be created implicitly by the host processor as a result of invoking non file-system APIs. For more information, see Section 5.