aboutsummaryrefslogtreecommitdiff
path: root/ports/rp2/modules/_boot.py
blob: 099e5aba05907610425d6628e1993d17cd326114 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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