forked from espressif/esp-idf
change(image): move image_process driver from bootloader_support to esp_system
This commit is contained in:
@ -28,10 +28,6 @@ if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
|||||||
)
|
)
|
||||||
endif()
|
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)
|
if(CONFIG_APP_BUILD_TYPE_APP_2NDBOOT)
|
||||||
list(APPEND srcs
|
list(APPEND srcs
|
||||||
"src/bootloader_utility.c"
|
"src/bootloader_utility.c"
|
||||||
@ -64,7 +60,7 @@ else()
|
|||||||
set(include_dirs "include" "bootloader_flash/include")
|
set(include_dirs "include" "bootloader_flash/include")
|
||||||
set(priv_include_dirs "private_include")
|
set(priv_include_dirs "private_include")
|
||||||
# heap is required for `heap_memory_layout.h` header
|
# 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()
|
endif()
|
||||||
|
|
||||||
if(BOOTLOADER_BUILD)
|
if(BOOTLOADER_BUILD)
|
||||||
@ -116,8 +112,7 @@ idf_component_register(SRCS "${srcs}"
|
|||||||
INCLUDE_DIRS "${include_dirs}"
|
INCLUDE_DIRS "${include_dirs}"
|
||||||
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
|
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
|
||||||
REQUIRES "${requires}"
|
REQUIRES "${requires}"
|
||||||
PRIV_REQUIRES "${priv_requires}"
|
PRIV_REQUIRES "${priv_requires}")
|
||||||
LDFRAGMENTS linker.lf)
|
|
||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
if(CONFIG_SECURE_SIGNED_ON_UPDATE)
|
if(CONFIG_SECURE_SIGNED_ON_UPDATE)
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
[mapping:bootloader_support]
|
|
||||||
archive: libbootloader_support.a
|
|
||||||
entries:
|
|
||||||
if APP_BUILD_TYPE_RAM = n:
|
|
||||||
image_process (noflash)
|
|
@ -30,6 +30,9 @@ entries:
|
|||||||
usb_console:esp_usb_console_before_restart (noflash)
|
usb_console:esp_usb_console_before_restart (noflash)
|
||||||
usb_console:esp_usb_console_on_restart_timeout (noflash)
|
usb_console:esp_usb_console_on_restart_timeout (noflash)
|
||||||
|
|
||||||
|
if APP_BUILD_TYPE_RAM = n:
|
||||||
|
image_process (noflash)
|
||||||
|
|
||||||
[mapping:vfs_cdcacm]
|
[mapping:vfs_cdcacm]
|
||||||
archive: libvfs.a
|
archive: libvfs.a
|
||||||
entries:
|
entries:
|
||||||
|
@ -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")
|
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)
|
if(CONFIG_SOC_BOD_SUPPORTED)
|
||||||
list(APPEND srcs "brownout.c")
|
list(APPEND srcs "brownout.c")
|
||||||
endif()
|
endif()
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
#include "esp_private/image_process.h"
|
#include "esp_private/image_process.h"
|
||||||
#include "esp_private/esp_cache_esp32_private.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
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
#define MMAP_MMU_SIZE 0x320000
|
#define MMAP_MMU_SIZE 0x320000
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
#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;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if IMAGE_PROCESS_SUPPORTED_TARGETS
|
||||||
static esp_err_t process_image_header(esp_image_metadata_t *data, uint32_t part_offset)
|
static esp_err_t process_image_header(esp_image_metadata_t *data, uint32_t part_offset)
|
||||||
{
|
{
|
||||||
bzero(data, sizeof(esp_image_metadata_t));
|
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;
|
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)
|
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)
|
esp_err_t image_process(void)
|
||||||
{
|
{
|
||||||
|
#if IMAGE_PROCESS_SUPPORTED_TARGETS
|
||||||
esp_err_t ret = ESP_FAIL;
|
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
|
* 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);
|
mmu_ll_set_entry_invalid(0, MMU_LL_END_DROM_ENTRY_ID);
|
||||||
|
#else
|
||||||
|
(void)s_image_process_driver;
|
||||||
|
#endif
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
Reference in New Issue
Block a user