Update dynamic memory calculation process

The order of partitions should also be taken into account as the factory partition may be
allocated for a bootloader (e.g. Adafruit's custom partition file with a UF2 bootloader) and
appear after ota_0 used for app
This commit is contained in:
valeros
2023-08-02 13:00:27 +03:00
parent 650fb5d598
commit 07820cf6f4
+7 -4
View File
@@ -145,11 +145,14 @@ def _update_max_upload_size(env):
}
# One of the `factory` or `ota_0` partitions is used to determine available memory
# size. If both partitions are set, then the `factory` partition is used by default
# size. If both partitions are set, we should prefer the `factory`, but there are
# cases (e.g. Adafruit's `partitions-4MB-tinyuf2.csv`) that uses the `factory`
# partition for their UF2 bootloader. So let's use the first match
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#subtype
max_upload_size = sizes.get("factory", sizes.get("ota_0", 0))
if max_upload_size:
board.update("upload.maximum_size", max_upload_size)
for p in _parse_partitions(env):
if p["type"] in ("0", "app") and p["subtype"] in ("factory", "ota_0"):
board.update("upload.maximum_size", _parse_size(p["size"]))
break
def _to_unix_slashes(path):