Skip to content

Commit 509d522

Browse files
committed
atmel-samd: Fix crash when fs mount fails and fix mounting internal flash. It was broken by the update to 1.9.1. Related to adafruit#82
1 parent 6ace744 commit 509d522

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

atmel-samd/access_vfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
// The root FS is always at the end of the list.
4646
static fs_user_mount_t* get_vfs(int index) {
4747
mp_vfs_mount_t* current_mount = MP_STATE_VM(vfs_mount_table);
48+
if (current_mount == NULL) {
49+
return NULL;
50+
}
4851
while (current_mount->next != NULL) {
4952
current_mount = current_mount->next;
5053
}

atmel-samd/internal_flash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ const mp_obj_type_t internal_flash_type = {
294294
};
295295

296296
void flash_init_vfs(fs_user_mount_t *vfs) {
297+
vfs->base.type = &mp_fat_vfs_type;
297298
vfs->flags |= FSUSER_NATIVE | FSUSER_HAVE_IOCTL;
299+
vfs->fatfs.drv = vfs;
300+
vfs->fatfs.part = 1; // flash filesystem lives on first partition
298301
vfs->readblocks[0] = (mp_obj_t)&internal_flash_obj_readblocks_obj;
299302
vfs->readblocks[1] = (mp_obj_t)&internal_flash_obj;
300303
vfs->readblocks[2] = (mp_obj_t)internal_flash_read_blocks; // native version

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy