1
0
Fork 0
mirror of https://github.com/imjasonh/esp32 synced 2026-07-06 23:52:24 +00:00
esp32/sdkconfig.defaults.in
Jason Hall a91cf62da6 Add device-side OTA loop (OTA phase 2)
src/ota.rs polls ghcr.io every 60s on a dedicated 32 KB pthread,
fetches the manifest with an anonymous Bearer token, and on a digest
mismatch streams the layer into the inactive OTA partition while
verifying SHA256 against the descriptor as it goes. Aborts and
bails on size or SHA mismatch; otherwise sets the boot partition,
persists pending_digest to NVS, and reboots.

main.rs detects PENDING_VERIFY on boot and only calls
esp_ota_mark_app_valid_cancel_rollback() after Wi-Fi + the existing
HTTPS bringup checks pass -- so an OTA that breaks networking
auto-reverts on the bootloader's next boot. After mark-valid,
pending_digest is promoted to last_digest in NVS.

GIT_SHA is baked into the firmware via env!() at compile time
(set by the Makefile from `git rev-parse --short HEAD`) and logged
on boot, so we can see which build is running.

Bumped CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT to 16 KB; 8 KB
stack-overflowed during HTTPS + JSON + SHA work.

`make monitor` now auto-passes --non-interactive when stdout is
not a TTY, so it works in scripts and background tasks.

Verified end-to-end against ghcr.io/imjasonh/esp32 -- published v1,
flashed via USB, bumped a visible version string, published v2,
and the device polled, downloaded, SHA-verified, rebooted, and
marked the new image valid after bringup. Zero USB intervention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 12:53:19 -04:00

23 lines
1.1 KiB
Text

CONFIG_ESP_MAIN_TASK_STACK_SIZE=7000
# Default for std::thread::spawn() without explicit stack_size. Bumped from
# 8192 because anything that does HTTPS + JSON + SHA blows past 8 KB.
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=16384
# HTTPS via ESP-IDF's bundled root CA store (esp_crt_bundle_attach in main.rs)
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y
# OTA: custom partition table with two app slots, plus app-rollback support
# so a bad OTA can be reverted by the bootloader on next boot.
CONFIG_PARTITION_TABLE_CUSTOM=y
# Absolute path because IDF resolves this relative to its CMake project,
# which for embuild is the synthetic project under target/, not our repo
# root. The Makefile generates sdkconfig.defaults from this template
# (sdkconfig.defaults.in), substituting @PROJECT_DIR@ at build time.
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="@PROJECT_DIR@/partitions.csv"
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
# Inland board has 4MB flash; default IDF assumes 2MB which is too small
# for our 1.5MB-each OTA partition layout.
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"