summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/mpconfig.h5
-rw-r--r--py/runtime.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 6d1893717..df75e0752 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -403,6 +403,11 @@
#define MICROPY_READER_FATFS (0)
#endif
+// Number of VFS mounts to persist across soft-reset.
+#ifndef MICROPY_FATFS_NUM_PERSISTENT
+#define MICROPY_FATFS_NUM_PERSISTENT (0)
+#endif
+
// Hook for the VM at the start of the opcode loop (can contain variable
// definitions usable by the other hook functions)
#ifndef MICROPY_VM_HOOK_INIT
diff --git a/py/runtime.c b/py/runtime.c
index cd02debf8..c407a58a4 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -103,7 +103,8 @@ void mp_init(void) {
#if MICROPY_FSUSERMOUNT
// zero out the pointers to the user-mounted devices
- memset(MP_STATE_VM(fs_user_mount), 0, sizeof(MP_STATE_VM(fs_user_mount)));
+ memset(MP_STATE_VM(fs_user_mount) + MICROPY_FATFS_NUM_PERSISTENT, 0,
+ sizeof(MP_STATE_VM(fs_user_mount)) - MICROPY_FATFS_NUM_PERSISTENT);
#endif
#if MICROPY_PY_THREAD_GIL