SFFS Flash File System

SFFS is a Safe Flash File System that can support almost any NOR or NAND flash device. It provides a high degree of reliability and complete protection against unexpected power failure or reset events. SFFS provides wear leveling, bad block handling and ECC algorithms to ensure you get optimal use out of a flash device. SFFS is pre-integrated with the MQX RTOS and allows you to quickly create a a robust file system for an embedded device using on-chip or on-board flash devices.

Designed for Embedded Applications

The SFFS Flash File System was specifically designed for embedded systems. Taking into account the limited memory and real-time response requirement of many embedded applications, SFFS allows embedded software developers to implement a full featured file system that uses flash devices as a storage medium. This means that embedded applications can read and store data into non-volatile and inexpensive flash memory instead of requiring a hard disk drive or other mechanical media. A key requirement of a rugged flash file system is the ability to maintain the file system integrity across unexpected power loss or resets that are common in many embedded devices. SFFS is designed to ensure that the software never risks corrupting the file system or losing stored data.

The SFFS Flash File System has been tested on embedded microprocessor architectures such as NXP’s Kinetis, ColdFire and Power Architecture architectures. Flash device drivers for flash components commonly used with NXP processors have been integrated with the SFFS file system. Integration with NXP CodeWarrior tools ensures a great out-of-box experience for SFFS developers using these processor architectures. SFFS has ben pre-integrated with the MQX RTOS but can also be used with any real-time operating system.

SFFS provides the key features that you would expect from a desktop PC file system such as support for long file names, multiple disk volumes, and directory handling. It also allows multiple files to be open simultaneously and provides a standard API.

Supports NOR or NAND Flash

The SFFS Flash File System is designed to support both NOR and NAND flash devices.

NOR FlashNOR Flash

NOR flash is one of the building blocks of most embedded systems. It provides non-volatile storage of data and code for systems. It is characterized by having storage that can only be written to if previously erased and erasable blocks with relatively long erase times.

There are literally thousands of NOR flash devices available all with slightly different characteristics while retaining the same base properties. The SFFS Flash file system supports most major manufacturer’s devices including:

  • AMD/Fujitsu/Spansion flash chips including MirrorBit technology
  • Intel StrataFlash
  • Atmel devices including the small memory devices
  • Sharp Flash Memory
  • SST including 25 and 39 series
  • Toshiba Flash Memory

NAND FlashNAND Flash

NAND flash is a relatively new flash technology designed to store large amounts of non-volatile data at reduced cost. It is characterized by having storage that can only be written to if previously erased – these blocks erase quicker than on NOR flash but is still quite long. Other features that differentiate it from NOR flash are that it is often shipped with a number of bad-blocks and their reliability is much increased if all single bit errors are detected and fixed.

There are many different NAND flash devices available all with slightly different characteristics while retaining the same base properties. The SFFS Flash file system supports NAND devices from most major manufacturers including devices from:

  • Samsung
  • Hitachi
  • Toshiba
  • Micron
  • ST Micro

Provides Reliability and Integrity

Embedded devices do not have the luxury of sophisticated disk recovery programs as PC compatible devices do. If an embedded device file system gets corrupted because an erase or write operation is unexpectedly terminated the result could be lost sectors or a loss of the whole device. A robust flash file system must be designed to restore itself from any situation or system failure.

To achieve this a complete new file system must be available for use before any information is erased. In this way, if the worst happens the system can be rebuilt either in its pre-write form or with the new modifications included. This is not possible to guarantee with a DOS compatible file system and with many other file systems. Efficient implementation of this methodology with flash devices, which require sectors to be erased before writing is complex. Write and erase times can be relatively long on flash devices and it is extremely important to ensure the number of these operations is minimized. The write/erase performance of SFFS is highly optimized to ensure a high-level of performance for a 100% power-file safe system.

In order to verify the reliability of the SFFS Flash File System and ensure that data integrity is always guaranteed extensive verification is done using thousands of PC simulations of NOR and NAND flash devices and with real-world testing on actual NOR and NAND flash arrays.

High Performance Operation

Flash devices have special characteristics – in particular their write and erase times may be comparatively long. SFFS is a highly crafted flash file system designed to make the most efficient use of the underlying flash devices. It does not use a flash translation layer – instead it works directly with its knowledge of the devices to give an efficient solution. In particular a sophisticated write caching system has been developed in which only changes to the file descriptor tables are stored in flash. This allows many updates to be performed with an absolute minimum of flash chip usage while always maintaining the 100% power-fail resilience of the system.

Algorithms are also provided to support the use of Erase Suspend/Resume so that blocks that are known to be erasable are erased by an interruptible thread. Additionally, logic is included to select pre-erased blocks preferentially while still maintaining efficient wear algorithms. There are many algorithms employed to execute as efficiently as possible without over using the flash – these are done because the file system has direct knowledge of the erase/write structure of the attached devices.

Maximizes Use of Flash

Flash devices ultimately have limited life spans. Typically manufactures specify a maximum number of write/erase cycles for a device after which failures can be expected. A robust flash file system needs to be able to take this into account to ensure that it maximizes the use of a particular flash component. In addition, embedded devices can have unique requirements in terms of using parts of the the flash for other purposes other than the file system or unique configurations of multiple flash chips in arrays designed to achieve higher performance than a single chip. The SFFS flash file system is designed to maximize the use of the available flash and is flexible enough to use any flash configuration.

SFFS Flash File SystemWear-leveling

Flash devices suffer from over-use; if a particular block is used beyond the manufacturer’s specification the block may eventually develop errors. To combat this eventuality, wear-level algorithms are implemented in SFFS which ensure an even usage of the blocks. In addition the method of recording changes to the file descriptors ensures that the minimum of writing is done.

Bad-Block Management

Bad blocks may develop in a device over time. These are automatically detected by the SFFS file system and are paged out of the file system ensuring that they are never written to or erased.

Reserved Sectors

Developers often require that sections of their flash device are reserved for a particular purpose outside of the file system. This is achieved by specifying in the SFFS driver which of the available blocks are for “private” use. The user can still use the standard low-level read/write/erase routines for accessing these blocks.

Flash Arrays

In embedded hardware designs it is common to use multiple flash devices in a system either in parallel to widen the data bus and achieve higher performance, or in series to increase storage size. This behaviour is fully supported by the SFFS Flash File System and relies only on configuration changes to the drivers.

ECC Algoritms

For NAND flash devices Error Checking & Correction (ECC) may be implemented either in hardware or software. A highly efficient ECC algorithm is provided with the SFFS file system for NAND flash devices. The algorithm automatically corrects all single bit errors, resulting in substantial increase in the reliability of these flash devices.