diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-06-26 14:04:22 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-06-26 14:04:22 -0700 |
| commit | e87a61ffb4ad089b7eb5eb4512cb57c085fd9136 (patch) | |
| tree | a464a1d4f4627015450ba4d1285c476bc76f6a45 /py/runtime.c | |
| parent | 8251d8cb2a408a4493395b8a2ee87cc11fcdfc3e (diff) | |
atmel-samd: Fix running off of the new VFS filesystem including
an issue at startup leading to safe mode and mass storage support
not working.
Diffstat (limited to 'py/runtime.c')
| -rw-r--r-- | py/runtime.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c index 5fe132ae7..504c17c15 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -29,6 +29,8 @@ #include <string.h> #include <assert.h> +#include "extmod/vfs.h" + #include "py/mpstate.h" #include "py/nlr.h" #include "py/parsenum.h" @@ -114,10 +116,25 @@ void mp_init(void) { #endif #if MICROPY_VFS + #if MICROPY_FATFS_NUM_PERSISTENT > 0 + mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); + if (vfs != NULL) { + MP_STATE_VM(vfs_cur) = vfs; + } + // Skip forward until the vfs->next pointer is the first vfs that shouldn't + // persist. + uint8_t i = 1; + while (vfs != NULL && i < MICROPY_FATFS_NUM_PERSISTENT) { + vfs = vfs->next; + i++; + } + vfs->next = NULL; + #else // initialise the VFS sub-system MP_STATE_VM(vfs_cur) = NULL; MP_STATE_VM(vfs_mount_table) = NULL; #endif + #endif #if MICROPY_PY_THREAD_GIL mp_thread_mutex_init(&MP_STATE_VM(gil_mutex)); |
