Yaffs claims a 'low memory footprint', but what exactly does that mean? How low is low?
Calculating an exact footprint is no easy task. There are many dependencies. Here is an approximation for Yaffs1 on Linux, assuming the standard block size of 512bytes per page and 16kB per block.
- Code size. This is dependent on various factors including CPU choice, optiomisation options etc. As a rough guide, the yaffs.o Linux module for x86 is around 55kBytes. This could be made smaller by stripping the debug text and ECC code if you don't need that.
- Run-time data structures. Some of these are fixed size and others are generated in runtime and change as your file structures change. As a rough guide though I will give the following:
- Each yaffs partition needs a device structure of less than 1kB + approx 2-4kB stack with the current implementation.
- If shortOpCaches are enabled, then 524 bytes per cache entry (5 to 10 is a good number).
- About 120 bytes per file. (With short name caching enabled)
- About 4 bytes per block of NAND (ie. about 128 bytes per MB of NAND).
- About 4kBytes of RAM per MB of NAND for building the file TNode trees that are used to locate the data chunks.
Thus for a system using a 64MByte NAND and say 500 files you can budget on approx:
- 1) 55kBytes
- 2a) 5kB
- 2b) 3kB (5 cache entries)
- 2c) 60kB
- 2d) 16kB
- 2e) 256kB
The last item, the tnodes, is the biggest expense in Yaffs. This can be reduced significantly by using a larger page size.
There are some opportunities to tune some of these numbers so please feel free to discusss further if required.