Intro
Designed for low memory embedded systems, this project is a multi-purpose platform independent C code implementation of a FAT16 & FAT32 driver with read & write support.
The library provides stdio like interface functions such as fopen(), fgetc(), fputc(), fread(), fwrite() etc, allowing existing applications to be ported easily using a familiar API.
The project is aimed at applications which require file system support such as MP3 players, data loggers, etc and has a low memory footprint with customizable build options to enable it to run on platforms such as the Atmel AVR, ARM & PIC microcontrollers.
The source code is available for free under GPL license, or alternatively, with a commercial compatible license for a small donation to the project.
Features
- Standard file I/O API (fopen(), fread(), fwrite(), etc)
- FAT16/FAT32 support (read + write)
- Long filename support (optional)
- Format function (optional)
- Directory listing (optional)
- Optional buffering & caching for higher performance
- Open source (Free!)
API
The following file IO API is provided:
- fopen
- fclose
- fread
- fwrite
- fputc
- fputs
- fgetc
- fflush
- fgetpos
- fseek
- ftell
- feof
- remove
Just add sector read & write functions for the media/platform you are using for a complete file system!
Testing
Each release of the project is tested using self verifying test benches to ensure validity and to protect against regressions.
Commercial
If you would like to use this code in a commercial project with a closed source compatible licence, please contact me…
History
V2.6.6 – Massive read + write performance improvements. (30-07-10)
V2.6.5 – Bug fixes for big endian systems. (08-07-10)
V2.6.4 – Further bug fixes and performance improvements for write operations. (29-06-10)
V2.6.3 – Peformance improvements, FAT16 formatting support. Various bug fixes (25-05-10)
V2.6 – Basic support for FAT16 added (18-04-10).
V2.5 – Code cleaned up. Many bugs fixed. Thread safety functions added (01-03-10)
V2.x – Write support added as well as better stdio like API (07-04-07)
V1.0 – Rewrite of all code to enable multiple files to be opened and provides a better file API (29-09-06)
V0.1b – fopen(), fgetc(), fopenDIR() using new software stack for IDE and FAT32 access (17/01/04)
V0.1a – First release; fopen(), fgetc() unbuffered reads…. (27/12/03)
Man, thanks a lot for you great library (:
I tested about a half of dozen of libraries for FAT32, and none of them worked correctly (if ever worked), but your library required just 2 functions and it’s easy to use. Great job!
Hi there,
I am interested in using this library for a project I am working on which uses Cypress’ Programmable System on Chip 5 (PSoC 5). This chip contains on it an ARM Cortex-M3 processor which this library claims to support. Unfortunately, I am quite inexperienced with incorporating libraries such as this onto a design. Could you perhaps point me in the direction of some useful material which would allow me to easily configure the PSoC to support this library?
The PSoC has its own IDE called PSoC Creator, which also supports the schematic design of the surrounding logic of the chip. One of the components supported by it is an SPI data transfer component, should I use this or is the SPI transfer dealt with in this library (thus requiring me to simply configure a few input/output pins on the chip)?
Thank you for your time,
Cian O’Mahony
Thank you very much for providing this code. It will save me a lot of time.
I wanted to throw my thanks out there too. This is a wonderful library that is easy to use and works as documented. Thanks for putting it out here for general consumption. I didn’t have any issues getting it to work with my mcu or media drivers.
Thanks!
I was looking for that library few days.
Great job!
Great job
)
Ported it for my NIOS processor in 2 hours, only needed to hook my SPI routines.
Works like a charm.
Many thanks.