Espressif ESP32-S2 Programming Manual page 1033

Table of Contents

Advertisement

Chapter 2. API Reference
int esp_ota_get_app_elf_sha256(char *dst, size_t size)
Fill the provided buffer with SHA256 of the ELF file, formatted as hexadecimal, null-terminated. If the buffer
size is not sufficient to fit the entire SHA256 in hex plus a null terminator, the largest possible number of bytes
will be written followed by a null.
Return Number of bytes written to dst (including null terminator)
Parameters
• dst: Destination buffer
• size: Size of the buffer
esp_err_t
esp_ota_begin(const
Commence an OTA update writing to the specified partition.
The specified partition is erased to the specified image size.
If image size is not yet known, pass OTA_SIZE_UNKNOWN which will cause the entire partition to be erased.
On success, this function allocates memory that remains in use until esp_ota_end() is called with the returned
handle.
Note:
If
the
the
ESP_OTA_IMG_PENDING_VERIFY
ESP_ERR_OTA_ROLLBACK_INVALID_STATE error. Confirm the running app before to run download
a new app, use esp_ota_mark_app_valid_cancel_rollback() function for it (this should be done as early as
possible when you first download a new application).
Return
• ESP_OK: OTA operation commenced successfully.
• ESP_ERR_INVALID_ARG: partition or out_handle arguments were NULL, or partition doesn't
point to an OTA app partition.
• ESP_ERR_NO_MEM: Cannot allocate memory for OTA operation.
• ESP_ERR_OTA_PARTITION_CONFLICT: Partition holds the currently running firmware, can-
not update in place.
• ESP_ERR_NOT_FOUND: Partition argument not found in partition table.
• ESP_ERR_OTA_SELECT_INFO_INVALID: The OTA data partition contains invalid data.
• ESP_ERR_INVALID_SIZE: Partition doesn't fit in configured flash size.
• ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
• ESP_ERR_OTA_ROLLBACK_INVALID_STATE: If the running app has not confirmed state.
Before performing an update, the application must be valid.
Parameters
• partition: Pointer to info for partition which will receive the OTA update. Required.
• image_size: Size of new OTA app image. Partition will be erased in order to receive this size
of image. If 0 or OTA_SIZE_UNKNOWN, the entire partition is erased.
• out_handle: On success, returns a handle which should be used for subsequent esp_ota_write()
and esp_ota_end() calls.
esp_err_t esp_ota_write(esp_ota_handle_t
Write OTA update data to partition.
This function can be called multiple times as data is received during the OTA operation. Data is written
sequentially to the partition.
Return
• ESP_OK: Data was written to flash successfully.
• ESP_ERR_INVALID_ARG: handle is invalid.
• ESP_ERR_OTA_VALIDATE_FAILED: First byte of image contains invalid app image magic byte.
• ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
• ESP_ERR_OTA_SELECT_INFO_INVALID: OTA data partition has invalid contents
Parameters
• handle: Handle obtained from esp_ota_begin
• data: Data buffer to write
• size: Size of data buffer in bytes.
Espressif Systems
esp_partition_t
*partition, size_t image_size,
*out_handle)
rollback
option
is
handle, const void *data, size_t size)
1022
Submit Document Feedback
enabled
and
the
running
state
then
it
esp_ota_handle_t
application
has
will
lead
to
the
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?

Table of Contents

Save PDF