summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--atmel-samd/access_vfs.c3
-rw-r--r--atmel-samd/internal_flash.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/atmel-samd/access_vfs.c b/atmel-samd/access_vfs.c
index 0eb11b84e..e4a643c0b 100644
--- a/atmel-samd/access_vfs.c
+++ b/atmel-samd/access_vfs.c
@@ -45,6 +45,9 @@
// The root FS is always at the end of the list.
static fs_user_mount_t* get_vfs(int index) {
mp_vfs_mount_t* current_mount = MP_STATE_VM(vfs_mount_table);
+ if (current_mount == NULL) {
+ return NULL;
+ }
while (current_mount->next != NULL) {
current_mount = current_mount->next;
}
diff --git a/atmel-samd/internal_flash.c b/atmel-samd/internal_flash.c
index bd5963e11..1ff1cabcf 100644
--- a/atmel-samd/internal_flash.c
+++ b/atmel-samd/internal_flash.c
@@ -294,7 +294,10 @@ const mp_obj_type_t internal_flash_type = {
};
void flash_init_vfs(fs_user_mount_t *vfs) {
+ vfs->base.type = &mp_fat_vfs_type;
vfs->flags |= FSUSER_NATIVE | FSUSER_HAVE_IOCTL;
+ vfs->fatfs.drv = vfs;
+ vfs->fatfs.part = 1; // flash filesystem lives on first partition
vfs->readblocks[0] = (mp_obj_t)&internal_flash_obj_readblocks_obj;
vfs->readblocks[1] = (mp_obj_t)&internal_flash_obj;
vfs->readblocks[2] = (mp_obj_t)internal_flash_read_blocks; // native version