Skip to content

Commit 70201f4

Browse files
committed
cc3200/mptask: Allocate flash VFS struct on the heap to trace root ptrs.
1 parent 8236d18 commit 70201f4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cc3200/mptask.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ OsiTaskHandle svTaskHandle;
9898
DECLARE PRIVATE DATA
9999
******************************************************************************/
100100
static fs_user_mount_t *sflash_vfs_fat;
101-
static mp_vfs_mount_t sflash_vfs_mount;
102101

103102
static const char fresh_main_py[] = "# main.py -- put your code here!\r\n";
104103
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) {
328327
mptask_create_main_py();
329328
}
330329
} else {
330+
fail:
331331
__fatal_error("failed to create /flash");
332332
}
333333

334334
// mount the flash device (there should be no other devices mounted at this point)
335-
mp_vfs_mount_t *vfs = &sflash_vfs_mount;
335+
// we allocate this structure on the heap because vfs->next is a root pointer
336+
mp_vfs_mount_t *vfs = m_new_obj_maybe(mp_vfs_mount_t);
337+
if (vfs == NULL) {
338+
goto fail;
339+
}
336340
vfs->str = "/flash";
337341
vfs->len = 6;
338342
vfs->obj = MP_OBJ_FROM_PTR(vfs_fat);

0 commit comments

Comments
 (0)