2.2. Flash Device Structure

Flash devices are manufactured in many different sizes and with many different block configurations. The flash programmer needs to know the structure of the flash device so that it can correctly partition your data into blocks. You must implement the flashGetBlockStructure() method, returning an array of FlashBlockDesc structures that describes the block structure of your flash device.

The easiest way to describe the block structure of your flash device is to return a pointer to a FlashBlockDesc array that is statically defined in your algorithm, and which is hardcoded with the correct values. This approach works well when you are always using a known flash device because you can look up the necessary values in the flash device datasheet.

An alternative is to query the block structure of your flash device at run-time, for example using the Common Flash Interface (CFI). This approach is more complex to implement, but has the advantage that your algorithm works across a wider range of flash devices without modification. In this case, you must still return a pointer to a statically defined array, because your algorithm cannot rely on having a heap set-up when it is run from the Eclipse Flash Programmer plug-in.

When returning the block structure it is important that you take into account whether your target is using multiple flash devices in parallel. In this case, the flash programmer treats the parallel devices as a single device, so you must calculate the effective block size as being the block size of a single device multiplied by the number of devices in parallel on the bus.

Copyright © 2007. All rights reserved.DAI0190A