feat(app_update): esp_ota_set_boot_partition_without_validate()

This commit is contained in:
Nebojša Cvetković
2025-12-18 11:24:33 +00:00
parent f6aaf22278
commit 47ab3735c2
2 changed files with 26 additions and 0 deletions
+9
View File
@@ -682,6 +682,15 @@ esp_err_t esp_ota_set_boot_partition(const esp_partition_t *partition)
return ESP_ERR_OTA_VALIDATE_FAILED;
}
return esp_ota_set_boot_partition_without_validate(partition);
}
esp_err_t esp_ota_set_boot_partition_without_validate(const esp_partition_t* partition)
{
if (partition == NULL) {
return ESP_ERR_INVALID_ARG;
}
// if set boot partition to factory bin ,just format ota info partition
if (partition->type == ESP_PARTITION_TYPE_APP) {
if (partition->subtype == ESP_PARTITION_SUBTYPE_APP_FACTORY) {
@@ -209,6 +209,8 @@ esp_err_t esp_ota_abort(esp_ota_handle_t handle);
/**
* @brief Configure OTA data for a new boot partition
*
* Equivalent to esp_image_verify() followed by esp_ota_set_boot_partition_without_validate().
*
* @note If this function returns ESP_OK, calling esp_restart() will boot the newly configured app partition.
*
* @param partition Pointer to info for partition containing app image to boot.
@@ -222,6 +224,21 @@ esp_err_t esp_ota_abort(esp_ota_handle_t handle);
*/
esp_err_t esp_ota_set_boot_partition(const esp_partition_t* partition);
/**
* @brief Configure OTA data for a new boot partition without validating the image
*
* @note If this function returns ESP_OK, calling esp_restart() will boot the newly configured app partition.
*
* @param partition Pointer to info for partition containing app image to boot.
*
* @return
* - ESP_OK: OTA data updated, next reboot will use specified partition.
* - ESP_ERR_INVALID_ARG: partition argument was NULL or didn't point to a valid OTA partition of type "app".
* - ESP_ERR_NOT_FOUND: OTA data partition not found.
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash erase or write failed.
*/
esp_err_t esp_ota_set_boot_partition_without_validate(const esp_partition_t* partition);
/**
* @brief Get partition info of currently configured boot app
*