summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-03-10 19:09:19 +1100
committerDamien George <damien.p.george@gmail.com>2017-03-10 19:09:19 +1100
commit70201f40386c42fec8bd20af06fe31a69f3af7db (patch)
tree03fba9a3faee53e95e5045b95b58e71d71a07602
parent8236d18338f6d8db25dcc5e81b176b006d56f39d (diff)
downloadmicropython-70201f40386c42fec8bd20af06fe31a69f3af7db.tar.gz
micropython-70201f40386c42fec8bd20af06fe31a69f3af7db.zip
cc3200/mptask: Allocate flash VFS struct on the heap to trace root ptrs.
-rw-r--r--cc3200/mptask.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cc3200/mptask.c b/cc3200/mptask.c
index c7c1832edb..41264fbd06 100644
--- a/cc3200/mptask.c
+++ b/cc3200/mptask.c
@@ -98,7 +98,6 @@ OsiTaskHandle svTaskHandle;
DECLARE PRIVATE DATA
******************************************************************************/
static fs_user_mount_t *sflash_vfs_fat;
-static mp_vfs_mount_t sflash_vfs_mount;
static const char fresh_main_py[] = "# main.py -- put your code here!\r\n";
static const char fresh_boot_py[] = "# boot.py -- run on boot-up\r\n"
@@ -328,11 +327,16 @@ STATIC void mptask_init_sflash_filesystem (void) {
mptask_create_main_py();
}
} else {
+ fail:
__fatal_error("failed to create /flash");
}
// mount the flash device (there should be no other devices mounted at this point)
- mp_vfs_mount_t *vfs = &sflash_vfs_mount;
+ // we allocate this structure on the heap because vfs->next is a root pointer
+ mp_vfs_mount_t *vfs = m_new_obj_maybe(mp_vfs_mount_t);
+ if (vfs == NULL) {
+ goto fail;
+ }
vfs->str = "/flash";
vfs->len = 6;
vfs->obj = MP_OBJ_FROM_PTR(vfs_fat);