mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
16 lines
375 B
Python
16 lines
375 B
Python
import vfs
|
|
import machine, rp2
|
|
|
|
|
|
# Try to mount the filesystem, and format the flash if it doesn't exist.
|
|
# Note: the flash requires the programming size to be aligned to 256 bytes.
|
|
bdev = rp2.Flash()
|
|
try:
|
|
fs = vfs.VfsLfs2(bdev, progsize=256)
|
|
except:
|
|
vfs.VfsLfs2.mkfs(bdev, progsize=256)
|
|
fs = vfs.VfsLfs2(bdev, progsize=256)
|
|
vfs.mount(fs, "/")
|
|
|
|
del vfs, bdev, fs
|