diff options
Diffstat (limited to 'py')
-rw-r--r-- | py/lexer.c | 2 | ||||
-rw-r--r-- | py/mpconfig.h | 10 | ||||
-rw-r--r-- | py/mpstate.h | 5 | ||||
-rw-r--r-- | py/py.mk | 2 | ||||
-rw-r--r-- | py/qstrdefs.h | 1 | ||||
-rw-r--r-- | py/runtime.c | 6 |
6 files changed, 25 insertions, 1 deletions
diff --git a/py/lexer.c b/py/lexer.c index 458fba0900..e9b571ca40 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -753,7 +753,7 @@ mp_lexer_t *mp_lexer_new_from_str_len(qstr src_name, const char *str, mp_uint_t return mp_lexer_new(src_name, reader); } -#if MICROPY_READER_POSIX || MICROPY_READER_FATFS +#if MICROPY_READER_POSIX || MICROPY_READER_VFS || MICROPY_READER_FATFS mp_lexer_t *mp_lexer_new_from_file(const char *filename) { mp_reader_t reader; diff --git a/py/mpconfig.h b/py/mpconfig.h index 3bccada11d..a924eda0c6 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -398,6 +398,11 @@ #define MICROPY_READER_POSIX (0) #endif +// Whether to use the VFS reader for importing files +#ifndef MICROPY_READER_VFS +#define MICROPY_READER_VFS (0) +#endif + // Whether to use the FatFS reader for importing files #ifndef MICROPY_READER_FATFS #define MICROPY_READER_FATFS (0) @@ -621,6 +626,11 @@ typedef double mp_float_t; #define MICROPY_FSUSERMOUNT (0) #endif +// Support for generic VFS sub-system +#ifndef MICROPY_VFS +#define MICROPY_VFS (0) +#endif + /*****************************************************************************/ /* Fine control over Python builtins, classes, modules, etc */ diff --git a/py/mpstate.h b/py/mpstate.h index 91fb68b3ad..9c73f7778b 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -165,6 +165,11 @@ typedef struct _mp_state_vm_t { struct _fs_user_mount_t *fs_user_mount[MICROPY_FATFS_VOLUMES]; #endif + #if MICROPY_VFS + struct _vfs_mount_t *vfs_cur; + struct _vfs_mount_t *vfs_mount_table; + #endif + // // END ROOT POINTER SECTION //////////////////////////////////////////////////////////// @@ -233,6 +233,8 @@ PY_O_BASENAME = \ ../extmod/modwebrepl.o \ ../extmod/modframebuf.o \ ../extmod/fsusermount.o \ + ../extmod/vfs.o \ + ../extmod/vfs_reader.o \ ../extmod/vfs_fat.o \ ../extmod/vfs_fat_ffconf.o \ ../extmod/vfs_fat_diskio.o \ diff --git a/py/qstrdefs.h b/py/qstrdefs.h index c98a253a69..4581e5e1b1 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -36,6 +36,7 @@ QCFG(BYTES_IN_HASH, MICROPY_QSTR_BYTES_IN_HASH) Q() Q(*) Q(_) +Q(/) Q(%#o) Q(%#x) Q({:#b}) diff --git a/py/runtime.c b/py/runtime.c index 0ccfd8d874..e6aef21d77 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -105,6 +105,12 @@ void mp_init(void) { memset(MP_STATE_VM(fs_user_mount), 0, sizeof(MP_STATE_VM(fs_user_mount))); #endif + #if MICROPY_VFS + // initialise the VFS sub-system + MP_STATE_VM(vfs_cur) = NULL; + MP_STATE_VM(vfs_mount_table) = NULL; + #endif + #if MICROPY_PY_THREAD_GIL mp_thread_mutex_init(&MP_STATE_VM(gil_mutex)); #endif |