ota.rst 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Over The Air Updates (OTA)
  2. ==========================
  3. OTA Process Overview
  4. --------------------
  5. The OTA update mechanism allows a device to update itself based on data received while the normal firmware is running
  6. (for example, over WiFi or Bluetooth.)
  7. OTA requires configuring the :doc:`Partition Table <../../api-guides/partition-tables>` of the device with at least two "OTA app slot"
  8. partitions (ie `ota_0` and `ota_1`) and an "OTA Data Partition".
  9. The OTA operation functions write a new app firmware image to whichever OTA app slot is not currently being used for
  10. booting. Once the image is verified, the OTA Data partition is updated to specify that this image should be used for the
  11. next boot.
  12. .. _ota_data_partition:
  13. OTA Data Partition
  14. ------------------
  15. An OTA data partition (type ``data``, subtype ``ota``) must be included in the :doc:`Partition Table <../../api-guides/partition-tables>`
  16. of any project which uses the OTA functions.
  17. For factory boot settings, the OTA data partition should contain no data (all bytes erased to 0xFF). In this case the
  18. esp-idf software bootloader will boot the factory app if it is present in the the partition table. If no factory app is
  19. included in the partition table, the first available OTA slot (usually ``ota_0``) is booted.
  20. After the first OTA update, the OTA data partition is updated to specify which OTA app slot partition should be booted next.
  21. The OTA data partition is two flash sectors (0x2000 bytes) in size, to prevent problems if there is a power failure
  22. while it is being written. Sectors are independently erased and written with matching data, and if they disagree a
  23. counter field is used to determine which sector was written more recently.
  24. .. _secure-ota-updates:
  25. Secure OTA Updates Without Secure boot
  26. --------------------------------------
  27. The verification of signed OTA updates can be performed even without enabling hardware secure boot. For doing so, refer :ref:`signed-app-verify`
  28. See also
  29. --------
  30. * :doc:`Partition Table documentation <../../api-guides/partition-tables>`
  31. * :doc:`Lower-Level SPI Flash/Partition API <../storage/spi_flash>`
  32. * :doc:`ESP HTTPS OTA <esp_https_ota>`
  33. Application Example
  34. -------------------
  35. End-to-end example of OTA firmware update workflow: :example:`system/ota`.
  36. API Reference
  37. -------------
  38. .. include:: /_build/inc/esp_ota_ops.inc