From a93d9b8c2d4f7b020a906007702e01a1485e8043 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 9 Oct 2020 22:02:46 +0200 Subject: [PATCH] stm32: Fix broken build when FAT FS multi-partition is disabled. --- ports/stm32/sdcard.c | 2 ++ ports/stm32/storage.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c index 7d79e9f47b..b255ee82ca 100644 --- a/ports/stm32/sdcard.c +++ b/ports/stm32/sdcard.c @@ -866,7 +866,9 @@ void sdcard_init_vfs(fs_user_mount_t *vfs, int part) { vfs->base.type = &mp_fat_vfs_type; vfs->blockdev.flags |= MP_BLOCKDEV_FLAG_NATIVE | MP_BLOCKDEV_FLAG_HAVE_IOCTL; vfs->fatfs.drv = vfs; + #if MICROPY_FATFS_MULTI_PARTITION vfs->fatfs.part = part; + #endif vfs->blockdev.readblocks[0] = MP_OBJ_FROM_PTR(&pyb_sdcard_readblocks_obj); vfs->blockdev.readblocks[1] = MP_OBJ_FROM_PTR(&pyb_sdcard_obj); vfs->blockdev.readblocks[2] = MP_OBJ_FROM_PTR(sdcard_read_blocks); // native version diff --git a/ports/stm32/storage.c b/ports/stm32/storage.c index 0fefcbab90..c8805d6829 100644 --- a/ports/stm32/storage.c +++ b/ports/stm32/storage.c @@ -453,7 +453,9 @@ void pyb_flash_init_vfs(fs_user_mount_t *vfs) { vfs->base.type = &mp_fat_vfs_type; vfs->blockdev.flags |= MP_BLOCKDEV_FLAG_NATIVE | MP_BLOCKDEV_FLAG_HAVE_IOCTL; vfs->fatfs.drv = vfs; + #if MICROPY_FATFS_MULTI_PARTITION vfs->fatfs.part = 1; // flash filesystem lives on first partition + #endif vfs->blockdev.readblocks[0] = MP_OBJ_FROM_PTR(&pyb_flash_readblocks_obj); vfs->blockdev.readblocks[1] = MP_OBJ_FROM_PTR(&pyb_flash_obj); vfs->blockdev.readblocks[2] = MP_OBJ_FROM_PTR(storage_read_blocks); // native version