434
Platforms
©2000-2008 Tibbo Technology Inc.
Sharing Flash Between Your Application and Data
The .fd object uses the same physical flash chip that stores the firmware of your
device, as well as your Tibbo Basic application. The flash memory consists of 264-
byte sectors. It is customary to use 256 bytes of each sector to store actual data,
and reserve the rest for "service" data, such as the checksum.
All flash sectors that are not occupied by the firmware/application are available for
storing your data. We will refer to this area as a "data area". The size of the data
area, in sectors, can be obtained through the
R/O
property.
There are two ways in which you can use the data area of the flash chip.
The first way is to read and write flash sectors of the data area directly -- a so-
called
. This method is simple and allows you to "do
whatever you please" with the data area you have.
The second way is
-- you create a full-blown flash disk that maintains
a simple file system. This introduces a certain overhead, since the file system
needs a number of sectors for its own internal "housekeeping". At the same time,
using files may be infinitely more convenient as many complex operations happen
automatically and on the background, thus simplifying your application.
Both the direct sector access and file based access can be used at the same time --
your flash disk can occupy only a portion of the data area, and the rest of the
space can be used for direct sector access.
The fd. object refers to physical sectors of the data area in reverse. While the
firmware and application are loaded into the flash memory starting from physical
sector 0, the allocation for the data area starts from the topmost physical sector
(see the drawing below). For convenience, related methods and properties of the .
fd object refer to this topmost physical sector as (logical) sector #0, the sector
before the topmost sector -- as #1, and so on.
457
448
436