Implement firmware OTA update logic on an ESP32 using ESP-IDF's native OTA API with dual ota_0/ota_1 partitions

domain: docs.espressif.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Partition the flash with ota_0 and ota_1 app partitions plus an otadata partition (2 flash sectors, 0x2000 bytes) to track which slot is active
  2. Call esp_ota_begin() to open a handle to the inactive partition before writing new firmware
  3. Stream the downloaded firmware image into esp_ota_write() (or esp_ota_write_with_offset() for out-of-order chunks) as it arrives
  4. Call esp_ota_end() to finalize and validate the written image
  5. Call esp_ota_set_boot_partition() to mark the newly written partition as the one to boot from on next reset, then reboot

Known gotchas

Related routes

Perform an OTA firmware update to an ESPHome device via the native API OTA platform
iot · 5 steps · unrated
Build an OTA firmware update pipeline for a fleet of IoT devices with A/B partition rollback
iot-general · 6 steps · unrated
Implement a Zephyr RTOS OTA update pipeline using MCUboot swap-move mode and the SMP server over BLE
docs.zephyrproject.org · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans