mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
ports: Use vfs module instead of os.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -13,7 +13,7 @@ Note: v1.12-334 and newer (including v1.13) require an ESP8266 module with
|
||||
2MiB of flash or more, and use littlefs as the filesystem by default. When
|
||||
upgrading from older firmware please backup your files first, and either
|
||||
erase all flash before upgrading, or after upgrading execute
|
||||
`os.VfsLfs2.mkfs(bdev)`.
|
||||
`vfs.VfsLfs2.mkfs(bdev)`.
|
||||
|
||||
### OTA builds
|
||||
Over-The-Air (OTA) builds of the ESP8266 firmware are also provided.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import gc
|
||||
|
||||
gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4)
|
||||
import os
|
||||
import vfs
|
||||
from flashbdev import bdev
|
||||
|
||||
if bdev:
|
||||
try:
|
||||
os.mount(bdev, "/")
|
||||
vfs.mount(bdev, "/")
|
||||
except:
|
||||
import inisetup
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import os
|
||||
import vfs
|
||||
import network
|
||||
from flashbdev import bdev
|
||||
|
||||
@@ -36,7 +36,7 @@ def fs_corrupted():
|
||||
"""\
|
||||
The filesystem starting at sector %d with size %d sectors looks corrupt.
|
||||
You may want to make a flash snapshot and try to recover it. Otherwise,
|
||||
format it with os.VfsLfs2.mkfs(bdev), or completely erase the flash and
|
||||
format it with vfs.VfsLfs2.mkfs(bdev), or completely erase the flash and
|
||||
reprogram MicroPython.
|
||||
"""
|
||||
% (bdev.start_sec, bdev.blocks)
|
||||
@@ -48,9 +48,9 @@ def setup():
|
||||
check_bootsec()
|
||||
print("Performing initial setup")
|
||||
wifi()
|
||||
os.VfsLfs2.mkfs(bdev)
|
||||
vfs = os.VfsLfs2(bdev)
|
||||
os.mount(vfs, "/")
|
||||
vfs.VfsLfs2.mkfs(bdev)
|
||||
fs = vfs.VfsLfs2(bdev)
|
||||
vfs.mount(fs, "/")
|
||||
with open("boot.py", "w") as f:
|
||||
f.write(
|
||||
"""\
|
||||
|
||||
Reference in New Issue
Block a user