samd/mcu: Use lf2s for SAMD51 and lfs1 for SAMD21.

Using lfs1 gives a smaller code, but lfs2 has more features.
This commit is contained in:
robert-hh
2022-07-10 11:55:56 +02:00
committed by Damien George
parent 4cf527eb05
commit 972212907d
3 changed files with 8 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
// MicroPython emitters // MicroPython emitters
#define MICROPY_EMIT_THUMB (0) #define MICROPY_EMIT_THUMB (0)
#define MICROPY_EMIT_INLINE_THUMB (0) #define MICROPY_EMIT_INLINE_THUMB (0)
#define MICROPY_MODULE_BUILTIN_INIT (1)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_PY_BUILTINS_COMPLEX (0) #define MICROPY_PY_BUILTINS_COMPLEX (0)

View File

@@ -1,3 +1,5 @@
MICROPY_VFS_LFS2 ?= 1
SRC_S += shared/runtime/gchelper_m3.s SRC_S += shared/runtime/gchelper_m3.s
SRC_MOD += $(addprefix lib/libm/,\ SRC_MOD += $(addprefix lib/libm/,\

View File

@@ -6,11 +6,13 @@ samd.Flash.flash_init()
bdev = samd.Flash() bdev = samd.Flash()
# Try to mount the filesystem, and format the flash if it doesn't exist. # 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: try:
vfs = uos.VfsLfs1(bdev) vfs = fs_type(bdev)
except: except:
uos.VfsLfs1.mkfs(bdev) fs_type.mkfs(bdev)
vfs = uos.VfsLfs1(bdev) vfs = fs_type(bdev)
uos.mount(vfs, "/") uos.mount(vfs, "/")
gc.collect() gc.collect()