QUERY · ISSUE
OTA partitions in ESP32-C3
bugport-esp32
I am trying to enable OTA partitions in ESP32-C3 by changing the custom partition file in sdkconfig file.
But it's not getting enabled. Can you please help?
CANDIDATE · PULL REQUEST
esp32: Add esp32.Partition class to interface to OTA functions.
port-esp32
Following on from the comment https://github.com/micropython/micropython/pull/3576#issuecomment-486954865 here is a proposal for a wrapper class for the ESP32 OTA/partition functions.
The API is based around a single Partition class. The constructor is used to create new Partition objects, and methods manipulate such objects.
from esp32 import Partition
# Constructors
Partition(Partition.FIRST, type=Partition.TYPE_APP)
Partition(Partition.FIRST, type=Partition.TYPE_DATA)
Partition(Partition.FIRST, type=Partition.TYPE_DATA, subtype=2, label='nvs')
Partition(Partition.BOOT) # get boot partition
Partition(Partition.RUNNING) # get currently running partition
# Methods
part.info() # returns a 6-tuple of (type, subtype, addr, size, label, encr)
part.readblocks(block_num, buf)
part.writeblocks(block_num, buf)
part.eraseblocks(block_num, size)
part.set_boot() # sets current as bootable, for next reset
part.get_next_update() # returns new Partition
I didn't yet test the OTA functionality
Edit: updated signatures for partition methods.