Browse Source

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

Using lfs1 gives a smaller code, but lfs2 has more features.
pull/9534/head
robert-hh 2 years ago
committed by Damien George
parent
commit
972212907d
  1. 1
      ports/samd/mcu/samd21/mpconfigmcu.h
  2. 2
      ports/samd/mcu/samd51/mpconfigmcu.mk
  3. 8
      ports/samd/modules/_boot.py

1
ports/samd/mcu/samd21/mpconfigmcu.h

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

2
ports/samd/mcu/samd51/mpconfigmcu.mk

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

8
ports/samd/modules/_boot.py

@ -6,11 +6,13 @@ 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 = uos.VfsLfs1(bdev)
vfs = fs_type(bdev)
except:
uos.VfsLfs1.mkfs(bdev)
vfs = uos.VfsLfs1(bdev)
fs_type.mkfs(bdev)
vfs = fs_type(bdev)
uos.mount(vfs, "/")
gc.collect()

Loading…
Cancel
Save