mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
samd: Adapt existing samd.Flash and integrate with (Q)SPI flash in boot.
Checks are added to ensure, that only one of the flash drivers is selected. Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
@@ -2,18 +2,18 @@ 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)
|
||||
vfs = fs_type(bdev, progsize=256)
|
||||
except:
|
||||
fs_type.mkfs(bdev)
|
||||
vfs = fs_type(bdev)
|
||||
fs_type.mkfs(bdev, progsize=256)
|
||||
vfs = fs_type(bdev, progsize=256)
|
||||
uos.mount(vfs, "/")
|
||||
|
||||
del vfs, fs_type, bdev, uos, samd
|
||||
gc.collect()
|
||||
del uos, vfs, gc
|
||||
del gc
|
||||
|
||||
Reference in New Issue
Block a user