LittleFS - A high-integrity embedded file system
看起来不错的东西,实现了 POSIX标准接口,只需要填充硬件接口。
Any device that implements the BlockDevice interface can host a file system in Mbed OS. You can change the BlockDevice based storage drivers without changing your application or library code.
To start:
- Choose a driver that implements the
BlockDevice
API for your flash storage: DataFlash, SD card, SFDP SPI Flash or implement your own. - Initialize and mount the file system:
BlockDevice bd = /* get a block device */; // first argument is the mount point, for example files will be available under /fs/, second a pointer to the block device LittleFileSystem fs("fs", &bd);
- Use POSIX file system calls to read and write files (such as
fread
,fopen
and so on).
You can find an example program here. If you don't have any storage on your development board you can test this high-integrity embedded file system with the HeapBlockDevice, which stores the data in memory (but does not persist it).