Configuring the FAT Filesystem

Once added to the configuration, the FAT filesystem has a number of configuration options:

CYGNUM_FS_FAT_NODE_HASH_TABLE_SIZE

This option controls the number of slots in the hash table used to store file nodes using filenames as keys.

Default value: 32

CYGNUM_FS_FAT_NODE_POOL_SIZE

This option controls the size of the node pool used for storing file nodes. This value should be set to the maximum required number of simultaneously open files plus the desired size of unused node cache.

Default value: CYGNUM_FILEIO_NFILE + 2

CYGNUM_FS_FAT_BLOCK_CACHE_BLOCKSIZE

This option controls the size of blocks in the block cache. This value should be a power-of-2 multiple of 512. It must be at least as great as the underlying disk sector size (usually 512) but can be greater, allowing multiple underlying blocks to be cached within a single cache block.

With some underlying disk devices, performance can be greatly improved by increasing the size of this option, as it may allow multiple disk blocks to be transferred in one transaction. This is known to be particularly true with MMC or SD card media and it is recommended to increase the size of this option with such media.

Default value: 512

CYGNUM_FS_FAT_BLOCK_CACHE_MEMSIZE

This option controls the amount of memory used for the block cache.

Default value: 20 * CYGNUM_FS_FAT_BLOCK_CACHE_BLOCKSIZE

CYGDBG_FS_FAT_NODE_CACHE_EXTRA_CHECKS

This option controls the inclusion of extra sanity checks in node cache code.

Default value: 1

CYGCFG_FS_FAT_USE_ATTRIBUTES

This option controls whether the FAT filesystem supports or honors the FAT filesystem file attributes.

Default value: 0

CYGCFG_FS_FAT_LONG_FILE_NAMES

This option controls the FAT filesystem support for long file names.

Default value: 0

CYGNUM_FS_FAT_LONG_FILE_NAME_MAX

This option defines the maximum size of long file names supported by the filesystem. The default value of 64 corresponds to NAME_MAX, which defines the size of d_name[] in a struct dirent.

Default value: 64

CYGSEM_FS_FAT_ASYNC_IO

Normally every operation on a mounted FAT filesystem must complete before another operation can start. However sometimes a thread must block while waiting for a read or write to the underlying disk medium to complete. As a performance improvement, this option allows other threads to perform operations on the FAT filesystem while other threads are blocked. This can be especially beneficial when the operations can be performed entirely using the in-built file system block and node cache.

However, a known limitation is that there is not currently sufficient protection in place to handle situations where two threads update a directory at the same time, for example, both creating, renaming or removing files or directories (Issue #1001183). Other operations should be safe, but for the time being care is advised if enabling this option, and eCosCentric cannot provide support for resulting problems if it is enabled.

Default value: 0

CYGSEM_FS_FAT_FORMAT

This option enables support for formatting a FAT filesystem on the device before mounting it. Only FAT16 and FAT32 formats are supported, FAT12 is not. The variety of options supported is also limited to choosing the format, block size, and volume label, where appropriate.

Default value: 1

Normally these options should be left as they are unless you have a specific need to change them. Once the configuration had been created, it should be possible to compile eCos and link it with the application without any errors.

2017-02-09
Documentation license for this page: eCosPro License