extmod/vfs_fat: Fallback to FAT32 if standard FAT16/SFD format fails.
This allows formatting SD cards, larger flash etc which do not support the default FAT16/SFD format mode.
This commit is contained in:
parent
d396a7e10d
commit
74d07469f2
|
@ -113,6 +113,9 @@ STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
|
||||||
// make the filesystem
|
// make the filesystem
|
||||||
uint8_t working_buf[FF_MAX_SS];
|
uint8_t working_buf[FF_MAX_SS];
|
||||||
FRESULT res = f_mkfs(&vfs->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf));
|
FRESULT res = f_mkfs(&vfs->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf));
|
||||||
|
if (res == FR_MKFS_ABORTED) { // Probably doesn't support FAT16
|
||||||
|
res = f_mkfs(&vfs->fatfs, FM_FAT32, 0, working_buf, sizeof(working_buf));
|
||||||
|
}
|
||||||
if (res != FR_OK) {
|
if (res != FR_OK) {
|
||||||
mp_raise_OSError(fresult_to_errno_table[res]);
|
mp_raise_OSError(fresult_to_errno_table[res]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue