change(image): move image_process driver from bootloader_support to esp_system

This commit is contained in:
Armando 2024-05-21 16:45:58 +08:00
parent 10d3912c70
commit d988b824d8
6 changed files with 20 additions and 12 deletions

View File

@ -28,10 +28,6 @@ if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
)
endif()
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP AND NOT BOOTLOADER_BUILD)
list(APPEND srcs "src/image_process.c")
endif()
if(CONFIG_APP_BUILD_TYPE_APP_2NDBOOT)
list(APPEND srcs
"src/bootloader_utility.c"
@ -64,7 +60,7 @@ else()
set(include_dirs "include" "bootloader_flash/include")
set(priv_include_dirs "private_include")
# heap is required for `heap_memory_layout.h` header
set(priv_requires spi_flash mbedtls efuse heap esp_bootloader_format esp_app_format esp_mm)
set(priv_requires spi_flash mbedtls efuse heap esp_bootloader_format esp_app_format)
endif()
if(BOOTLOADER_BUILD)
@ -116,8 +112,7 @@ idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES "${requires}"
PRIV_REQUIRES "${priv_requires}"
LDFRAGMENTS linker.lf)
PRIV_REQUIRES "${priv_requires}")
if(NOT BOOTLOADER_BUILD)
if(CONFIG_SECURE_SIGNED_ON_UPDATE)

View File

@ -1,5 +0,0 @@
[mapping:bootloader_support]
archive: libbootloader_support.a
entries:
if APP_BUILD_TYPE_RAM = n:
image_process (noflash)

View File

@ -30,6 +30,9 @@ entries:
usb_console:esp_usb_console_before_restart (noflash)
usb_console:esp_usb_console_on_restart_timeout (noflash)
if APP_BUILD_TYPE_RAM = n:
image_process (noflash)
[mapping:vfs_cdcacm]
archive: libvfs.a
entries:

View File

@ -8,6 +8,10 @@ target_include_directories(${COMPONENT_LIB} PRIVATE ${INCLUDE_FILES} include/pri
set(srcs "cpu_start.c" "panic_handler.c" "esp_system_chip.c")
if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
list(APPEND srcs "image_process.c")
endif()
if(CONFIG_SOC_BOD_SUPPORTED)
list(APPEND srcs "brownout.c")
endif()

View File

@ -23,6 +23,11 @@
#include "esp_private/image_process.h"
#include "esp_private/esp_cache_esp32_private.h"
/**
* ESP32 bootloader size is not enough, not enable this feature for now
*/
#define IMAGE_PROCESS_SUPPORTED_TARGETS (!CONFIG_IDF_TARGET_ESP32)
#if CONFIG_IDF_TARGET_ESP32
#define MMAP_MMU_SIZE 0x320000
#elif CONFIG_IDF_TARGET_ESP32S2
@ -94,6 +99,7 @@ static esp_err_t flash_read(size_t src_addr, void *dest, size_t size)
return ESP_OK;
}
#if IMAGE_PROCESS_SUPPORTED_TARGETS
static esp_err_t process_image_header(esp_image_metadata_t *data, uint32_t part_offset)
{
bzero(data, sizeof(esp_image_metadata_t));
@ -105,6 +111,7 @@ static esp_err_t process_image_header(esp_image_metadata_t *data, uint32_t part_
return ESP_OK;
}
#endif
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, esp_image_metadata_t *metadata, int *cnt)
{
@ -189,6 +196,7 @@ void image_process_get_flash_segments_info(uint32_t *out_drom_paddr_start, uint3
esp_err_t image_process(void)
{
#if IMAGE_PROCESS_SUPPORTED_TARGETS
esp_err_t ret = ESP_FAIL;
/**
* We use the MMU_LL_END_DROM_ENTRY_ID mmu entry as a map page for app to find the boot partition
@ -210,6 +218,9 @@ esp_err_t image_process(void)
}
mmu_ll_set_entry_invalid(0, MMU_LL_END_DROM_ENTRY_ID);
#else
(void)s_image_process_driver;
#endif
return ESP_OK;
}