Files
esp-idf/examples/system/ota/partitions_ota/main/partition_utils.h
T
Konstantin Kondrashov 97d150d69a feat(app_update): OTA update bootloader, partition_table and other partitions
Passive app partition can be used as the staging partition where a new image is loaded.
Then copy it to the final partition.

Closes: https://github.com/espressif/esp-idf/issues/14195
Closes: https://github.com/espressif/esp-idf/issues/13824
2024-11-07 13:48:51 +02:00

40 lines
1.5 KiB
C

/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "esp_partition.h"
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Find unallocated space in the partition table.
*
* This function searches for a contiguous space in the specified flash memory chip
* that can accommodate a region of the given size and is not allocated to any partition.
* It starts searching from the specifies start_offset and continues until the end of the flash memory.
*
* @param[in] flash_chip Pointer to the flash chip structure. If NULL, the default flash chip (internal) is used.
* @param[in] required_size Size of the required unallocated space in bytes.
* @param[in] start_offset Starting offset in the flash memory from where the search should begin.
* @param[out] found_offset Pointer where the offset of the found unallocated space will be stored.
* @param[out] found_size Pointer where the actual size of the found unallocated space will be stored (optional, if it is NULL).
*
* @return
* - ESP_OK: Unallocated space of the required size was found.
* - ESP_ERR_INVALID_ARG: The found_offset parameter is NULL or the required_size is invalid (e.g., 0).
* - ESP_ERR_NOT_FOUND: No suitable unallocated space was found.
*/
esp_err_t partition_utils_find_unallocated(esp_flash_t *flash_chip, size_t required_size, uint32_t start_offset, uint32_t *found_offset, size_t *found_size);
#ifdef __cplusplus
}
#endif