内容简介 :
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........