beautypg.com

Flash hardware image catalog, Flash hardware image, Catalog – Altera Nios II Embedded Evaluation Kit Cyclone III Edition User Manual

Page 59

background image

B–5

Development Board Version 1.0.

Altera Corporation

Nios II Embedded Evaluation Kit, Cyclone III Edition

July 2010

Flash Hardware Image Catalog

it inspects the .flash file on the SD Card. If the .flash file contains an S0
record on its first line which contains a 32-bit ASCII-encoded number, it
is considered to be a valid timestamp tag.

The Application Selector then scans the flash catalog for entries which
contain a matching timestamp. If a matching timestamp value is found,
then it means the desired hardware image is already stored in flash, and
can be used to directly reconfigure the FPGA without first copying it from
the SD-Card into the flash. For details on the flash catalog, refer to the
section below titled

“Flash Hardware Image Catalog”

.

Flash Hardware
Image

Catalog

The flash hardware image catalog is a simple database which keeps track
of what application hardware images are currently stored (cached) in
flash. The flash catalog is located in sector 1 of the flash at offset 0x8000,
and is 0x8000 (32K) bytes long.

The catalog mechanism uses a scheme referred to as "Zero = Spent, 'F' =
Available", or ZSFA. This scheme avoids erasing entire flash sectors when
only a few words need to be written to the flash. Using ZSFA, a word in
the flash which is 0x0 is considered "spent" and cannot be used to store
data. A word which is 0xFFFFFFFF is "available" since it is in its erased
state. Every other value is considered a valid entry in the catalog.

The way ZSFA works is that whenever a catalog entry needs to be read,
the sector is scanned from its lowest address until the first 0xFFFFFFFF
value is encountered. Every non-zero value encountered along the way is
a valid catalog entry. When a catalog entry needs to be written, the sector
is scanned until the first 0xFFFFFFFF value is found, and the new catalog
entry is written to that offset. To erase a catalog entry, you scan for it in the
sector, then write 0x0 to it to mark it as "spent". The sector(s) containing
the ZSFA catalog only need to be erased once enough data has been
stored there that there are no more “available” entry spots available.

Each flash catalog entry consists of two sequential 32-bit words. The first
word is the 32-bit timestamp value of a hardware image which is
currently in flash. The second word is the 32-bit flash offset of the image
itself. Entries are always created and erased as whole units, two 32-bit

words at a time.