1.1   Introduction

TrueFFS for Tornado is a VxWorks-compatible implementation of M-Systems FLite, Version 2.0. It provides a block device interface to a wide variety of flash memory devices. This system is reentrant, thread-safe, and supported on most of the more popular CPU architectures.

Using TrueFFS for Tornado, applications can read and write from flash memory just as they would from an MS-DOS file system resident on a magnetic-medium mechanical disk drive. This is despite the fact that the underlying storage media are radically different. TrueFFS for Tornado hides these differences from the high-level developer.

However, when designing an embedded system, it is critical that you be aware of how flash memory compares to mechanical magnetic-media disk drives as a storage device. Although flash memory might not be practical for all embedded systems, there are many environments in which its unique qualities make it the ideal choice.

About Flash Memory as a Storage Medium

Flash memory stores data indefinitely, even while unpowered. In addition, the physical components of flash memory are solid-state devices (no moving parts) that consume little energy and take up little space. Thus, flash memory is ideal for mobile devices, hand-held devices, and any other embedded system that needs reliable non-volatile data storage in environments too harsh for mechanical disks.

However, the physical characteristics of flash memory differ considerably from the more common magnetic-medium mechanical disks. When using magnetic storage media, overwriting a previously written storage area simply obliterates the existing data. Such is not the case with flash memory. Flash memory requires a separate erase cycle before new data can be written to an area. Using the erase cycle is further complicated by the fact that one cannot erase individual bytes or even blocks. Instead, the underlying flash technology requires that you erase entire regions known as erase units. The size of these erase units depends on the specific flash technology, but a typical size is 64KB.

Flash also limits how often you can erase and rewrite the same area. This number, (known as the cycling limit) depends on the specific flash technology, but it ranges from a hundred thousand to a million times per block.1 As a region of flash approaches its cycling limit, it begins to suffer from sporadic erase failures. With further use, these erase failures become more and more frequent. Eventually, the medium is no longer erasable and thus no longer writable, although the data already resident is still readable.

In addition to the cycling limit, there is also a limit on immediate successive erase/rewrite cycles. Constantly erasing and rewriting the same area puts flash memory into an over-programmed state. In this state, flash responds only very slowly to write requests. With rest, this condition eventually fixes itself, but the life of the flash memory is shortened.

Finally, using flash memory is further complicated by the fact that writing to flash is not a simple physical act. In fact, storing data in flash memory requires the use of a programming algorithm (defined in a software module known as an MTD) that differs depending on the manufacturer (and, sometimes, the device family) of the flash memory.2

Data Integrity and Removable Flash Media

A robust block driver running over flash memory must deal with all the complexities associated with removable media (flash cards). For example, it is entirely possible that a user could pull out a flash card while the driver was in the middle of a write. Such an interruption could be catastrophic if the data being written happens to be the directory structure. Fortunately, TrueFFS has been carefully designed to take into account all the peculiarities of flash memory, power losses, and impatient or curious users who yank out flash cards just to see what happens.


1:  This number is merely statistical in nature and should not be taken as an exact figure.

2:  Because writing data to flash memory requires the use of a manufacturer-supplied programming algorithm, writing flash is sometimes referred to as programming flash.