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.
pull/4641/head
Andrew Leech 2019-03-25 11:20:54 +11:00 zatwierdzone przez Damien George
rodzic d396a7e10d
commit 74d07469f2
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -113,6 +113,9 @@ STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
// make the filesystem
uint8_t working_buf[FF_MAX_SS];
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) {
mp_raise_OSError(fresult_to_errno_table[res]);
}