Chapter 2. API Reference
esp_err_t do_firmware_upgrade()
{
esp_http_client_config_t config
.url
=
.cert_pem
};
esp_err_t ret
if
(ret
==
esp_restart();
}
else
{
return
}
return
ESP_OK;
}
Partial Image Download over HTTPS
To
use
partial
image
esp_https_ota_config_t. When this configuration is enabled, firmware image will be downloaded in
multiple HTTP requests of specified size. Maximum content length of each request can be specified by setting
max_http_request_size to required value.
This option is useful while fetching image from a service like AWS S3, where mbedTLS Rx buffer size
FIG_MBEDTLS_SSL_IN_CONTENT_LEN) can be set to lower value which is not possible without enabling this
configuration.
Default value of mbedTLS Rx buffer size is set to 16K. By using partial_http_download with max_http_request_size
of 4K, size of mbedTLS Rx buffer can be reduced to 4K. With this confiuration, memory saving of around 12K is
expected.
Signature Verification
For additional security, signature of OTA firmware images can be verified. For that, refer
Secure boot
API Reference
Header File
•
components/esp_https_ota/include/esp_https_ota.h
Functions
esp_err_t
esp_https_ota(const
HTTPS OTA Firmware upgrade.
This function allocates HTTPS OTA Firmware upgrade context, establishes HTTPS connection, reads image
data from HTTP stream and writes it to OTA partition and finishes HTTPS OTA Firmware upgrade operation.
This API supports URL redirection, but if CA cert of URLs differ then it should be appended to cert_pem
member of config.
Note This API handles the entire OTA operation, so if this API is being used then no other APIs from
esp_https_ota component should be called. If more information and control is needed during the
HTTPS OTA process, then one can use esp_https_ota_begin and subsequent APIs. If this API
returns successfully, esp_restart() must be called to boot from the new firmware image.
Return
• ESP_OK: OTA data updated, next reboot will use specified partition.
• ESP_FAIL: For generic failure.
• ESP_ERR_INVALID_ARG: Invalid argument
Espressif Systems
CONFIG_FIRMWARE_UPGRADE_URL,
=
(char
*)server_cert_pem_start,
=
esp_https_ota(&config);
ESP_OK) {
ESP_FAIL;
download
feature,
enable
esp_http_client_config_t
Submit Document Feedback
=
{
partial_http_download
*config)
827
configuration
in
(CON-
Secure OTA Updates Without
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?