esp8266/moduos: Add optional support for VfsLfs1 and VfsLfs2.
With this commit an esp8266-based board can now be built with littlefs support via, eg "make MICROPY_VFS_LFS2=1".
This commit is contained in:
parent
6eee5413ff
commit
cea9209e0f
|
@ -132,6 +132,7 @@ SECTIONS
|
|||
*lib/axtls/*.o(.literal*, .text*)
|
||||
*lib/berkeley-db-1.xx/*.o(.literal*, .text*)
|
||||
*lib/libm/*.o*(.literal*, .text*)
|
||||
*lib/littlefs/*.o*(.literal*, .text*)
|
||||
*lib/mp-readline/*.o(.literal*, .text*)
|
||||
*lib/netutils/*.o*(.literal*, .text*)
|
||||
*lib/timeutils/*.o*(.literal*, .text*)
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "extmod/misc.h"
|
||||
#include "extmod/vfs.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "extmod/vfs_lfs.h"
|
||||
#include "genhdr/mpversion.h"
|
||||
#include "esp_mphal.h"
|
||||
#include "user_interface.h"
|
||||
|
@ -105,8 +106,7 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&os_dupterm_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&os_dupterm_notify_obj) },
|
||||
#endif
|
||||
#if MICROPY_VFS_FAT
|
||||
{ MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
|
||||
#if MICROPY_VFS
|
||||
{ MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) },
|
||||
|
@ -119,6 +119,15 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) },
|
||||
#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
|
||||
};
|
||||
|
||||
|
|
|
@ -137,8 +137,16 @@ void *esp_native_code_commit(void*, size_t);
|
|||
// printer for debugging output, goes to UART only
|
||||
extern const struct _mp_print_t mp_debug_print;
|
||||
|
||||
#if MICROPY_VFS_FAT
|
||||
#define mp_type_fileio mp_type_vfs_fat_fileio
|
||||
#define mp_type_textio mp_type_vfs_fat_textio
|
||||
#elif MICROPY_VFS_LFS1
|
||||
#define mp_type_fileio mp_type_vfs_lfs1_fileio
|
||||
#define mp_type_textio mp_type_vfs_lfs1_textio
|
||||
#elif MICROPY_VFS_LFS2
|
||||
#define mp_type_fileio mp_type_vfs_lfs2_fileio
|
||||
#define mp_type_textio mp_type_vfs_lfs2_textio
|
||||
#endif
|
||||
|
||||
// use vfs's functions for import stat and builtin open
|
||||
#define mp_import_stat mp_vfs_import_stat
|
||||
|
|
Loading…
Reference in New Issue