summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--atmel-samd/mpconfigport.h1
-rw-r--r--py/mpconfig.h5
-rw-r--r--py/runtime.c3
3 files changed, 8 insertions, 1 deletions
diff --git a/atmel-samd/mpconfigport.h b/atmel-samd/mpconfigport.h
index 139557343..667f9bf3f 100644
--- a/atmel-samd/mpconfigport.h
+++ b/atmel-samd/mpconfigport.h
@@ -70,6 +70,7 @@
#define MICROPY_FATFS_RPATH (2)
#define MICROPY_FATFS_VOLUMES (4)
#define MICROPY_FATFS_MULTI_PARTITION (1)
+#define MICROPY_FATFS_NUM_PERSISTENT (1)
#define MICROPY_FSUSERMOUNT (1)
// Only enable this if you really need it. It allocates a byte cache of this
// size.
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