fix(esp_partition): Support reading unencrypted partitions by the bootloader

- When flash encryption is enable to support reading a partition that is not
marked as "encrypted", the `esp_partition_read()` API of bootloader build
should be redirected to the `bootloader_flash_read()` API.
This commit is contained in:
harshal.patil
2025-01-09 14:14:56 +05:30
parent eb05db30fc
commit 4c38499303
2 changed files with 52 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -74,6 +74,18 @@ const esp_partition_t* esp_partition_find_first(esp_partition_type_t type, esp_p
esp_err_t esp_partition_read(const esp_partition_t *partition,
size_t src_offset, void *dst, size_t size)
{
assert(partition != NULL);
if (src_offset > partition->size) {
return ESP_ERR_INVALID_ARG;
}
if (size > partition->size - src_offset) {
return ESP_ERR_INVALID_SIZE;
}
if (!partition->encrypted) {
return bootloader_flash_read(partition->address + src_offset, dst, size, false);
}
const void *buf;
// log call to mmap