esp_bootloader_format: Adds bootloader description structure to read bootloader version from app

Closes https://github.com/espressif/esp-idf/issues/8800
Closes https://github.com/espressif/esp-idf/issues/9132
This commit is contained in:
KonstantinKondrashov
2022-12-14 01:16:56 +08:00
parent 87dd7bb51a
commit 69838403f9
38 changed files with 421 additions and 51 deletions
+5 -2
View File
@@ -29,7 +29,7 @@ endif()
if(BOOTLOADER_BUILD OR CONFIG_APP_BUILD_TYPE_RAM)
set(include_dirs "include" "bootloader_flash/include"
"private_include")
set(priv_requires micro-ecc spi_flash efuse esp_app_format)
set(priv_requires micro-ecc spi_flash efuse esp_bootloader_format esp_app_format)
list(APPEND srcs
"src/bootloader_init.c"
"src/bootloader_clock_loader.c"
@@ -50,7 +50,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_app_format)
set(priv_requires spi_flash mbedtls efuse heap esp_bootloader_format esp_app_format)
endif()
if(BOOTLOADER_BUILD)
@@ -170,4 +170,7 @@ endif()
if(BOOTLOADER_BUILD)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u abort")
# esp_bootloader_desc structure is added as an undefined symbol because otherwise the
# linker will ignore this structure as it has no other files depending on it.
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_bootloader_desc")
endif()
@@ -19,6 +19,7 @@
#include "soc/rtc.h"
#include "hal/wdt_hal.h"
#include "hal/efuse_hal.h"
#include "esp_bootloader_desc.h"
static const char *TAG = "boot";
@@ -92,10 +93,13 @@ void bootloader_enable_random(void)
void bootloader_print_banner(void)
{
ESP_EARLY_LOGI(TAG, "ESP-IDF %s 2nd stage bootloader", IDF_VER);
#ifndef CONFIG_APP_REPRODUCIBLE_BUILD
ESP_EARLY_LOGI(TAG, "compile time " __DATE__ " " __TIME__);
if (CONFIG_BOOTLOADER_LOG_LEVEL >= ESP_LOG_INFO) {
const esp_bootloader_desc_t *desc = esp_bootloader_get_description();
ESP_EARLY_LOGI(TAG, "ESP-IDF %s 2nd stage bootloader", desc->idf_ver);
#ifdef CONFIG_BOOTLOADER_COMPILE_TIME_DATE
ESP_EARLY_LOGI(TAG, "compile time %s", desc->date_time);
#endif
}
#if CONFIG_FREERTOS_UNICORE
#if (SOC_CPU_CORES_NUM > 1)