← index #8382PR #4910
Related · high · value 3.951
QUERY · ISSUE

ESP32: feature request Partition

openby chrisovergaauwopened 2022-03-04updated 2024-09-08
enhancementport-esp32

related to: #8380

it would be nice if Partition.get_next_update() would also accept the block_size argument.
This way you won't be locked in to a certain block_size after initial deployment when doing OTA updates.

CANDIDATE · PULL REQUEST

esp32: Add esp32.Partition class to interface to OTA functions.

closedby dpgeorgeopened 2019-07-09updated 2020-04-07
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.

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