Add MeshTower V2 SD-backed LoRa OTA

This commit is contained in:
mikecarper committed 2026-08-03 12:49:36 -07:00
1 parent 9b8c68d926
commit 4ed3307c6c
24 files changed
+833 -37

No files matched your search

+5
View File
@@ -58,6 +58,11 @@ DEFAULT_BLOCK_SIZE = 1024
# the staged .mota must begin above it. Keep in sync with OtaFlashLayout_nrf52.h / the OTAFIX bootloader.
NRF52_INPLACE_MEMORY = 0x00098000
# MeshTower V2's SD-backed OTA target keeps the staged .mota off-chip, so the application may use the
# complete S140 v6 application region up to InternalFS instead of leaving room for internal staging.
# This is deliberately target-specific: other nRF52 OTA builds still need NRF52_INPLACE_MEMORY above.
NRF52_SD_APP_MEMORY = 0x000C7000
# ---------------------------------------------------------------------------
# Multihash helpers (sha2-256 truncations)
+6 -3
View File
@@ -148,9 +148,12 @@ def _append_endf_hex(source, target, env): # Intel-HEX path (nRF52: app f
body = bytes(ih.tobinarray(start=app_start, size=app_end - app_start))
ident = _firmware_ident()
out, h8 = ml.ensure_endf(body, ident)
if len(out) > ml.NRF52_INPLACE_MEMORY:
raise RuntimeError(f"nRF52 OTA image is {len(out)} bytes; in-place limit is "
f"{ml.NRF52_INPLACE_MEMORY} bytes")
sd_backed = _cppdef("OTA_SD_STORE") is not None
image_limit = ml.NRF52_SD_APP_MEMORY if sd_backed else ml.NRF52_INPLACE_MEMORY
limit_name = "SD application" if sd_backed else "in-place"
if len(out) > image_limit:
raise RuntimeError(f"nRF52 OTA image is {len(out)} bytes; {limit_name} limit is "
f"{image_limit} bytes")
if len(out) == len(body):
print(f"EndF: already present in {os.path.basename(path)} (no change)"); return
trailer = out[len(body):] # the EndF trailer (56 bytes with identity)