Add portable LoRa OTA repeater builds

This commit is contained in:
mikecarper committed 2026-07-22 10:05:52 -07:00
1 parent 371d86c4b1
commit 7abb5fb95b
7 files changed
+1323 -1169

No files matched your search

+25 -7
View File
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
"""Fail when an ESP32 app image (including EndF) exceeds its app partition."""
"""Fail when an ESP32 app image (including EndF) exceeds its app partition.
An optional third argument additionally enforces a portable maximum image size.
MeshCore's LoRa-OTA ESP32 artifacts use 0x140000 bytes: the legacy app slot
starts at 0x10000 and the next OTA slot begins at 0x150000.
"""
from __future__ import annotations
@@ -34,12 +39,16 @@ def app_partition_size(table: bytes) -> tuple[str, int]:
def main() -> int:
if len(sys.argv) != 3:
print(f"usage: {Path(sys.argv[0]).name} FIRMWARE.BIN PARTITIONS.BIN", file=sys.stderr)
if len(sys.argv) not in (3, 4):
print(
f"usage: {Path(sys.argv[0]).name} FIRMWARE.BIN PARTITIONS.BIN [MAX_IMAGE_BYTES]",
file=sys.stderr,
)
return 2
firmware_path = Path(sys.argv[1])
partition_path = Path(sys.argv[2])
portable_limit = int(sys.argv[3], 0) if len(sys.argv) == 4 else None
try:
image_size = firmware_path.stat().st_size
label, limit = app_partition_size(partition_path.read_bytes())
@@ -55,10 +64,19 @@ def main() -> int:
)
return 1
print(
f"ESP32 app image fits {label}: {image_size}/{limit} bytes "
f"({limit - image_size} bytes free)"
)
if portable_limit is not None and image_size > portable_limit:
print(
f"ESP32 app image is {image_size} bytes, exceeding portable LoRa-OTA "
f"slot 0x10000..0x150000 ({portable_limit} bytes) by "
f"{image_size - portable_limit} bytes",
file=sys.stderr,
)
return 1
message = f"ESP32 app image fits {label}: {image_size}/{limit} bytes ({limit - image_size} bytes free)"
if portable_limit is not None:
message += f"; portable LoRa-OTA slot: {portable_limit - image_size} bytes free"
print(message)
return 0