8#include <esp_idf_version.h>
9#include <esp_ota_ops.h>
15#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2) || \
16 (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 3) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 4, 0))
17#define USE_OTA_BLOCK_ERASE_AHEAD
22#ifdef USE_OTA_PARTITIONS
24static constexpr size_t PARTITION_TABLE_BUFFER_SIZE = ESP_PARTITION_TABLE_MAX_LEN;
45#ifdef USE_OTA_PARTITIONS
56 PartitionTablePlan &plan);
73#ifdef USE_OTA_BLOCK_ERASE_AHEAD
76#ifdef USE_OTA_SIGNED_VERIFICATION_MULTI_KEY
79 bool verify_signed_image_(
const esp_partition_t *incoming);
83 esp_ota_handle_t update_handle_{0};
84 const esp_partition_t *partition_{
nullptr};
86#ifdef USE_OTA_BLOCK_ERASE_AHEAD
87 size_t erased_end_{0};
89 char expected_bin_md5_[32];
91#ifdef USE_OTA_PARTITIONS
95 uint8_t buf_[PARTITION_TABLE_BUFFER_SIZE];
96 size_t buf_written_{0};
97 size_t image_size_{0};
98 const esp_partition_t *partition_table_part_{
nullptr};
99 const esp_partition_t *bootloader_part_{
nullptr};
OTAResponseTypes setup_bootloader_staging_()
OTAResponseTypes update_partition_table_()
void set_update_md5(const char *md5)
OTAResponseTypes finalize_bootloader_update_(esp_err_t ota_end_err)
OTAResponseTypes begin(size_t image_size, ota::OTAType ota_type=ota::OTA_TYPE_UPDATE_APP)
OTAResponseTypes prepare_bootloader_update_(size_t image_size)
static constexpr bool supports_compression()
OTAResponseTypes register_and_validate_bootloader_part_()
OTAResponseTypes write(uint8_t *data, size_t len)
OTAResponseTypes validate_new_partition_table_(uint32_t running_app_offset, size_t running_app_size, PartitionTablePlan &plan)
bool is_app_or_bootloader_update_() const
OTAResponseTypes hold_lock_if_ok_(OTAResponseTypes result)
OTAResponseTypes register_and_validate_partition_table_part_()
Serializes flash updates.
void hold_until_reboot()
Keep the lock set until reboot; is_held() becomes false.
@ OTA_TYPE_UPDATE_BOOTLOADER
void get_running_app_position(uint32_t &offset, size_t &size)
std::unique_ptr< ArduinoLibreTinyOTABackend > make_ota_backend()
const esp_partition_t * copy_dest_part