diff options
author | Damien George <damien.p.george@gmail.com> | 2019-10-29 17:17:22 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-11-06 12:16:00 +1100 |
commit | 4be316fb072ab7c2f28da815ead970ebf705c328 (patch) | |
tree | 94b28b05d713a6b89017f0b514195af64f2f77cb | |
parent | d01ca7888b8eeeed026270742c40efe442cdd6ef (diff) |
esp32/moduos: Enable uos.VfsLfs2 for littlefs filesystems.
This commit adds support for littlefs (v2) on all esp32 boards.
The original FAT filesystem still works and any board with a preexisting
FAT filesystem will still work as normal. It's possible to switch to
littlefs by reformatting the block device using:
import uos, flashbdev
uos.VfsLfs2.mkfs(flashbdev.bdev)
Then when the board reboots (soft or hard) the new littlefs filesystem will
be mounted. It's possible to switch back to a FAT filesystem by formatting
with uos.VfsFat.mkfs(flashbdev.bdev).
-rw-r--r-- | ports/esp32/Makefile | 1 | ||||
-rw-r--r-- | ports/esp32/moduos.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile index 42b01a4e6..86e8cd3b2 100644 --- a/ports/esp32/Makefile +++ b/ports/esp32/Makefile @@ -31,6 +31,7 @@ MICROPY_PY_USSL = 0 MICROPY_SSL_AXTLS = 0 MICROPY_FATFS = 1 MICROPY_PY_BTREE = 1 +MICROPY_VFS_LFS2 = 1 FROZEN_MANIFEST ?= boards/manifest.py diff --git a/ports/esp32/moduos.c b/ports/esp32/moduos.c index dc85136f3..d68df28fd 100644 --- a/ports/esp32/moduos.c +++ b/ports/esp32/moduos.c @@ -38,6 +38,7 @@ #include "extmod/misc.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" +#include "extmod/vfs_lfs.h" #include "genhdr/mpversion.h" extern const mp_obj_type_t mp_fat_vfs_type; @@ -123,6 +124,12 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { #if MICROPY_VFS_FAT { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, #endif + #if MICROPY_VFS_LFS1 + { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, + #endif + #if MICROPY_VFS_LFS2 + { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, + #endif #endif }; |