After installing the EPK, Yaffs is added to your eCos repository and is configured and built in the normal way.
To link Yaffs into your application, add CYGPKG_FS_YAFFS to your eCos configuration in the normal way, either using the eCos Configuration Tool (Packages dialog on the Build menu), or the ecosconfig command-line tool.
You will also need to add CYGPKG_IO_NAND and CYGPKG_IO_FILEIO to your configuration if they are not already present. Your platform HAL should supply packages for all NAND device(s) present.
If you started with a smaller template than default, you may also need to add some of the following:
CYGPKG_MEMALLOC or something else which provides CYGINT_ISO_MALLOC
CYGPKG_LIBC_I18N or something else which provides CYGINT_ISO_CTYPE
Yaffs provides a number of package options, including tuning parameters.
These settings allow specific build options to be added to or removed from the CFLAGS list when building Yaffs.
If set, caches files' short names in RAM. This consumes more RAM but improves performance.
Controls whether Yaffs supports setting the
d_typefield in a
struct dirent. If you don't need this, leave it switched off to save a little code size.
The number of blocks to keep in reserve to allow for garbage collection and block failures. The recommended value is 5, but you can tune it for performance. This setting is a global default and may be changed by a mount-time option.
The number of page cache entries to use. Values of 10 to 20 are recommended; increasing the number consumes more RAM, and 0 disables it altogether. This setting is a global default and may be changed by a mount-time option.
This is a 32-bit bitfield which controls diagnostic output. The bit definitions are found in yportenv.h; they are only useful if you are debugging Yaffs itself.
Yaffs requires temporary buffers in many places throughout the code. To avoid the overhead of a dynamic malloc every time, a number of buffers are preallocated at mount time. This setting controls how many; should it not prove enough, Yaffs will call malloc on demand as required. The default setting is 6; most users will not need to change it.
This option only affects behaviour on so-called "small page" NAND devices (those whose pages are 512 bytes long). Such devices do not have enough space in their Out Of Band area to store a full set of Yaffs metadata tags. There are two ways to work around this:
YAFFS2mode - the default - uses regular tags, but at a price: it steals 16 bytes from the available space per page to store them. This reduces the apparent available size of your filesystem by 1/32!
YAFFS1mode places a smaller tagset in the OOB area, but with a different side-effect: whenever a page is deleted, one byte of the tags area has to be rewritten. Some devices forbid rewrite-without-erase in this way, so it may not be safe for you to use this option. You must refer to the spec sheet for the chip on your board before selecting this option!
This causes all YAFFS2 code to be omitted from the build. This option only makes sense when all the devices on which Yaffs is to be used are small-page and operating in YAFFS1 mode.
Note: There is no corresponding option to omit YAFFS1 code, because that code is only compiled when
CYGSEM_FS_YAFFS_SMALLPAGE_MODEis set to YAFFS1.
RedBoot carefully controls the amount of memory available for its heap, allocating it from a fixed-size workspace. If Yaffs is being used with RedBoot, the heap space required is likely to go up substantially. The exact amount depends on properties of the filesystem being mounted. Consult the eCosPro Yaffs documentation for more details of Yaffs' memory requirements. This option ensures RedBoot's heap is increased to a more reasonable size, but it has been made an option in order to allow developers to decrease it, if they are sure the filesystem will not require as much memory as this.
Note: However, note that even this larger amount may not be adequate for some filesystems.