esp_https_ota.rst 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ESP HTTPS OTA
  2. =============
  3. Overview
  4. --------
  5. ``esp_https_ota`` provides simplified APIs to perform firmware upgrades over HTTPS.
  6. It's an abstraction layer over existing OTA APIs.
  7. Application Example
  8. -------------------
  9. .. highlight:: c
  10. ::
  11. esp_err_t do_firmware_upgrade()
  12. {
  13. esp_http_client_config_t config = {
  14. .url = CONFIG_FIRMWARE_UPGRADE_URL,
  15. .cert_pem = (char *)server_cert_pem_start,
  16. };
  17. esp_err_t ret = esp_https_ota(&config);
  18. if (ret == ESP_OK) {
  19. esp_restart();
  20. } else {
  21. return ESP_FAIL;
  22. }
  23. return ESP_OK;
  24. }
  25. Partial Image Download over HTTPS
  26. ---------------------------------
  27. To use partial image download feature, enable ``partial_http_download`` configuration in ``esp_https_ota_config_t``.
  28. When this configuration is enabled, firmware image will be downloaded in multiple HTTP requests of specified size.
  29. Maximum content length of each request can be specified by setting ``max_http_request_size`` to required value.
  30. This option is useful while fetching image from a service like AWS S3, where mbedTLS Rx buffer size (:ref:`CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN`)
  31. can be set to lower value which is not possible without enabling this configuration.
  32. Default value of mbedTLS Rx buffer size is set to 16K. By using partial_http_download with max_http_request_size of 4K,
  33. size of mbedTLS Rx buffer can be reduced to 4K. With this confiuration, memory saving of around 12K is expected.
  34. Signature Verification
  35. ----------------------
  36. For additional security, signature of OTA firmware images can be verified. For that, refer :ref:`secure-ota-updates`
  37. API Reference
  38. -------------
  39. .. include-build-file:: inc/esp_https_ota.inc