Skip to main content

esp_ota_resume

Function esp_ota_resume 

Source
pub unsafe extern "C" fn esp_ota_resume(
    partition: *const esp_partition_t,
    erase_size: usize,
    image_offset: usize,
    out_handle: *mut u32,
) -> i32
Expand description

@brief Resume an interrupted OTA update by continuing to write to the specified partition.

This function is used when an OTA update was previously started and needs to be resumed after an interruption. It continues the OTA process from the specified offset within the partition.

Unlike esp_ota_begin(), this function does not erase the partition which receives the OTA update, but rather expects that part of the image has already been written correctly, and it resumes writing from the given offset.

@param partition Pointer to info for the partition which is receiving the OTA update. Required. @param erase_size Specifies how much flash memory to erase before resuming OTA, depending on whether a sequential write or a bulk erase is being used. @param image_offset Offset from where to resume the OTA process. Should be set to the number of bytes already written. @param out_handle On success, returns a handle that should be used for subsequent esp_ota_write() and esp_ota_end() calls.

@return

  • ESP_OK: OTA operation resumed successfully.
  • ESP_ERR_INVALID_ARG: partition, out_handle were NULL or image_offset arguments is negative, 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, cannot 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.