micropython/ports/samd/modules/_boot.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
354 B
Python
Raw Normal View History

import gc
import uos
import samd
samd.Flash.flash_init()
bdev = samd.Flash()
# Try to mount the filesystem, and format the flash if it doesn't exist.
fs_type = uos.VfsLfs2 if hasattr(uos, "VfsLfs2") else uos.VfsLfs1
try:
vfs = fs_type(bdev)
except:
fs_type.mkfs(bdev)
vfs = fs_type(bdev)
uos.mount(vfs, "/")
gc.collect()
del uos, vfs, gc