{"id":13812407,"url":"https://github.com/rickyzheng/uffs","last_synced_at":"2025-05-14T22:30:41.597Z","repository":{"id":6636704,"uuid":"7880715","full_name":"rickyzheng/uffs","owner":"rickyzheng","description":"UFFS - Ultra low cost Flash File System","archived":false,"fork":false,"pushed_at":"2021-03-18T22:01:55.000Z","size":6493,"stargazers_count":47,"open_issues_count":6,"forks_count":25,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-19T07:38:46.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rickyzheng.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-28T22:43:27.000Z","updated_at":"2024-11-11T17:14:10.000Z","dependencies_parsed_at":"2022-08-26T08:11:58.740Z","dependency_job_id":null,"html_url":"https://github.com/rickyzheng/uffs","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyzheng%2Fuffs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyzheng%2Fuffs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyzheng%2Fuffs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyzheng%2Fuffs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickyzheng","download_url":"https://codeload.github.com/rickyzheng/uffs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254239441,"owners_count":22037710,"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":[],"created_at":"2024-08-04T04:00:51.623Z","updated_at":"2025-05-14T22:30:37.780Z","avatar_url":"https://github.com/rickyzheng.png","language":"C","funding_links":[],"categories":["Storage"],"sub_categories":["Filesystems"],"readme":"UFFS: Ultra-low-cost Flash File System\n\nProject: http://uffs.sf.net/\nBlog:    http://all-about-uffs.blogspot.com/\nQ/A:     http://groups.google.com/group/uffs/\n\nAuthor: Ricky Zheng \u003cricky_gz_zheng@yahoo.co.nz\u003e\n\nINTRODUCTION\n------------\n\nUFFS is a nand flash file system designed for embedded system.\n\nUFFS have some unique and advanced features:\n\n  * Low cost: e.g. it needs only 41K bytes RAM for 64MB NAND flash (page size 2048).\n    \n  * Fast booting: it reads only a few spares from each block, typically\n    mounting a fully filled file system (Gbits) within one second.\n    \n  * Superb Reliability: \n    - The file system is designed for the embedded system which may \n        frequently lost power/reset without care.\n    - Journal file system, the file system will automatically rollback\n        to the last state when lost power on the middle of flash programing.\n    - When 'write' return without error, the data is guarenteed been\n        saved on flash.\n\n  * Fast file create/read/write/seek.  \n  * Bad-block tolerant, ECC enable and good ware-leveling.\n  * There is no garbage collection needed for UFFS.\n  * Support multiple NAND flash class in one system.\n  * Support bare flash hardware, no operating system needed. \n  * Support static memory allocation (works without 'malloc').\n  * Fully simulated on PC (Windows/Linux) platform.\n\nDisadvantage:\n\n  * space inefficency for small files: UFFS use at least one\n   'block'(the minial erase unit for NAND flash, e.g. 16K ) for a file.\n  * maximum supported blocks: 2^16 = 65535\n\nMemory consuming example:\n\n    For page size = 512:\n        [VARY]Tree nodes: 16 * total_blocks \n        [CONST]Page Bufs: MAX_CACHED_BUFFERS(10) * (40 + pageSize(512)) = 5.4K \n        [CONST]Block Info caches: (24 + 14 * pages_per_block (32)) * MAX_CACHED_BLOCK_INFO (10) = 4.6K\n\n        Example 1: 128M bytes NAND, 8192 blocks, total memory cost:\n            (16 * 8192)128K + 5.4K + 4.6K = 138K bytes.\n\t\t\n        Example 2: 32M Bytes NAND, 2048 blocks, total memory cost:\n            (16 * 2048)32K + 5.4K + 4.6K = 42K bytes.\n\t\t\n        Example 3: 16M bytes NAND, 1024 blocks, total memory cost:\n            (16 * 1024)16K + 5.4K + 4.6K = 26K bytes.\n\n    For page size = 2048:\n        [VARY]Tree nodes: 16 * total_blocks \n        [CONST]Page Bufs: MAX_CACHED_BUFFERS(10) * (40 + pageSize(2048)) = 20.4K \n        [CONST]Block Info caches: (24 + 14 * pages_per_block (32)) * MAX_CACHED_BLOCK_INFO (10) = 4.6K\n\n        Example 1: 512M bytes NAND, 8192 blocks, total memory cost:\n            (16 * 8192)128K + 20.4K + 4.6K = 153K bytes.\n\t\t\n        Example 2: 128M Bytes NAND, 2048 blocks, total memory cost:\n            (16 * 2048)32K + 20.4K + 4.6K = 57K bytes.\n\t\t\n        Example 3: 64M bytes NAND, 1024 blocks, total memory cost:\n            (16 * 1024)16K + 20.4K + 4.6K = 41K bytes.\n            \n\nBUILD SIMULATOR REQUIREMENT\n---------------------------\nFrom V1.2.0, build uffs simulator requires 'cmake'.\n'cmake' can be downloaded from: http://www.cmake.org/\n\nor, under Debian/Ubuntu:\n  sudo apt-get install cmake\n\nBUILD SIMULATOR ON LINUX\n------------------------\n1) create a 'build' dir:\n\nmkdir -p ~/build/uffs\n\n2) create Makefiles and build:\n  cd ~/build/uffs\n  cmake \u003cpath_to_uffs\u003e\n  make\n\n5) run simulator (interactive mode):\n  src/utils/mkuffs\n \n \nBUILD SIMULATOR ON WINDOWS\n--------------------------\n\n1) create a 'build' dir along with uffs source dir,\n d:\\build\\uffs\n\n2) Create VC project files:\n  cd build\\uffs\n  cmake \u003cpath_to_uffs\u003e\n\n3) Open uffs.dsw (or uffs.sln for VC \u003e 6 ), compile \u0026 run.\n\n \nLATEST SOURCE CODE\n------------------\nYou can get the latest source code from git repository:\n  git clone git://uffs.git.sourceforge.net/gitroot/uffs/uffs\n\n\nCURRENT STATUS\n--------------\nUFFS 0.1.x is a working version on PC simulator, also has been ported to \nuBase embedded OS as a 'real world' product for thousands of copies,\nit works fine so far.\n\nUFFS 0.2.0 implementes full directory.\n\nUFFS 1.0.0 is the first stable release at sf.net.\n\nUFFS 1.1.0: support NAND flash with large page size (up to 2K).\n\nUFFS 1.1.1: bug fixes. a tool for making uffs disk image.\n\nUFFS 1.1.2: bug fixes. add more Flash Class. change Licence from GNU GPLv2 to GNU LGPLv2\n\nUFFS 1.2.0: \n  - eliminate 'current path' and relatives. Now you should use absolute path in all\n    uffs APIs. For dir, the fullname should end with '/'.\n  - allow using static memory allocation, 'malloc' is no longer needed.\n  - using cmake for building simulator.\n  - bug fixes \u0026 minor changes.\n\nUFFS 1.2.1:\n  - improve bad block management\n  - bug fixes\n  - change Licence to modified GNU GPLv2.\n\nUFFS 1.3.0:\n  - improved flash interface\n  - support hardware ECC\n  - support user defined spare layout (for customized NAND flash controller)\n  - support 4K page size\n  - no partial page program required, support MLC NAND flash\n  - reduced buffer flushes by grouping buffers\n  - structual improvments and bug fixes\n  \nUFFS v1.3.1:\n  - Tidy up three memory allocators: static, native and system.\n  - Fix bugs in flash interface example.\n  - Fix memory allocation bugs when using static memory allocator.\n  - Add flash driver interface 'WriteFullPage()'.\n  - Fix compilation errors for BlackFin DSP compiler.\n\nUFFS v1.3.2:\n  - Add POSIX like file system APIs.\n  - Bug fixes.\n  \nUFFS v1.3.3:\n  - Change Flash Interface, simplify interface.\n  - Improved bad block handling.\n  - Better support for MLC NAND flash.\n  - Added hardware ECC and RS-ECC controller emulator.\n  - Bug fixes.\n\nUFFS v1.3.4\n  - New UO_NOECC option for skipping ECC (fast reading).\n  - POSIX compliance uffs_seek().\n  - Improved unclean page detection (add new 'seal' byte in spare area).\n  - Optional page data CRC.\n  - Bug fixes.\n  - Other improvements.\n\nUFFS v1.3.5\n  - Code directory structure changed\n  - Improved platform independency\n  - Fixed unclean page tag not expired bug\n  - Added test server/client, reuse sqlite test suite\n  - Allow fine tuning uffs config per device in run-time\n  - Prevent a file in use from being deleted\n  - Deleting file/dir now atomic\n  - Fixed flush issue when CONFIG_FLUSH_BUG_AFTER_WRITE config enabled\n  - Fixed truncating small file bug\n  - Many small improvements\n\nUFFS v1.3.6\n  - Removed unnecessary semaphore creations\n  - Use a seperated list for clone buffers\n  - Improved bad block handling\n  - Fixed bugs:\n    * tree node broken when mounting uffs and there are unclean nodes\n    * flash op result (UFFS_FLASH_ECC_OK) could be overwritten by following page\n    * uffs_ftrancate() not able to expand file bug\n  - Many other small improvements\n\n \n  \nLICENCE\n-------\n  From v1.2.1, UFFS is released under a modified GNU GPLv2. (the same as eCos Licence)\n  The full licence text can be found in the header of source files:\n  \n\t  UFFS is free software; you can redistribute it and/or modify it under\n\t  the GNU Library General Public License as published by the Free Software \n\t  Foundation; either version 2 of the License, or (at your option) any\n\t  later version.\n\n\t  UFFS is distributed in the hope that it will be useful, but WITHOUT\n\t  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n\t  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\n\t  or GNU Library General Public License, as applicable, for more details.\n\t \n\t  You should have received a copy of the GNU General Public License\n\t  and GNU Library General Public License along with UFFS; if not, write\n\t  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n\t  Boston, MA  02110-1301, USA.\n\n\t  As a special exception, if other files instantiate templates or use\n\t  macros or inline functions from this file, or you compile this file\n\t  and link it with other works to produce a work based on this file,\n\t  this file does not by itself cause the resulting work to be covered\n\t  by the GNU General Public License. However the source code for this\n\t  file must still be made available in accordance with section (3) of\n\t  the GNU General Public License v2.\n\t \n\t  This exception does not invalidate any other reasons why a work based\n\t  on this file might be covered by the GNU General Public License.\n\n\nTESTING UFFS WITH SQLITE3 REGRESSION TEST CASES\n-----------------------------------------------\nUFFS can be tested with sqlite3 regression test cases (on Linux).\n\n1) install tcl8.5-dev on host PC:\n\tapt-get install tcl8.5 tcl8.5-dev\n\n    # make sure your Linux is using tcl8.5 as the default tclsh:\n\t\tsudo update-alternatives --config tclsh\n\t\t(select \"tclsh8.5\" from the list.)\n\n2) build uffs:\n\tmkdir -p ~/build/uffs\n\tcd ~/build/uffs\n\tcmake \u003cpath_to_uffs\u003e\n\n3) build sqlite3:\n\tcd \u003cpath_to_uffs\u003e/src/test/sqlite3/sqlite-src-3070900\n\t./configure        \t\t\t\t\t # create some build support files\n\tgit checkout -f Makefile config.h    # restore modified Makefile and config.h\n\tmake test                            # start build 'testfixture' program.\n\t\n\t# now you'll see something like:\n\tConnect: Connection refused\n\tAssert (uffs_ret == ret \u0026\u0026 ret == bak_ret) fail at /home/.../src/test/api_test/os_uffs.c:os_unlink:329: unlink(\"/home/.../src/test/sqlite3/sqlite-src-3070900/./test.db-journal\"), unix return 0, uffs return -1, bak return -1\n\tmake: *** [test] Error 1\n\n4) run test cases:\n\tOpen two terminals.\n\ton termional A:\n\t\tcd ~/build/uffs\n\t\tsrc/utils/mkuffs -t 1024\n\n\t\t#on uffs simulator command line, enter:\n\t\tformat /\n\t\tapisrv\n\n\ton terminal B:\n\t\tcd \u003cpath_to_uffs\u003e/src/test/sqlite3/sqlite-src-3070900\n\t\t./test-uffs.sh\n\n\tNote: if you want to run mkuffs on another PC, for example, a Windows PC, you need to specify the IP address in test-uffs.sh.\n\t\n\tThe test will take 1~4 hours, depends on how fast your Linux box is.\n\n\nACKNOWLEDGMENT\n---------------\nSpecial thanks for your contributions to:\n(list in no particular order)\n\n* Chen Jun \u003cchj@nlscan.com\u003e\n* Michail \u003cdigiolog@mail.ru\u003e\n* Sjpu \u003csjpu@163.com\u003e\n* RobertGray \u003cxennex@hotmail.com\u003e\n* Dongbo \u003cdongbo@ftsafe.com\u003e\n* Cag \u003cseucag@hotmail.com\u003e\n* Sergey \u003cs_sazonov@m2m-t.ru\u003e\n* Chris Conrad \u003cchris.conrad@halliburton.com\u003e\n* Vladimir \u003cdecoder@rambler.ru\u003e\n* Thien Pham \u003cthienpham2008@yahoo.com\u003e\n* Emmanuel Blot \u003ceblot.ml@gmail.com\u003e\n* Michael \u003cyowong2@gmail.com\u003e\n* Mick D \u003cmick-eng@sourceforge.net\u003e\n* Paul \u003cpaulr227@gmail.com\u003e\n* Rogerz \u003crogerz.zhang@gmail.com\u003e\n* Savin Zlobec \u003csavin.zlobec@gmail.com\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyzheng%2Fuffs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickyzheng%2Fuffs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyzheng%2Fuffs/lists"}