← index #9800PR #5027
Related · high · value 0.218
QUERY · ISSUE

Working with filesystems - Hybrid (ESP32)

openby Tangerinoopened 2022-11-01updated 2024-09-02
docsport-esp32

In the example of using alternate partition in ESP32 the example does not work

import esp32, os
p = esp32.Partition.find(esp32.Partition.TYPE_DATA, label='foo')
os.mount(p, '/foo')

My partition table

ID Type   Subtype   Address  Size     Label    Encripted
 0   0      0         65536  2031616  factory  False
 1   1      2         36864    24576  nvs      False
 1   1      1         61440     4096  phy_init False
 1   1      129     2097152  2097152  vfs      False
 1   1      129     4194304  4194304  data     False

The result when running the example

>>> import esp32, os
p = esp32.Partition.find(esp32.Partition.TYPE_DATA, label='data')
os.mount(p, '/foo')
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
AttributeError: 'list' object has no attribute 'readblocks'
>>> 
CANDIDATE · PULL REQUEST

esp32: Add VFS FAT partition to partitions.csv and mount it as the FS.

closedby dpgeorgeopened 2019-08-20updated 2019-09-10

This PR uses the newly-added esp32.Partition class to replace the existing FlashBdev class. Partition objects implement the block protocol so can be directly mounted via uos.mount(). This has the following benefits:

  • allows the filesystem partition location and size to be specified in partitions.csv, and overridden by a particular board
  • very easily allows to have multiple filesystems by simply adding extra entries to partitions.csv
  • improves efficiency/speed of filesystem operations because the block device is implemented fully in C
  • opens the possibility to have encrypted flash storage (since Partitions can be encrypted)

Note that this patch is fully backwards compatible: existing filesystems remain untouched and work with this new code.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied