From 70201f40386c42fec8bd20af06fe31a69f3af7db Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 10 Mar 2017 19:09:19 +1100 Subject: [PATCH] cc3200/mptask: Allocate flash VFS struct on the heap to trace root ptrs. --- cc3200/mptask.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cc3200/mptask.c b/cc3200/mptask.c index c7c1832ed..41264fbd0 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);