469345e728
This commit adds a new port "rp2" which targets the new Raspberry Pi RP2040 microcontroller. The build system uses pure cmake (with a small Makefile wrapper for convenience). The USB driver is TinyUSB, and there is a machine module with most of the standard classes implemented. Some examples are provided in the examples/rp2/ directory. Work done in collaboration with Graham Sanderson. Signed-off-by: Damien George <damien@micropython.org>
16 lines
373 B
Python
16 lines
373 B
Python
import os
|
|
import machine, rp2
|
|
|
|
|
|
# Try to mount the filesystem, and format the flash if it doesn't exist.
|
|
# Note: the flash requires the programming size to be aligned to 256 bytes.
|
|
bdev = rp2.Flash()
|
|
try:
|
|
vfs = os.VfsLfs2(bdev, progsize=256)
|
|
except:
|
|
os.VfsLfs2.mkfs(bdev, progsize=256)
|
|
vfs = os.VfsLfs2(bdev, progsize=256)
|
|
os.mount(vfs, "/")
|
|
|
|
del os, bdev, vfs
|