Chapter 2. API Reference
image content. The hash is verified before returning, if app content is invalid then the function returns
ESP_ERR_IMAGE_INVALID. For apps without SHA-256 appended to the image, the result is the SHA-
256 of all bytes in the app image. For other partition types, the result is the SHA-256 of the entire partition.
Return
• ESP_OK: In case of successful operation.
• ESP_ERR_INVALID_ARG: The size was 0 or the sha_256 was NULL.
• ESP_ERR_NO_MEM: Cannot allocate memory for sha256 operation.
• ESP_ERR_IMAGE_INVALID: App partition doesn't contain a valid app image.
• ESP_FAIL: An allocation error occurred.
Parameters
• [in] partition: Pointer to info for partition containing app or data. (fields: address, size and
type, are required to be filled).
• [out] sha_256: Returned SHA-256 digest for a given partition.
bool esp_partition_check_identity(const
Check for the identity of two partitions by SHA-256 digest.
Return
• True: In case of the two firmware is equal.
• False: Otherwise
Parameters
• [in] partition_1: Pointer to info for partition 1 containing app or data. (fields: address, size
and type, are required to be filled).
• [in] partition_2: Pointer to info for partition 2 containing app or data. (fields: address, size
and type, are required to be filled).
esp_err_t esp_partition_register_external(esp_flash_t
Register a partition on an external flash chip.
This API allows designating certain areas of external flash chips (identified by the
partitions. This allows using them with components which access SPI flash through the esp_partition API.
Return
• ESP_OK on success
• ESP_ERR_NOT_SUPPORTED if CONFIG_CONFIG_SPI_FLASH_USE_LEGACY_IMPL is
enabled
• ESP_ERR_NO_MEM if memory allocation has failed
• ESP_ERR_INVALID_ARG if the new partition overlaps another partition on the same flash chip
• ESP_ERR_INVALID_SIZE if the partition doesn't fit into the flash chip size
Parameters
• flash_chip: Pointer to the structure identifying the flash chip
• offset: Address in bytes, where the partition starts
• size: Size of the partition in bytes
• label: Partition name
• type: One of the partition types (ESP_PARTITION_TYPE_*), or an integer. Note that applica-
tions can not be booted from external flash chips, so using ESP_PARTITION_TYPE_APP is not
supported.
• subtype: One of the partition subtypes (ESP_PARTITION_SUBTYPE_*), or an integer.
• [out]
esp_partition_t
esp_err_t
esp_partition_deregister_external(const
Deregister the partition previously registered using esp_partition_register_external.
Return
• ESP_OK on success
• ESP_ERR_NOT_FOUND if the partition pointer is not found
Espressif Systems
*partition_2)
out_partition: Output, if non-NULL, receives the pointer to the resulting
structure
Submit Document Feedback
esp_partition_t
*partition_1, const
*flash_chip, size_t offset, size_t
size, const char *label,
type,
esp_partition_subtype_t
esp_partition_t
**out_partition)
esp_partition_t
760
esp_partition_t
esp_partition_type_t
subtype, const
esp_flash_t
structure) as
*partition)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?