Petit FatFs Module Application Note

Basic Considerations

The FatFs module is assuming following conditions on portability.

Memory Usage (R0.02a)

Code (default)21001720
Code (!_USE_READ)-444-246
Code (_USE_DIR)+1002+420
Code (_USE_LSEEK)+490+228
Code (_USE_WRITE)+518+351
RAM (bss)24
RAM (work)4244

This is the size of the Petit FatFs module itself. In addition to this, a low level disk I/O module will be required for a complete function. The size of MMC/SDC module on AVR becomes approximate 620 bytes without write function and 840 bytes with write function.

Module Size Reduction

Follwing table shows which function is removed by configuration options for the module size reduction.


Performance effective file access

For good performance on reading a file on the small embedded system, application programmer should consider what process is done in the file system module.

The Petit FatFs reads the disk sectors without a sector buffer. This means the file system reads a part of the sector contains the required data every reference point even if they are in the same sector. However the generic storage device are not byte addressable so that the disk I/O layer will read the entire sector and pick up the data bytes from the read data steram.

When read 512 byte data from a file at a time, the data sector will be read only a time. When read that data in byte-by-byte, the data sector will be read 512 times. Therefore the byte-by-byte read request will drastically decrease the read performance. To avoid this stupid read controls, the file data should be read in long block as possible. Sector alignment access is not impotant on the Petit FatFs.

The tiny microcontrollers targeted by Petit FatFs has a limited size of RAM. It may not able to allocate a certain size of read buffer and most type of text processing will require byte-by-byte read operation. The Petit FatFs supports data forwarding feature for such purpose.

About Petit FatFs License

This is a copy of the Petit FatFs license document that included in the source codes.

/  Petit FatFs - FAT file system module  R0.02a                (C)ChaN, 2010
/ Petit FatFs module is an open source software to implement FAT file system to
/ small embedded systems. This is a free software and is opened for education,
/ research and commercial developments under license policy of following trems.
/  Copyright (C) 2010, ChaN, all right reserved.
/ * The Petit FatFs module is a free software and there is NO WARRANTY.
/ * No restriction on use. You can use, modify and redistribute it for
/   personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
/ * Redistributions of source code must retain the above copyright notice.

Therefore Petit FatFs license is one of the BSD-style license but there is a big difference. Because Petit FatFs is for embedded projects, the conditions for redistributions in binary form, such as embedded code, hex file and binary library, are not specified to increase its usability. The documentation of the distributions need not include about Petit FatFs and its license document, and it may also. Of course Petit FatFs is compatible with the projects under GNU GPL.