rtel wrote on Thursday, August 01, 2013:
As far as an interface to the file system is concerned, you do just have to provide the functions specified on the link you reference in your post. How those functions are implemented depends on the media you are writing to (RAM, NAND flash, NOR flash, SD card, etc.) - so I think your question is related to media drivers rather than the file system itself?
The file system is provided with a RAM disk driver because it is extremely portable, and can be executed on anything that has sufficient RAM. As soon as you move this to any other media it starts to get more application specific.
Taking an SD card as an example media, and F_WRITESECTOR() as an example function:
The RAM disk has a block of memory that is, in fact, just an array of RAM. An SD card has a virtual block of memory that is on the SD card itself.
If you look at the RAM disk F_WRITESECTOR() function you will see that it calculates the address of the start of the sector to be written to simply by offsetting it from the start address, and then writes to that address byte for byte (in effect doing a memcpy() from source to destination).
The SD card equivalent can calculate the address in a similar manner, but writing to the SD card is not just a matter of performing a memcpy(). It will require a peripheral (MMC/SPI) to actually write the bytes, and software to control the write protocol. The write protocol is the sequence necessary to write to the card, set the chip select, reset the card, put the card into the mode required (if SPI mode), wait for the SD card to be idle, address the card, write the bytes, get acks/nacks back, CRC, etc, etc.
How to write to an SD card is specified in the SD specification, and you can find lots of references (e.g. http://www.cs.ucr.edu/~amitra/sdcard/Additional/sdcard_appnote_foust.pdf) and examples by Googling for “SD card software interfacing”. Wikipedia has more references than possible to read in a lifetime. https://en.wikipedia.org/wiki/Secure_Digital
You can of course purchase drivers too.
If you were to use some other flash technology, then you would have to write a media driver for that in the same way.
Does this go some way to answering your question.
Regards.