Skip to main content

esp_ota_end

Function esp_ota_end 

Source
pub unsafe extern "C" fn esp_ota_end(
    handle: esp_ota_handle_t,
) -> esp_err_t
Expand description

@brief Finish OTA update and validate newly written app image.

@param handle Handle obtained from esp_ota_begin().

@note After calling esp_ota_end(), the handle is no longer valid and any memory associated with it is freed (regardless of result). @note If either the final or staging partitions were for the bootloader, then at the end of this function, the bootloader is reset to its default offset: esp_image_bootloader_offset_set(ESP_PRIMARY_BOOTLOADER_OFFSET)

If the finalize_with_copy option is set, the staging partition will be copied to the final partition at the end of this function. Otherwise, copying will need to be handled by custom code using esp_partition_copy().

@return

  • ESP_OK: Newly written OTA app image is valid.
  • ESP_ERR_NOT_FOUND: OTA handle was not found.
  • ESP_ERR_INVALID_ARG: Handle was never written to.
  • ESP_ERR_OTA_VALIDATE_FAILED: OTA image is invalid (either not a valid app image, or - if secure boot is enabled - signature failed to verify.)
  • ESP_ERR_INVALID_STATE: If flash encryption is enabled, this result indicates an internal error writing the final encrypted bytes to flash.