stmhal: Set the FatFs partition number when initialising VFS object.

stmhal has MULTI_PARTITION enabled for FatFs and so these values need to be
initialised.
This commit is contained in:
Damien George 2017-01-30 13:02:10 +11:00
parent 220abca311
commit a526352454
2 changed files with 2 additions and 0 deletions

View File

@ -447,6 +447,7 @@ void sdcard_init_vfs(fs_user_mount_t *vfs) {
vfs->base.type = &mp_fat_vfs_type; vfs->base.type = &mp_fat_vfs_type;
vfs->flags |= FSUSER_NATIVE | FSUSER_HAVE_IOCTL; vfs->flags |= FSUSER_NATIVE | FSUSER_HAVE_IOCTL;
vfs->fatfs.drv = vfs; vfs->fatfs.drv = vfs;
vfs->fatfs.part = 0; // autodetect partition
vfs->readblocks[0] = (mp_obj_t)&pyb_sdcard_readblocks_obj; vfs->readblocks[0] = (mp_obj_t)&pyb_sdcard_readblocks_obj;
vfs->readblocks[1] = (mp_obj_t)&pyb_sdcard_obj; vfs->readblocks[1] = (mp_obj_t)&pyb_sdcard_obj;
vfs->readblocks[2] = (mp_obj_t)sdcard_read_blocks; // native version vfs->readblocks[2] = (mp_obj_t)sdcard_read_blocks; // native version

View File

@ -507,6 +507,7 @@ void pyb_flash_init_vfs(fs_user_mount_t *vfs) {
vfs->base.type = &mp_fat_vfs_type; vfs->base.type = &mp_fat_vfs_type;
vfs->flags |= FSUSER_NATIVE | FSUSER_HAVE_IOCTL; vfs->flags |= FSUSER_NATIVE | FSUSER_HAVE_IOCTL;
vfs->fatfs.drv = vfs; vfs->fatfs.drv = vfs;
vfs->fatfs.part = 1; // flash filesystem lives on first partition
vfs->readblocks[0] = (mp_obj_t)&pyb_flash_readblocks_obj; vfs->readblocks[0] = (mp_obj_t)&pyb_flash_readblocks_obj;
vfs->readblocks[1] = (mp_obj_t)&pyb_flash_obj; vfs->readblocks[1] = (mp_obj_t)&pyb_flash_obj;
vfs->readblocks[2] = (mp_obj_t)storage_read_blocks; // native version vfs->readblocks[2] = (mp_obj_t)storage_read_blocks; // native version