NOR devices, no matter what attachment interface (serial or parallel), share certain characteristics. The medium is always organized into units (called blocks) which are erased at the same time; when erased, all bits are 1. Only an erase operation can change a bit from a 0 to a 1, but any bit can be individually programmed from a 1 to a 0. The μC/FS driver requires that any 2-byte word can be individually accessed (read or programmed).
The driver RAM requirement depends on flash parameters such as block size and run-time configurations such as sector size. For a particular instance, a general formula can give an approximate:
where
secs_per_blk
The number of sectors per block.
blk_cnt_used
The number of blocks on the flash which will be used for the file system.
sec_cnt
The total number of sectors on the device.
sec_size
The sector size configured for the device, in octets.
secs_per_blk
and sec_cnt
can be calculated from more basic parameters :
where
blk_size
The size of a block on the device, in octets
Take as an example a 16-Mb NOR that is entirely dedicated to file system usage, with a 64-KB block size, configured with a 512-B sector. The following parameters describe the format :
and the RAM usage is approximately
In this example, as in most situations, increasing the sector size will decrease the RAM usage. If the sector size were 1024-B, only 5188-B would have been needed, but a moderate performance penalty would be paid.