Skip to main content

esp_ota_set_final_partition

Function esp_ota_set_final_partition 

Source
pub unsafe extern "C" fn esp_ota_set_final_partition(
    handle: esp_ota_handle_t,
    final_: *const esp_partition_t,
    finalize_with_copy: bool,
) -> esp_err_t
Expand description

@brief Set the final destination partition for OTA update

This function configures the specified final partition as the destination for the OTA update. It also allows setting a flag to indicate if the image should be copied from the staging partition to the final partition after the OTA update completes. Otherwise, copying will need to be handled by custom code using esp_partition_copy().

@note This can be called after esp_ota_begin() and before the OTA update has started (before esp_ota_write()).

@param handle OTA update handle obtained from esp_ota_begin(). @param final Pointer to the final destination partition where the new image will be verified and potentially finalized. This partition must not be NULL. @param finalize_with_copy Boolean flag indicating if the downloaded image should be copied from the staging partition to the final partition upon completion. Set to False if you intend to perform the final copy process manually later.

@return - ESP_OK: final destination partition set successfully. - ESP_ERR_INVALID_STATE: Once the OTA update has started, changing the final destination partition is prohibited. - ESP_ERR_INVALID_ARG: Invalid arguments were passed (e.g., final partition is NULL). - ESP_ERR_NOT_FOUND: OTA handle not found or final partition verification failed.