f52a2cd55a
Needed for mip to find a default location to install to. Like esp32, samd uses "/" as the mount point for the flash. Make _boot.py add the entry after successfully mounting. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
22 lines
430 B
Python
22 lines
430 B
Python
import gc
|
|
import os
|
|
import samd
|
|
import sys
|
|
|
|
bdev = samd.Flash()
|
|
|
|
# Try to mount the filesystem, and format the flash if it doesn't exist.
|
|
fs_type = os.VfsLfs2 if hasattr(os, "VfsLfs2") else os.VfsLfs1
|
|
|
|
try:
|
|
vfs = fs_type(bdev, progsize=256)
|
|
except:
|
|
fs_type.mkfs(bdev, progsize=256)
|
|
vfs = fs_type(bdev, progsize=256)
|
|
os.mount(vfs, "/")
|
|
sys.path.append("/lib")
|
|
|
|
del vfs, fs_type, bdev, os, samd, sys
|
|
gc.collect()
|
|
del gc
|