@@ -108,11 +108,11 @@ RAM using a ``bytearray``::
108108
109109It can be used as follows::
110110
111- import os
111+ import vfs
112112
113113 bdev = RAMBlockDev(512, 50)
114- os .VfsFat.mkfs(bdev)
115- os .mount(bdev, '/ramdisk')
114+ vfs .VfsFat.mkfs(bdev)
115+ vfs .mount(bdev, '/ramdisk')
116116
117117An example of a block device that supports both the simple and extended
118118interface (i.e. both signatures and behaviours of the
@@ -150,11 +150,11 @@ interface (i.e. both signatures and behaviours of the
150150As it supports the extended interface, it can be used with :class: `littlefs
151151<vfs.VfsLfs2> `::
152152
153- import os
153+ import vfs
154154
155155 bdev = RAMBlockDev(512, 50)
156- os .VfsLfs2.mkfs(bdev)
157- os .mount(bdev, '/ramdisk')
156+ vfs .VfsLfs2.mkfs(bdev)
157+ vfs .mount(bdev, '/ramdisk')
158158
159159Once mounted, the filesystem (regardless of its type) can be used as it
160160normally would be used from Python code, for example::
@@ -197,16 +197,16 @@ recommended to use littlefs instead.
197197To format the entire flash using FAT::
198198
199199 # ESP8266 and ESP32
200- import os
201- os .umount('/')
202- os .VfsFat.mkfs(bdev)
203- os .mount(bdev, '/')
200+ import vfs
201+ vfs .umount('/')
202+ vfs .VfsFat.mkfs(bdev)
203+ vfs .mount(bdev, '/')
204204
205205 # STM32
206- import os, pyb
207- os .umount('/flash')
208- os .VfsFat.mkfs(pyb.Flash(start=0))
209- os .mount(pyb.Flash(start=0), '/flash')
206+ import os, vfs, pyb
207+ vfs .umount('/flash')
208+ vfs .VfsFat.mkfs(pyb.Flash(start=0))
209+ vfs .mount(pyb.Flash(start=0), '/flash')
210210 os.chdir('/flash')
211211
212212Littlefs
@@ -222,16 +222,16 @@ resistant to filesystem corruption.
222222To format the entire flash using littlefs v2::
223223
224224 # ESP8266 and ESP32
225- import os
226- os .umount('/')
227- os .VfsLfs2.mkfs(bdev)
228- os .mount(bdev, '/')
225+ import vfs
226+ vfs .umount('/')
227+ vfs .VfsLfs2.mkfs(bdev)
228+ vfs .mount(bdev, '/')
229229
230230 # STM32
231- import os, pyb
232- os .umount('/flash')
233- os .VfsLfs2.mkfs(pyb.Flash(start=0))
234- os .mount(pyb.Flash(start=0), '/flash')
231+ import os, vfs, pyb
232+ vfs .umount('/flash')
233+ vfs .VfsLfs2.mkfs(pyb.Flash(start=0))
234+ vfs .mount(pyb.Flash(start=0), '/flash')
235235 os.chdir('/flash')
236236
237237A littlefs filesystem can be still be accessed on a PC over USB MSC using the
@@ -264,14 +264,14 @@ block devices spanning a subset of the flash device.
264264For example, to configure the first 256kiB as FAT (and available over USB MSC),
265265and the remainder as littlefs::
266266
267- import os, pyb
268- os .umount('/flash')
267+ import os, vfs, pyb
268+ vfs .umount('/flash')
269269 p1 = pyb.Flash(start=0, len=256*1024)
270270 p2 = pyb.Flash(start=256*1024)
271- os .VfsFat.mkfs(p1)
272- os .VfsLfs2.mkfs(p2)
273- os .mount(p1, '/flash')
274- os .mount(p2, '/data')
271+ vfs .VfsFat.mkfs(p1)
272+ vfs .VfsLfs2.mkfs(p2)
273+ vfs .mount(p1, '/flash')
274+ vfs .mount(p2, '/data')
275275 os.chdir('/flash')
276276
277277This might be useful to make your Python files, configuration and other
@@ -282,9 +282,9 @@ failure, etc.
282282The partition at offset ``0 `` will be mounted automatically (and the filesystem
283283type automatically detected), but you can add::
284284
285- import os , pyb
285+ import vfs , pyb
286286 p2 = pyb.Flash(start=256*1024)
287- os .mount(p2, '/data')
287+ vfs .mount(p2, '/data')
288288
289289to ``boot.py `` to mount the data partition.
290290
@@ -297,7 +297,7 @@ define an arbitrary partition layout.
297297At boot, the partition named "vfs" will be mounted at ``/ `` by default, but any
298298additional partitions can be mounted in your ``boot.py `` using::
299299
300- import esp32, os
300+ import esp32, vfs
301301 p = esp32.Partition.find(esp32.Partition.TYPE_DATA, label='foo')
302- os .mount(p, '/foo')
302+ vfs .mount(p, '/foo')
303303
0 commit comments