mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
rp2/modules: Fix FatFS boot script to detect invalid FAT filesystem.
This change helps detect if the filesystem is invalid, by also including the first mount attempt within the try-except. Then the FAT is reformatted if needed. Fixes issue #15779. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
committed by
Damien George
parent
ded8bbdd5e
commit
451ba1cf38
@@ -5,10 +5,9 @@ import machine, rp2
|
||||
# Try to mount the filesystem, and format the flash if it doesn't exist.
|
||||
bdev = rp2.Flash()
|
||||
try:
|
||||
fs = vfs.VfsFat(bdev)
|
||||
vfs.mount(vfs.VfsFat(bdev), "/")
|
||||
except:
|
||||
vfs.VfsFat.mkfs(bdev)
|
||||
fs = vfs.VfsFat(bdev)
|
||||
vfs.mount(fs, "/")
|
||||
vfs.mount(vfs.VfsFat(bdev), "/")
|
||||
|
||||
del vfs, bdev, fs
|
||||
del vfs, bdev
|
||||
|
||||
Reference in New Issue
Block a user