Dumb FAT questions

Historically we’ve used the ELM FAT file system.
Would be nicer to use part of FreeRTOS, however…

  1. I read the documentation on FreeRTOS.org, but I don’t see where the application provides a driver. In my case, read/write 512byte blocks via DMA-SPI to a uSD card.

  2. Does anyone know where there’s a feature-comparison table for FreeRTOS FAT and ELM FAT? I see from forum posts that some common stuff we use regularly and need seems to be missing here (read/set volume label, flush)?

  3. How come this page is labeled “TCP/IP parameters”?
    https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_FAT/Embedded_File_System_Configuration.html

Thanks!
Best Regards, Dave

A1) Do the following help?


A2) Hmm, not that I know of, but it would be good to create one.

A3) Woops. Cut and paste bug.

Dumb FAT questions

You’re questions aren’t dumb at all!

I think that the properties of FreeRTOS+FAT are quite comparable with Chan’s FatFs.

FreeRTOS+FAT: the sources are set-up in clear modules, and the source is easy to understand and easy to debug: errors are encoded in a 32-bit value that contains module/function/errno.

It has an interface which is 100% compatible with the standard stdio.h, except for the ff_ prefix:

FF_FILE *ff_fopen( const char *pcFile, const char *pcMode );
size_t ff_fread( void *pvBuffer, size_t xSize, size_t xItems, FF_FILE * pxStream );
size_t ff_fwrite( const void *pvBuffer, size_t xSize, size_t xItems, FF_FILE * pxStream );
int ff_fclose( FF_FILE *pxStream );

It also handles multiple volumes, e.g. an SD-card, a USB drive, plus a RAM disk can all be mounted and mapped onto the root directory:

/usb/film.mp4        <= USB stick
/ram/init.h          <= RAM disk
/websrc/favicon.ico  <= SD-card, default volume

So there is no driver number like in FatFS ( e.g. "2:/init.rc" ), and it does support relative file and directory names ( "../etc/network" )

The volume label is set during formatting, and read while mounting, although it needs a small change.

Adding setVolumeLabel()/getVolumeLabel() would be an easy thing to do.

It does not (yet) support exFAT, for files longer than 64GB. It does support drives larger than 64 GB though, see e.g. the Xilinx Zynq project.

When using FreeRTOS+FAT, you don’t have to worry about flushing data. All is flushed at the moment a file is closed, or when it needs free sector buffers.
If you want earlier, forced flushes, the function FF_FlushCache() can be called.

It also supports Long File Name in ANSI/OEM or Unicode. It has many optimisations, like special caching for directory paths, and hash tables for long directories.

FreeRTOS+TCP is thread-safe using FreeRTOS mutexes, but it can be ported to a different OS ( see ff_locking.c ).

Thanks guys, much appreciated. I did not know to look under “FreeRTOS labs”; perhaps this should be linked from the page referenced in (3) above.
Again, Thanks!
Best Regards, Dave

PS: For many of us out there, it would be great if you could create the comparison table mentioned and sort the volume label stuff. In case you don’t have anything to do :wink: