In very small devices, there is often not even the possibility to add a normal (parallel) NVM memory to store various data and information.
A very small file system for serial NVM storage devices would be the right solution.
Running FAT-FileSystems on these very small memory is possible, but it can cost a lot of code- and RAM-memory.
The (small) Serial-File-System presented here is based on simple concatenated blocks whose elements (DIR / FILE) are referenced by a 32bit hash of their name and where the number of max. entries per directory must be defined. By using a 32bit hash as a name, the file system can be massively simplified, but there are therefore no references to the names of the entries. The hash of each entry must be unique within its directory. Since a 32bit hash value can not be guaranteed to be unique in itself - that is, if two names have the same hash value - several 32bit hash algorithms are usable, but the selection must be set at compile time.
This file-system handles all names of directories/files as hash over a STRING, so special characters can be used in the names.
.. - one directory back
/ - on the beginning of the Path: for from ROOT
./ - on the beginning of the Path: for from current DIR (optional)
/ - in middle of the Path: as separation for directory/file-names
The whole file-system works case-sensitive !
Various serial NVM memory devices (SPI & I2C) are tested as hardware (MRAM, FRAM, ReRAM, EEPROM). Additional the file system can run too on parallel memory like RAM, FRAM, MRAM or EEPROM. Ideal are all types that support byte-wise writing by internal buffering of sectors/pages, but this can also be done by the low-level hardware driver.
The use of serial flash memory was not provided due to the sector size of ≥ 64kB, the necessary buffering of such an update, as well as the long programming time of an entire page.
When using EEPROM, it is important to remember that 1.000.000 cycles are already quite a lot, but this also indicates a finite lifetime,
In addition, the SerialFileSystem do not respect hot spots (high-update files) or transactions.
memory consumption of the pC/SFS V1.14b:
ROM: approximately 8 kBytes on a 32bit CPU
RAM: approximately 124 bytes global + 42..64 bytes per user + 32 bytes * SFS_HANDLES
plus approximately 180 bytes stack
tested NVM memory:
Ramtron FM25H20, Ramtron FM24V10, Cypress CY15B104Q, Fujitsu MB85RS1MT, Fujitsu MB85RC256, ...
Microchip 25AA1024, Microchip 25AA1024, Atmel AT25M01, Atmel AT25256, Atmel AT24CM02, STM M95M01, STM M24M02, STM M95512, ONsemi CAT25M01, ONsemi CAT24M01, ...
running on hosts like: ARC-EM, ARMv8-M, FE310, GD32VF103, STM32F1xx, STM32F4xx, SAM3Sxx, SAMD21xx, SAMD51xx, SAML10, SAML11 ... plus Win32 & Linux
But no mechanisms of the File-sharing are deposited. So a file can be opened simultaneously from many users to reading but only from one user to writing.
As file attributes Write-Only and Read-Only are available.
download pC/SFS 1.14b (as ZIP)
code for create & delete link can be disabled
handling of file attributes completed and code uses found config values from file system if compatible to base settings
internal function SFSChange_Entry() harmonised and the use of it readjusted
SFS_GetEntry() added, but only the hash of the name can be returned instead the name itself - and optional LOCK/UNLOCK added in LLdriver to protect serial communication against timeouts
parallel memory and I2C memory support added, rename of LL-driver files to split between SPI, I2C and parallel memory
correction in internal SFSChange_Entry() for incorrect SFS_ChangeDir("/") handling
correction in internal SFSMem_Alloc() & SFSCreate_Entry() on creation of a DIR
optional extension SFS_RemoveDirTree() added and link handling corrected
feature switch SFS_AUTO_CLOSE added
feature switch SFS_DEEP_FORMAT added and SFS_PATHNAME central for all strings added, internal functions as static as far as possible
Services of the pC/SFS version 1.14b (abbreviation)
This here presented function overview only serves as short overview.
For detailed information, you please look in Reference-Manual about pC/SFS.
Initialization of the File-System
It returns a pointer on SFS revision
saves the SFS as image into a Windows/Linux file
Format the drive
As User announce
As User cancel
Create a directory
Remove a directory
Remove a directory and all his sub-elements
Rename a directory
Change current path
Change current path temorary
returns from temporary path
Create a file
Remove a file
Rename a file
Change the attributes of a file
It returns the attributes of a file
It returns the current size of a file
It returns the max size of a file
Open a file in "mode"
Close the opened file
Place the pointer in opened file absolutely
It returns the pointer in opened file
Set EndOfFile in opened file to actual R/W-pointer
Read data from opened file
Write data into opened file
read the error-code from Open, Read, Write ...
Create a Link to a directory or file
Remove a Link
It returns all infos of the given entry (dir/file/link) into a struct