esp32/esp32_partition: Add support for specifying block_size.

To support filesystems that use a block size different from the native
erase-page size.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2022-02-07 21:05:48 +11:00
parent 5935fa229c
commit 106a83de22
2 changed files with 70 additions and 18 deletions

View File

@@ -68,17 +68,21 @@ Flash partitions
This class gives access to the partitions in the device's flash memory and includes
methods to enable over-the-air (OTA) updates.
.. class:: Partition(id)
.. class:: Partition(id, block_size=4096)
Create an object representing a partition. *id* can be a string which is the label
of the partition to retrieve, or one of the constants: ``BOOT`` or ``RUNNING``.
*block_size* specifies the byte size of an individual block.
.. classmethod:: Partition.find(type=TYPE_APP, subtype=0xff, label=None)
.. classmethod:: Partition.find(type=TYPE_APP, subtype=0xff, label=None, block_size=4096)
Find a partition specified by *type*, *subtype* and *label*. Returns a
(possibly empty) list of Partition objects. Note: ``subtype=0xff`` matches any subtype
and ``label=None`` matches any label.
*block_size* specifies the byte size of an individual block used by the returned
objects.
.. method:: Partition.info()
Returns a 6-tuple ``(type, subtype, addr, size, label, encrypted)``.