-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Description
Hello everyone,
we are currently developing an application for the nRF52 microcontroller which is supposed to have a LittleFS filesystem on an external NOR flash.
We had an old version of RIOT which had the old filesystem example with LittleFS, but when I checked the newer version, the code in the example had no mention of LittleFS anymore.
The change was made on Aug 21, 2022 by this commit: e657590
From what I understand, the VFS subsystem is based on LittleFS now, which is why the dedicated code was removed. However when building and executing the example for the "nrf52dk" target, it appears that only the "ConstFS" filesystem exists and nothing in regard to LittleFS.
The example commands "vfs format /nvm0" and "vfs mount /nvm0" only result in an error, probably because the example code does not initialize it.
This is the console log with my nRF52-DK:
$ tio --map INLCRNL /dev/ttyACM0
[tio 14:49:29] tio v1.32
[tio 14:49:29] Press ctrl-t q to quit
[tio 14:49:29] Connected
> vfs df
Mountpoint Total Used Available Use%
/const 27 B 27 B 0 B 100%
>
> vfs format /nvm0
vfs: unsupported sub-command "format"
>
> vfs mount /nvm0
vfs: unsupported sub-command "mount"
>
> vfs ls /const
hello-world 14 B
hello-riot 13 B
total 2 files
>
[tio 14:50:13] Disconnected
Essentially, the example is completely missing the following features described in the README:
- how to mount/format/unmount a file system, either with spiffs, littlefs, fatfs or constfs
- how to open/read/write/close a file with and without newlib
In RIOT, most file systems use a mtd as flash interface. So to use this example one must define MTD_0. MTD_0 is a pointer to a mtd_dev_t instance.
This example uses littlefs as default file system on the whole mtd. A constfs file system is also demonstrated with two files.
And the following shell commands are missing:
vfs format /nvm0
: should be called the first time only, it will format the /nvm0 mountpoint with the configured file system
vfs mount /nvm0
: mount the file system on the configured mount point The constfs file system is mounted automatically on /const when the application starts
vfs umount /nvm0
: unmount /nvm0
I'm just getting started with RIOT, so I can't really say what's the direction this should go. Of couse, the README should reflect the actual functionality, but I feel like the functionality of the example was significantly cut with the aforementioned commit. Especially since now there is no example (or I didn't find it?) that shows how to use an SD card or other mass storage devices with LittleFS in RIOT.
Thanks and best regards,
Chris
Useful Links
Link to the current Filesystem Example: https://github.com/RIOT-OS/RIOT/tree/master/examples/filesystem
Link to the previous Filesystem Example: https://github.com/RIOT-OS/RIOT/tree/777e148bc286cf055e5ec299d55e6b229660f121/examples/filesystem
Link to the Commit Details: e657590