Yaffs - NAND flash file system for the eCos RTOS
Yaffs is an optional middleware package for the eCos RTOS that provides a high reliability file system designed and optimized for use with raw NAND flash devices.
Yaffs is one of the most mature, reliable and widely used NAND file systems available today. First released in 2002, it has been under continual development and refinement ever since. Typical markets for Yaffs include industrial, instrumentation, and consumer - areas where reliability, performance and minimal resource usage are key requirements. Yaffs-based products have included applications as diverse as deep space probes, surveying equipment, point of sale terminals and sewing machines. Yaffs has also been deployed in devices based on Google's Android platform, including mobile phones from Motorola, Philips, Samsung, LG, HTC and many others.
The file system has been fully integrated with eCos, working in conjunction with eCos's fileio layer, and eCosCentric's NAND flash library and driver architecture. The integration with eCos's fileio layer ensures that all standard file level API's work seamlessly with Yaffs. The NAND library layer provides a portable device-independent interface to Yaffs for the reading, writing and erasing of NAND blocks, and handling of bad block management and error correction.
Support has also been incorporated into the eCos-based RedBoot bootloader. This enables the bootloader and applications to share and modify a common storage medium. In addition the eCos NAND library's low level bad-block handling has been designed to be compatible with the Linux-MTD layer. This enables the sharing of a common storage medium between eCos, RedBoot and Linux, and can help simplify embedded linux installation, maintenance and update.
- Designed and optimised for use with raw NAND flash devices
- Mature, proven file system design and implementation
- Robust against random system resets and NAND block failures
- Designed to maximise NAND device lifetime
- Fully integrated with eCos file system layer
- File level access to Yaffs file systems incorporated into RedBoot bootloader
- Low RAM usage and small code footprint
- GPL licensed version of Yaffs available as a free download - the ideal way to evaluate Yaffs
- Commercial licensed version also available
- Automatic initialisation of virgin NAND devices - no formatting required
- Partitioning support - simplifies implementation of NAND-only booting and bootloader based systems
- Multiple NAND device configurations for high capacity designs
- Both large and small page NAND device types supported
- High performance device drivers with ECC h/w offload capability (where supported by NAND controller)
- A range of polled and interrupt driven driver modes are available - optimise performance vs overhead
- eCos synthetic target device driver available - includes bad block injection and logging facilities
- Linux MTD NAND layer compatible
- UTF-8 compatible file and pathnames
Reliability & Longevity
Yaffs is specifically designed for use with raw NAND flash memory, optimized for speed and to ensure reliability and longevity. NAND is an inherently unreliable storage medium and the NAND library and Yaffs take multiple complementary approaches to maximise its usable life, detect and correct errors as they occur, and maximise performance. These include:
- Log structured file system design
- Dynamic wear levelling
- Write gathering
- Bad block management
- Error Correcting Codes (ECC) for defect detection and correction
- ECC hardware acceleration where available
- Checkpoint support for fast mounting
The eCos implementation has been extensively exercised with automated functional and intensive long-run stress tests run on a range of platforms and NAND devices. This includes the use of synthetic NAND hardware with high frequency bad block injection and varying system reset intervals. Stress testing includes randomly changing loading of file and directory operations, writes with payload verification, multi-threaded concurrent access, and file system boundary condition exercising. Yaffs is also comprehensively tested via the wide range of testing approaches applied by Aleph One. Testing has verified that Yaffs survives millions of power failures in simulation test runs.
Theoretical file system limits:
- Maximum file system size: 4 terabytes
- Maximum file size: 2 gigabytes
- Maximum number of files: 231
- Maximum filename length: 254 bytes
In practice these limits are dependent on the NAND page size and overall device capacity, as well as available RAM for file system metadata.
Under a licensing agreement with Aleph One, eCosCentric is the exclusive licensor of the Yaffs file system for eCos. Yaffs is freely available under a GPL license, and for companies that wish to avoid the strictures of the full GPL license, an alternative commercial license is available through eCosCentric. Aleph One remains the commercial licensor for all other systems.
A commercial license enables companies to ship eCos-based products that incorporate Yaffs along with their own proprietary application and any licensed middleware. The GPL licensed version requires that all software included in your product linked with eCos and Yaffs is also licensed under the GPL. This in turn requires you to make the source code of the software freely available. These requirements may not be acceptable to many companies wishing to use Yaffs, especially the requirement to open source the application itself. It may also not be possible to comply with depending on the licensing of other software components used, such as third party middleware. The commercial license removes these limitations.
The commercial license is available on a per-product, product family or company buyout basis. It does not require royalty payments or any auditing of product shipments. Other than the license itself there is no technical difference between the GPL and commercially licensed versions.
Downloading Yaffs for eCos
eCosCentric has made the GPL licensed version of Yaffs available as a free download, along with the necessary NAND library and device drivers. These are supplied as an installable and configurable eCos EPK modules. Full source code and documentation are also included. If you decide to use Yaffs within a product you should determine if the purchase of a commercial licensed version is required.
For an in-depth discussion of the critical aspects to consider when selecting a flash file system, read Aleph One's Flash File System Considerations white paper.
For additional technical details please read the Yaffs file system and NAND library chapters of the eCosPro online documentation. You can also consult Aleph One's Yaffs resource website and its comprehensive documentation section. For questions regarding the Yaffs package including licensing, technical or commercial issues, please contact eCosCentric for a detailed discussion.