micropython/ports/samd/modules/_boot.py
Peter van der Burg cd2223b8fe samd: Integrate latest asf4, add help, more time funcs and uPy features.
- Makefile: update to use new ASF4 files, support frozen manifest, and
  include source files in upcoming commits
- boards/manifest.py: add files to freeze
- boards/samd51p19a.ld: add linker script for this MCU
- help.c: add custom help text
- main.c: execute _boot.py, boot.py and main.py on start-up
- modules/_boot.py: startup file to freeze
- modutime.c: add gmtime, localtime, mktime, time functions
- mpconfigport.h: enabled more features for sys and io and modules
- mphalport.h: add mp_hal_pin_xxx macros
- mphalport.c: add mp_hal_stdio_poll
2021-11-19 11:05:05 +11:00

18 lines
299 B
Python

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.
try:
vfs = uos.VfsLfs1(bdev)
except:
uos.VfsLfs1.mkfs(bdev)
vfs = uos.VfsLfs1(bdev)
uos.mount(vfs, "/")
gc.collect()
del uos, vfs, gc