Your SlideShare is downloading. ×
  • Like
White Paper: Flash Management Software: When, Why and Which?
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

White Paper: Flash Management Software: When, Why and Which?

  • 288 views
Published

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
288
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Flash Management Software: When, Why and Which? White Paper Arie Tal AUGUST 03 95-WP-0803-00, Rev. 1.0
  • 2. TABLE OF CONTENTS Introduction ................................................................................................................................. 3 Is software ALWAYS needed to work with Flash? .................................................................. 3 Are 100,000 erases per block enough? .................................................................................... 4 How can the flash life span be prolonged?.............................................................................. 4 What are the major issues in handling NAND/MLC NAND memory?..................................... 5 Bad Blocks .............................................................................................................................. 5 Bit Flipping .............................................................................................................................. 5 Are there any system level issues to be considered when using flash software?............... 5 So when should software be used?.......................................................................................... 6 What are flash management software alternatives? ............................................................... 6 M-Systems’ TrueFFS .............................................................................................................. 6 JFFS for Linux......................................................................................................................... 8 Software from Flash Vendors.................................................................................................. 8 Software from OS Vendors ..................................................................................................... 8 How to Contact Us ...................................................................................................................... 9 2 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00
  • 3. INTRODUCTION It is a well-known fact that in order to use flash memory, a software driver is required. But the “when, why and which” of flash management software is far more obscure. The purpose of this article is to shed some light on different limitations of flash that require software management, to describe system level considerations, and to review popular alternatives used today. IS SOFTWARE ALWAYS NEEDED TO WORK WITH FLASH? Many developers will probably say that software is not needed. And they’ll be mostly right. The simple fact is that when flash memory is used to run code that is never changed, as is the case with most embedded devices (Did you ever update your VCR’s firmware or your digital camera’s? …), flash, or rather NOR flash, can indeed be regarded as any other standard memory that does not require software. If only life could be so simple. Fact: If the only requirement is to run code and never change it, you would use ROM. It’s much cheaper, and probably much faster. But if you choose to use flash, it is probably because you want the option of erasing it (or rather parts of it) in a “flash” and changing its content. Fact: To write information to an area of standard memory that already contains information, all you need to do is, simply enough, re-write it. However, before you write information to an area in flash that is filled (even partially) with content, you must first erase it. This “erase first” requirement means that you need a software driver to perform even a basic write operation in order to verify if the area to which you want to write contains information and requires erasing. Fact: NAND flash (common in data-centric applications) has an I/O interface and uses a protocol that includes commands (read/write/erase), address and data. NAND also does not permit access to a random memory address. Instead, you must access pages of 512Bytes at a time. This means that a software driver is required to perform ANY type of access to NAND flash. This also means that although raw NAND flash is very convenient as a disk replacement (mechanical hard drives are also accessed in blocks of 512 Bytes, and are referred to as “block devices”), you cannot run code from it. This simple, low-level software module performing read, write and erase operations is often referred to as the MTD or Memory Technology Driver. Fact: Flash can only be erased so many times. Flash permits you to write, erase and save information on it for at least ten years. However, like any good thing, if you use it too much, it will eventually wear out. Each flash block can be erased some 100,000 times before you can no longer be sure if what you write is stored properly. Think of it, if you will, as a piece of paper on which you write using a pencil, then erase, then write, then erase… Eventually, you will dig a hole in the page (see Figure 1). 3 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00
  • 4. Figure 1: Flash, like paper, can only be erased so many times before it gets used up. ARE 100,000 ERASES PER BLOCK ENOUGH? If you are designing a VCR and your only requirement of flash is to store code and channel information and record an occasional program, then 100,000 erases per block is way more then you will ever need. But if you are designing a PDA with a file system that updates its file allocation table every single time the user updates a file, a record, a contact and so on, reaching 100,000 erases on the block keeping the FAT will take a matter of weeks. HOW CAN THE FLASH LIFE SPAN BE PROLONGED? Like all good ideas, the solution is simple: You don’t write the same file to the same place twice. Instead, you move it around the flash media and manage a table that translates the “virtual” file/sector address used by the file system with its current physical address on the flash. In this way, you prolong the flash lifetime without changing its physical characteristics. Example: Assume that you must update your FAT about 100,000 times a month and have 1000 free blocks in your media. If you keep erasing and writing the FAT table to the same block, your device will be used up after one month. However, if you move the FAT around the 1000 free blocks, each capable of 100,000 erase cycles, you can use your device for a whopping 1000 months (83 years and 4 months). This mechanism is often referred to as the Flash Translation Layer (FTL) or as NFTL (NAND Flash Translation Layer). There are many techniques and patents in this field, many owned by M-Systems and incorporated into TrueFFS, the de-facto industry standard software for flash management. 4 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00
  • 5. WHAT ARE THE MAJOR ISSUES IN HANDLING NAND/MLC NAND MEMORY? NAND flash is designed for high-capacity multimedia applications. As such, low cost and high performance are its two, most important features. However, reliability is not one of its strong points. The two major reliability problems of NAND flash are bad blocks and bit flipping. Bad Blocks As low-cost is one of the most important factors of NAND flash, it is manufactured with a built- in compromise: it may randomly contain bad blocks. These bad blocks are detected and marked during production. Flash software must first scan the media for bad blocks, and map them out of the active area. If you fail to do so in a reliable fashion (even if you miss just one block), you risk losing information by storing it in a bad block. Bit Flipping NAND flash retains the information it stores in a mostly reliable way. But every now and then (not too often), a bit may flip and the information you read will not be the same as the information you wrote. This may be of minor importance if the bit belongs to a song or picture, but it may be disastrous if NAND is also used to store the OS image and applications. As NAND storage grows with the introduction of new technologies such as the Multi-Level Cell (MLC) NAND, more bits tend to flip (up to 4 random bit errors per page!), and they tend to do it more frequently. If you are using NAND flash, make sure your software knows how to avoid these phenomena. ARE THERE ANY SYSTEM LEVEL ISSUES TO BE CONSIDERED WHEN USING FLASH SOFTWARE? Unfortunately, many. To link between the operating system or file system and your actual flash management driver, you need a software layer, often referred to as the driver layer. File systems usually work with standard APIs such as open file, read/write file or sectors. Most file systems are structured to remain blissfully unaware of the flash management “drama” that takes place on lower levels. This means that your driver layer usually must provide them with file or sector level services. As each OS has its own file system and API and its own unique way to access kernel mode code (such as the notorious DDK from Microsoft), you must rewrite this section for each new OS with which you work. You may also need to customize other flash management code mentioned above, due to OS limitations, compiler/debugger limitations or even due to different types of hardware used (different CPUs, buses, flash types and so on). On top of all this, you must make sure your translation tables remain valid in the event of sudden power losses, that they do not consume too much memory, that your code size does not become a problem for memory-starved systems, that it does not downgrade performance and that it is consistent with all these parameters regardless if the media is filled or empty. 5 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00
  • 6. SO WHEN SHOULD SOFTWARE BE USED? 1. As soon as you make the decision to use flash, you already need to use software to make sure you do not write to a block that needs to be erased first. 2. If you seldom change the content, the software can be very basic (read/write/erase). 3. If you are using NAND flash, you need software to perform ANY flash related operation. Even read. 4. If you are using NAND flash, you need the software to also handle NAND factory level bad blocks and bit flipping issues. 5. If you are planning a data-centric device such as a smartphone or PDA, you need full scale flash management software, preferably a proven one, to manage the flash. This will free you to focus on the real challenge of developing a great product on time, with lots of features that will hopefully outsell your competition (and get you promoted to a new position, in which flash management will no longer be your responsibility…). WHAT ARE FLASH MANAGEMENT SOFTWARE ALTERNATIVES? M-Systems’ TrueFFS TrueFFS (True Flash File System) is M-Systems’ patented flash management software. It is essentially a software layer (or driver) that resides between the Operating System (OS) file system and the flash device. TrueFFS provides the OS with full block-device functionality, appearing to the OS as a standard hard drive, while at the same time transparently providing flash media management. TrueFFS was first introduced back in 1992, when flash was in its infancy and using flash as a “disk” seemed like science fiction. It has since became a de-facto industry standard, integrated into most Microsoft operating systems, WindRiver OSs, QNX, Symbian and others. TrueFFS is embedded in all of M-Systems’ products. TrueFFS main benefits are listed below. Long Life Span: Dramatically prolongs device lifetime using advanced dynamic and static wear-leveling algorithms. Data Integrity: Performs error detection and correction (based on BCH and Hamming code algorithms) and NAND flash bad-block management. Supports enhanced ECC required for MLC NAND. Reliability: Secure algorithms insure additional data integrity in cases of sudden power loss. Transparency: Full block-device (disk drive) emulation that connects to any file system. Robustness: Built in Rugged FAT based file system (for OS-less applications or when no file system is available). Simple Integration: Supports a wide variety of OSs and platform types. 6 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00
  • 7. Highly Customizable: TrueFFS SDK provides for easy adaptation for a variety of systems and development environments. Its features can be customized for specific applications needs, including: • Optimization for performance vs. Memory usage • Code size • CPU specific issues • OS specific issues • Bus width and type (8/16/32bit, big/little Endian) • Pointer arithmetic’s and custom memory copy routines TrueFFS Structure: To help understand TrueFFS, think of its structure as comprised of three main blocks (see Figure 2). Figure 2: The Three Major TrueFFS Blocks The top block (the driver layer) provides block device services to the OS file system. This code has to be ported for each new supported OS. The middle block can be referred to as the “brains” of the package, and contains the block device emulation algorithms and the flash management algorithms (this block is sometimes referred to as the Translation Layer or TL). It is responsible for translating the file system’s sectors into physical flash blocks. While translating the addresses, it transparently handles the wear-leveling process, the bad-block mapping and all related issues (such as folding or garbage collection). The lowest block is the Memory Technology Driver (MTD) layer. It provides the basic read/write/erase interface to DiskOnChip. This unit is controlled by the flash management layer. 7 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00
  • 8. JFFS for Linux JFFS is a Journaling Flash File System developed by Axis Communications in Sweden, connected to flash drivers developed by an open community of Linux developers. It is released under the GPL, and the current version works for the Linux 2.x kernel series and memory- mapped industry-standard flash-memories (aka NOR-flashes). JFFS based drivers are developed and supported by the “community”, however there is no clear testing and support scheme. Using this software is recommended only if you are a Linux expert, know your flash material and can support yourself. No vendor is officially responsible for this solution, thus the various JFFS driver versions suffer from highly volatile reliability issues. Software from Flash Vendors Some flash vendors offer their own flash software. Among the most well-known software is Intel® PSM (Persistent Storage Manager), used within Windows CE devices using NOR flash. Recently, NAND vendors have also started to provide flash software. However, this software was designed for use in removable cards not intended to store code, thus its reliability is questionable. These vendors are experts in making flash, yet lack system level (OS/CPU/bus) integration experience. Software from OS Vendors Most OS vendors provide only partial flash software, if any. Most offer no solution to NAND flash. In fact, alongside their own solutions, most of them offer M-Systems’ TrueFFS. TrueFFS is today offered by Microsoft, Symbian, Wind River, QNX, Palm, Mentor Graphics (Nucleus), as well as many embedded Linux vendors including MontaVista and BlueCat Linux. 8 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00
  • 9. HOW TO CONTACT US USA China M-Systems Inc. M-Systems China Ltd. 8371 Central Ave, Suite A Room 121-122 Newark CA 94560 Bldg. 2, International Commerce & Exhibition Ctr. Phone: +1-510-494-2090 Hong Hua Rd. Fax: +1-510-494-5545 Futian Free Trade Zone Shenzhen, China Phone: +86-755-8348-5218 Fax: +86-755-8348-5418 Japan Europe M-Systems Japan Inc. M-Systems Ltd. Asahi Seimei Gotanda Bldg., 3F 7 Atir Yeda St. 5-25-16 Higashi-Gotanda Kfar Saba 44425, Israel Shinagawa-ku Tokyo, 141-0022 Tel: +972-9-764-5000 Phone: +81-3-5423-8101 Fax: +972-3-548-8666 Fax: +81-3-5423-8102 Taiwan Internet M-Systems Asia Ltd. http://www.m-sys.com Room B, 13 F, No. 133 Sec. 3 Min Sheng East Road General Information Taipei, Taiwan info@m-sys.com R.O.C. Tel: +886-2-8770-6226 Sales and Technical Information Fax: +886-2-8770-6295 techsupport@m-sys.com This document is for information use only and is subject to change without prior notice. M-Systems Flash Disk Pioneers Ltd. assumes no responsibility for any errors that may appear in this document. No part of this document may be reproduced, transmitted, transcribed, stored in a retrievable manner or translated into any language or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual or otherwise, without prior written consent of M-Systems. M-Systems products are not warranted to operate without failure. Accordingly, in any use of the Product in life support systems or other applications where failure could cause injury or loss of life, the Product should only be incorporated in systems designed with appropriate and sufficient redundancy or backup features. Contact your local M-Systems sales office or distributor, or visit our website at www.m-sys.com to obtain the latest specifications before placing your order. ©2003 M-Systems Flash Disk Pioneers Ltd. All rights reserved. M-Systems, DiskOnChip, DiskOnChip Millennium, DiskOnKey, DiskOnKey MyKey, FFD, Fly-By, iDiskOnChip, iDOC, mDiskOnChip, mDOC, Mobile DiskOnChip, Smart DiskOnKey, SuperMAP, TrueFFS, uDiskOnChip and uDOC are trademarks or registered trademarks of M- Systems Flash Disk Pioneers, Ltd. Other product names or service marks mentioned herein may be trademarks or registered trademarks of their respective owners and are hereby acknowledged. All specifications are subject to change without prior notice. 9 Flash Management Software: When, Why and Which?, Rev. 1.0 95-WP-0803-00