
80 Chapter 6: Memory
automatically whenever the system is reset; no special initialization sequence is
required to enable reading.
Writing data to a Flash is much harder. Three factors make writes difficult. First,
each memory location must be erased before it can be rewritten. If the old data is
not erased, the result of the write operation will be some logical combination of
the old and new values, and the stored value will usually be something other than
what you intended.
The second thing that makes writes to a Flash difficult is that only one sector, or
block, of the device can be erased at a time; it is impossible to erase a single byte.
The size of an individual sector varies by device, but it is usually on the order of
several thousand bytes. For example, the Flash device on the Arcom board—an
AMD 29F010—has eight sectors, each containing 16 kilobytes.
Finally, the process of erasing the old data and writing the new varies from one
manufacturer to another and is usually rather complicated. These device program-
ming interfaces are so awkward that it is usually best to add a layer of software to
make the Flash memory easier to use. If implemented, this hardware-specific layer
of software is usually called the Flash driver.
Flash Drivers
Because it can be difficult to write data to the Flash device, it often makes sense to
create a Flash driver. The purpose of the Flash driver is to hide