ports: Use vfs module instead of os.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import gc
|
||||
import os
|
||||
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 = os.VfsLfs2 if hasattr(os, "VfsLfs2") else os.VfsLfs1
|
||||
fs_type = vfs.VfsLfs2 if hasattr(vfs, "VfsLfs2") else vfs.VfsLfs1
|
||||
|
||||
try:
|
||||
vfs = fs_type(bdev, progsize=256)
|
||||
fs = fs_type(bdev, progsize=256)
|
||||
except:
|
||||
fs_type.mkfs(bdev, progsize=256)
|
||||
vfs = fs_type(bdev, progsize=256)
|
||||
os.mount(vfs, "/")
|
||||
fs = fs_type(bdev, progsize=256)
|
||||
vfs.mount(fs, "/")
|
||||
sys.path.append("/lib")
|
||||
|
||||
del vfs, fs_type, bdev, os, samd, sys
|
||||
del fs, fs_type, bdev, vfs, samd, sys
|
||||
gc.collect()
|
||||
del gc
|
||||
|
||||
Reference in New Issue
Block a user