Espressif ESP32-S2 Programming Manual page 1036

Table of Contents

Advertisement

Chapter 2. API Reference
Return
• Number of OTA partitions
esp_err_t
esp_ota_mark_app_valid_cancel_rollback(void)
This function is called to indicate that the running app is working well.
Return
• ESP_OK: if successful.
esp_err_t
esp_ota_mark_app_invalid_rollback_and_reboot(void)
This function is called to roll back to the previously workable app with reboot.
If rollback is successful then device will reset else API will return with error code. Checks applications on a
flash drive that can be booted in case of rollback. If the flash does not have at least one app (except the running
app) then rollback is not possible.
Return
• ESP_FAIL: if not successful.
• ESP_ERR_OTA_ROLLBACK_FAILED: The rollback is not possible due to flash does not have
any apps.
const
esp_partition_t
*esp_ota_get_last_invalid_partition(void)
Returns last partition with invalid state (ESP_OTA_IMG_INVALID or ESP_OTA_IMG_ABORTED).
Return partition.
esp_err_t
esp_ota_get_state_partition(const
Returns state for given partition.
Return
• ESP_OK: Successful.
• ESP_ERR_INVALID_ARG: partition or ota_state arguments were NULL.
• ESP_ERR_NOT_SUPPORTED: partition is not ota.
• ESP_ERR_NOT_FOUND: Partition table does not have otadata or state was not found for given
partition.
Parameters
• [in] partition: Pointer to partition.
• [out] ota_state: state of partition (if this partition has a record in otadata).
esp_err_t
esp_ota_erase_last_boot_app_partition(void)
Erase previous boot app partition and corresponding otadata select for this partition.
When current app is marked to as valid then you can erase previous app partition.
Return
• ESP_OK: Successful, otherwise ESP_ERR.
bool esp_ota_check_rollback_is_possible(void)
Checks applications on the slots which can be booted in case of rollback.
These applications should be valid (marked in otadata as not UNDEFINED, INVALID or ABORTED and crc
is good) and be able booted, and secure_version of app >= secure_version of efuse (if anti-rollback is enabled).
Return
• True: Returns true if the slots have at least one app (except the running app).
• False: The rollback is not possible.
esp_err_t esp_ota_revoke_secure_boot_public_key(esp_ota_secure_boot_public_key_index_t
Revokes the old signature digest. To be called in the application after the rollback logic.
Relevant for Secure boot v2 on ESP32-S2 where upto 3 key digests can be stored (Key #N-1, Key #N, Key
#N+1). When key #N-1 used to sign an app is invalidated, an OTA update is to be sent with an app signed with
key #N-1 & Key #N. After successfully booting the OTA app should call this function to revoke Key #N-1.
Return
• ESP_OK: If revocation is successful.
Espressif Systems
esp_partition_t
*ota_state)
1025
Submit Document Feedback
*partition, esp_ota_img_states_t
index)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF