mirror of
https://github.com/micropython/micropython.git
synced 2026-05-01 21:30:14 +02:00
7d28789544
Signed-off-by: Damien George <damien@micropython.org>
22 lines
432 B
Python
22 lines
432 B
Python
import gc
|
|
import vfs
|
|
import samd
|
|
import sys
|
|
|
|
bdev = samd.Flash()
|
|
|
|
# Try to mount the filesystem, and format the flash if it doesn't exist.
|
|
fs_type = vfs.VfsLfs2 if hasattr(vfs, "VfsLfs2") else vfs.VfsLfs1
|
|
|
|
try:
|
|
fs = fs_type(bdev, progsize=256)
|
|
except:
|
|
fs_type.mkfs(bdev, progsize=256)
|
|
fs = fs_type(bdev, progsize=256)
|
|
vfs.mount(fs, "/")
|
|
sys.path.append("/lib")
|
|
|
|
del fs, fs_type, bdev, vfs, samd, sys
|
|
gc.collect()
|
|
del gc
|