Keep ESP32 OTA images within legacy slot

This commit is contained in:
mikecarper committed 2026-07-22 15:04:40 -07:00
1 parent d26a45f15a
commit b98a7a7b54
18 files changed
+287 -36

No files matched your search

+14 -3
View File
@@ -177,9 +177,20 @@ class InputError(RuntimeError):
super(InputError, self).__init__(e)
def main():
bundle = CertificateBundle()
def main():
# Portable observer presets pin their required roots directly in
# MQTTPresets.h. Keep the embedded bundle structurally valid but empty so
# custom TLS trust stores do not consume 66 KB of the legacy app slot.
if "observer_mqtt" in env.subst("$PIOENV").lower():
os.makedirs(binary_dir, exist_ok=True)
output_file = os.path.join(binary_dir, ca_bundle_bin_file)
with open(output_file, 'wb') as f:
f.write(struct.pack('>H', 0))
status('Created empty portable-observer certificate bundle')
return
bundle = CertificateBundle()
try:
cert_source = env.GetProjectOption("board_ssl_cert_source")
+27
View File
@@ -0,0 +1,27 @@
Import("env")
import os
def has_define(name):
for define in env.get("CPPDEFINES", []):
if define == name:
return True
if isinstance(define, str) and define.startswith(name + "="):
return True
if isinstance(define, (tuple, list)) and define and define[0] == name:
return True
return False
build_flags = str(env.get("BUILD_FLAGS", "")) + " " + os.environ.get("PLATFORMIO_BUILD_FLAGS", "")
pio_env = env.subst("$PIOENV").lower()
if (has_define("PORTABLE_ESP32_NANO_LIBC") or
"PORTABLE_ESP32_NANO_LIBC" in build_flags or
os.environ.get("MESHCORE_PORTABLE_NANO_LIBC") == "1" or
"observer_mqtt" in pio_env or "bridge_espnow" in pio_env):
# newlib-nano provides the same C ABI with a substantially smaller printf
# implementation. These profiles omit display, GPS, external sensors, and
# the general CLI paths that require floating-point printf.
env.Append(LINKFLAGS=["--specs=nano.specs"])