Browse Source

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).
pull/5274/head
Damien George 5 years ago
parent
commit
4be316fb07
  1. 1
      ports/esp32/Makefile
  2. 7
      ports/esp32/moduos.c

1
ports/esp32/Makefile

@ -31,6 +31,7 @@ MICROPY_PY_USSL = 0
MICROPY_SSL_AXTLS = 0 MICROPY_SSL_AXTLS = 0
MICROPY_FATFS = 1 MICROPY_FATFS = 1
MICROPY_PY_BTREE = 1 MICROPY_PY_BTREE = 1
MICROPY_VFS_LFS2 = 1
FROZEN_MANIFEST ?= boards/manifest.py FROZEN_MANIFEST ?= boards/manifest.py

7
ports/esp32/moduos.c

@ -38,6 +38,7 @@
#include "extmod/misc.h" #include "extmod/misc.h"
#include "extmod/vfs.h" #include "extmod/vfs.h"
#include "extmod/vfs_fat.h" #include "extmod/vfs_fat.h"
#include "extmod/vfs_lfs.h"
#include "genhdr/mpversion.h" #include "genhdr/mpversion.h"
extern const mp_obj_type_t mp_fat_vfs_type; 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 #if MICROPY_VFS_FAT
{ MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
#endif #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 #endif
}; };

Loading…
Cancel
Save