It is possible to link YAFFS into RedBoot and use it to boot an
executable image stored on a NAND array.
This is done by configuring and building RedBoot largely in the normal way.
You will need to add CYGPKG_FS_YAFFS and
CYGPKG_IO_FILEIO to your configuration, plus their
attendant dependencies.
The presence of CYGPKG_IO_FILEIO activates the fs series
of RedBoot commands. The following (edited) transcript illustrates how
they might
be used in concert with other RedBoot commands to store an ELF image on
a NAND partition, load it back and execute:
Note: When you command RedBoot to execute an image, it
first synchronises all mounted filesystems. Therefore,
provided these filesystems support the synchronisation operation
(which YAFFS does), it is not always necessary to unmount them before
invoking an image.
RedBoot traditionally has very limited requirements for memory management;
the main need is for there to be free space in RAM at the correct
(physical) address to load an image before jumping to it.
Introducing YAFFS brings with it not just the need to have dynamically
allocatable RAM (CYGPKG_MEMALLOC), but enough
to replay the filesystem journal. This must be balanced against the need
for RAM to load images into.
When the CYGPKG_MEMALLOC package is present in
RedBoot, by default a small (64k) heap is set up so that the maximum RAM
possible is available for loading images. This is not enough to
support YAFFS in any circumstances, so the following definition has
been included in the yaffs.cdl file:
This declaration only provideds the bare minimum heap required to mount a
trivial YAFFS filesystem. More will be required for all but the simplest
of cases and it is recommended that you test for typical use in your
environment. Refer also to the Section called Memory requirements in Chapter 48.
It is recommended that, should you wish to make a filesystem usable by
RedBoot, your platform HAL should make a similar
declaration in its CDL to establish an appropriate heap size.
For example, the platform HAL for the EA LPC2468 OEM board - which has
a 128MB NAND chip on-board - contains the following declaration:
Tip: If you wish to experiment with restricted heaps to determine
much memory your application actually uses under YAFFS,
you may find the option
CYGSEM_MEMALLOC_INVOKE_OUT_OF_MEMORY of use.