Integrating a file system

colin_stanley wrote on Wednesday, December 06, 2006:

I’m looking for a few pointers or suggestions on the best way to implement a file system to Freertos. I have version 4.1.3 successfully running with the lwip stack on an AT91SAM7X board. All works well. I’ve ported over the EFSL FAT library, and all seems to work well with flash cards over SPI in a stand alone mode. My questions is how to best integrate this within the OS. I can see several ways to go about this, but is there a prefered or recommended method. Should the file system be a separate task, or a shared resource (in which case anyone know if EFSL is reentrant?). Since I would like any running task to access a file, I assume there should be some type of queue on requests to open files. Then on the back end the file system needs to wait for the SPI DMA to complete, is this best done with semaphores or another queue?. Anyone have any thoughts or pointers or been down this path before.

Colin

nobody wrote on Wednesday, December 06, 2006:

I think it depends a lot on whether or not your file system (EFSL) is designed to be re entrant or not.  If you opened two files from two different tasks causes it to corrupt, then you are going to need some form of gate keeper task - a task that handles all file IO.  The implementation of this in turn depends on whether your application requires blocking reads and writes.

The ideal solution would be to have the mutual exclusion only around access to the hardware.  For example the SPI bus if using an SD card. And have the rest of the code re entrant.  Then only blocks occur when accessing the actual hardware.

jra01 wrote on Tuesday, January 09, 2007:

I am using FreeRTOS and efsl on a relatively small (1 MB) SPI flash for some time, with the following experience:
-I use a semaphore to make sure only one is using the file system at a time. The efsl functions are not reentrant.
-I suspect there are problems keeping files open and letting others access the file system. I am not sure about this, but until now I always close a file before leaving the semaphore. I would be interested in other experiences around this.
-It looks like development has stopped for this fs? Very little activity on their forum and home page. Does anyone know another good file system?

Regards

Jokke