{"id":13812358,"url":"https://github.com/ultraembedded/fat_io_lib","last_synced_at":"2025-05-03T07:31:17.695Z","repository":{"id":81709635,"uuid":"183032881","full_name":"ultraembedded/fat_io_lib","owner":"ultraembedded","description":"Small footprint, low dependency, C code implementation of a FAT16 \u0026 FAT32 driver.","archived":false,"fork":false,"pushed_at":"2019-04-23T15:33:43.000Z","size":62,"stargazers_count":66,"open_issues_count":7,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T13:11:12.234Z","etag":null,"topics":["c-library","fat16","fat32","filesystem","microcontroller"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ultraembedded.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-23T14:29:17.000Z","updated_at":"2025-02-25T17:44:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"0c9e0a11-d71d-4367-9917-468cc835b355","html_url":"https://github.com/ultraembedded/fat_io_lib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultraembedded%2Ffat_io_lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultraembedded%2Ffat_io_lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultraembedded%2Ffat_io_lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultraembedded%2Ffat_io_lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ultraembedded","download_url":"https://codeload.github.com/ultraembedded/fat_io_lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252156886,"owners_count":21703369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-library","fat16","fat32","filesystem","microcontroller"],"created_at":"2024-08-04T04:00:51.108Z","updated_at":"2025-05-03T07:31:17.043Z","avatar_url":"https://github.com/ultraembedded.png","language":"C","funding_links":[],"categories":["Storage"],"sub_categories":["Filesystems"],"readme":"### FAT16/32 File System Library\n\nGithub:   [http://github.com/ultraembedded/fat_io_lib](https://github.com/ultraembedded/fat_io_lib)\n\n#### Intro\n\nDesigned for low memory embedded systems back in 2003, this project is a multi-purpose platform independent C code implementation of a FAT16 \u0026 FAT32 driver with read \u0026 write support.\n\nThe 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.  \nThe 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 \u0026 PIC microcontrollers.\n\nThe source code is available for free under GPL license, or alternatively, with a commercial compatible license for a small donation.\n\nThis library has been used in many open source projects including;\n* Aleph - Open source sound computer.\n* IV:MP - Grand Theft Auto: IV multiplayer game mod.\n* hxcfloppyemu - HxC Floppy Drive Emulator.\n\n#### Features\n\n* Standard file I/O API (fopen(), fread(), fwrite(), etc)\n* FAT16/FAT32 support (read + write)\n* Long filename support (optional)\n* Format function (optional)\n* Directory listing (optional)\n* Buffering \u0026 caching for higher performance (optional)\n\n#### API\n\nThe following file IO API is provided:\n\n* fopen\n* fclose\n* fread\n* fwrite\n* fputc\n* fputs\n* fgetc\n* fflush\n* fgetpos\n* fseek\n* ftell\n* feof\n* remove\n\nJust add sector read \u0026 write functions for the media/platform you are using for a complete file system!\n\n#### Testing\n\nEach release of the project is tested using self verifying test benches to ensure validity and to protect against regressions (not currently released).\n\n#### Commercial\n\nIf you would like to use this code in a commercial project with a closed source compatible license, please contact me.\n\n#### Configuration\nSee the following defines in src/fat_opts.h:\n\n```\nFATFS_IS_LITTLE_ENDIAN \t[1/0]\n  Which endian is your system? Set to 1 for little endian, 0 for big endian.\n\nFATFS_MAX_LONG_FILENAME\t[260]\n  By default, 260 characters (max LFN length). Increase this to support greater path depths.\n\nFATFS_MAX_OPEN_FILES \t\n  The more files you wish to have concurrently open, the greater this number should be.\n  This increases the number of FL_FILE file structures in the library, each of these is around 1K in size (assuming 512 byte sectors).\n\nFAT_BUFFER_SECTORS\n  Minimum is 1, more increases performance.\n  This defines how many FAT sectors can be buffered per FAT_BUFFER entry.\n\nFAT_BUFFERS\n  Minimum is 1, more increases performance.\n  This defines how many FAT buffer entries are available.\n  Memory usage is FAT_BUFFERS * FAT_BUFFER_SECTORS * FAT_SECTOR_SIZE\n\nFATFS_INC_WRITE_SUPPORT\n  Support file write functionality.\n\nFAT_SECTOR_SIZE\n  Sector size used by buffers. Most likely to be 512 bytes (standard for ATA/IDE).\n\nFAT_PRINTF\n  A define that allows the File IO library to print to console/stdout. \n  Provide your own printf function if printf not available.\n\nFAT_CLUSTER_CACHE_ENTRIES\n  Size of cluster chain cache (can be undefined if not required).\n  Mem used = FAT_CLUSTER_CACHE_ENTRIES * 4 * 2\n  Improves access speed considerably.\n\nFATFS_INC_LFN_SUPPORT \t[1/0]\n  Enable/Disable support for long filenames.\n\nFATFS_DIR_LIST_SUPPORT \t[1/0]\n  Include support for directory listing.\n\nFATFS_INC_TIME_DATE_SUPPORT  [1/0]\n  Use time/date functions provided by time.h to update creation \u0026 modification timestamps.\n\nFATFS_INC_FORMAT_SUPPORT\n  Include support for formatting disks (FAT16 only).\n\nFAT_PRINTF_NOINC_STDIO\n  Disable use of printf \u0026 inclusion of stdio.h\n```\n\n\n#### Interfacing to storage media\n```\n-----------------------------------------------------------------\nint media_read(uint32 sector, uint8 *buffer, uint32 sector_count)\n-----------------------------------------------------------------\nParams:\n    Sector: 32-bit sector number\n    Buffer: Target buffer to read n sectors of data into.\n    Sector_count: Number of sectors to read\n\nReturn: \n    int, 1 = success, 0 = failure.\n\nDescription:\n    Application/target specific disk/media read function.\n    Sector number (sectors are usually 512 byte pages) to read.\n\n-----------------------------------------------------------------\nint media_write(uint32 sector, uint8 *buffer, uint32 sector_count)\n-----------------------------------------------------------------\n\nParams:\n    Sector: 32-bit sector number\n    Buffer: Target buffer to write n sectors of data from.\n    Sector_count: Number of sectors to write.\n\nReturn: \n    int, 1 = success, 0 = failure.\n\nDescription:\n    Application/target specific disk/media write function.\n    Sector number (sectors are usually 512 byte pages) to write to.\n\n\n-----------------------------------------------------------------\nUse the following API to attach the media IO functions to the File IO library;\n\nfl_attach_media(media_read, media_write);\n```\n\n#### History\n\n* v2.6.11 - Fix compilation with GCC on 64-bit machines\n* v2.6.10 - Added support for FAT32 format.\n* v2.6.9 - Added support for time \u0026 date handling.\n* v2.6.8 - Fixed error with FSINFO sector write.\n* v2.6.7 - Added fgets(). Fixed C warnings, removed dependency on some string.h functions.\n* v2.6.6 - Massive read + write performance  improvements.\n* v2.6.5 - Bug fixes for big endian systems.\n* v2.6.4 - Further bug fixes and performance improvements for write operations.\n* v2.6.3 - Performance improvements, FAT16 formatting support. Various bug fixes\n* v2.6 - Basic support for FAT16 added\n* v2.5 - Code cleaned up. Many bugs fixed. Thread safety functions added.\n* v2.x - Write support added as well as better stdio like API.\n* v1.0 - Rewrite of all code to enable multiple files to be opened and provides a better file API.\n* v0.1b - fopen(), fgetc(), fopenDIR() using new software stack for IDE drives and FAT32 access.\n* v0.1a - First release; fopen(), fgetc() unbuffered reads.... (27/12/03)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultraembedded%2Ffat_io_lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultraembedded%2Ffat_io_lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultraembedded%2Ffat_io_lib/lists"}