Closed yesco closed 7 years ago
Good suggestion, and good idea to open an issue to keep track of the options for this.
Any filesystem implementation that uses open() will probably end up needing to dovetail with #55.
With a few simple adaptions you can also use RTOS FAT SL
Spiffs is great! Using FAT filesystems in embedded applications is not a very good idea as it is prone to corruption and has no wear leveling. The latter can be added but a poorly timed power loss may lead to the former.
I've integrated spiffs into esp-open-rtos. Here's branch with spiffs integrated. It includes spiffs image creation and flashing integrated into the build process. Here's a separate branch with spiffs integrated into newlib, so the common POSIX file operations are available.
I intend to merge it and create PR when it is ready.
Regarding number of open file descriptors. Spiffs is configured how many open file descriptors is available.
size_t fdsBufSize = SPIFFS_buffer_bytes_for_filedescs(&fs, 5);
In this example 5 files can be simultaneously opened.
Love your work @sheinz ! Particularly nice being able to integrate with the build process, that is excellent.
It would be nice to support multiple filesystem types, thanks @SaimenSays for pointing out that FAT implementation. Unfortunately there is a barrrier to using that particular implementation. The code is only available under the GPLv2 license (unless you purchase a commercial license). It's not possible to distribute esp-open-rtos applications under GPL, because we still include several binary libraries from Espressif - and we don't have GPL-licenseable source code for these libraries.
@kanflo you're so kind 😉 @sheinz looks great! I'd be happy to review the spiffs config before your branch is merged into eor. I think I could cram some more bits out of it on the esp. Also, having the magic config would be nice.
There's a work in progress PR for spiffs integration. Anyone interested are welcome to have a look.
Currently esp-open-rtos supports spiffs for SPI flash and fatfs for SDIO.
I'm gonno create this a place holder, so I can track it.
If I'm correct, we currently don't have any flash file system under esp-open-rtos.
nodemcu/lua uses the spiffs which is on https://github.com/pellepl/spiffs However, their interface only allows one file open at a time. From viewing the https://github.com/pellepl/spiffs/blob/master/src/spiffs.h it seems to be more capable.
Spiffs provides a flat file sytem with no directories, however, filenames aren't limited and can contain "/" thus if one kept track of cwd/pwd one could easily make directly listing functions that filtered correctly.
Any other ideas/preferences?
I created a simple test to see what would happen, currently we get linking errors:
"/home/gus/" path is curious too ;-)
--- snipp ----
--- snopp ---