From 8913d4cf61abee6575cec21bd6f129242d4d0bdc Mon Sep 17 00:00:00 2001 From: Konstantin Kondrashov Date: Thu, 9 Jul 2026 13:28:19 +0300 Subject: [PATCH] fix(esp_bootloader_format): Remove bootloader description from app build The removed function `esp_bootloader_get_description` never worked in the app build. It can be used only in the bootloader build. To read the bootloader description from app, there is another function `esp_ota_get_bootloader_description`. --- components/bootloader_support/src/bootloader_init.c | 2 ++ components/esp_bootloader_format/CMakeLists.txt | 8 +++++++- components/esp_bootloader_format/esp_bootloader_desc.c | 4 +--- .../esp_bootloader_format/include/esp_bootloader_desc.h | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/components/bootloader_support/src/bootloader_init.c b/components/bootloader_support/src/bootloader_init.c index b9c9fc75635..518273e77e1 100644 --- a/components/bootloader_support/src/bootloader_init.c +++ b/components/bootloader_support/src/bootloader_init.c @@ -119,6 +119,7 @@ void bootloader_enable_random(void) void bootloader_print_banner(void) { +#if BOOTLOADER_BUILD 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); @@ -126,6 +127,7 @@ void bootloader_print_banner(void) ESP_EARLY_LOGI(TAG, "compile time %s", desc->date_time); #endif } +#endif // BOOTLOADER_BUILD #if CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE #if (SOC_CPU_CORES_NUM > 1) diff --git a/components/esp_bootloader_format/CMakeLists.txt b/components/esp_bootloader_format/CMakeLists.txt index 4afb08a3634..1f4ec52e1f9 100644 --- a/components/esp_bootloader_format/CMakeLists.txt +++ b/components/esp_bootloader_format/CMakeLists.txt @@ -4,7 +4,13 @@ if(${target} STREQUAL "linux") return() # This component is not supported by the POSIX/Linux simulator endif() -idf_component_register(SRCS "esp_bootloader_desc.c" +if(BOOTLOADER_BUILD) + set(srcs "esp_bootloader_desc.c") +else() + set(srcs "") +endif() + +idf_component_register(SRCS ${srcs} INCLUDE_DIRS "include") if(BOOTLOADER_BUILD) diff --git a/components/esp_bootloader_format/esp_bootloader_desc.c b/components/esp_bootloader_format/esp_bootloader_desc.c index 6c4c3caa94e..1d42aa19b5f 100644 --- a/components/esp_bootloader_format/esp_bootloader_desc.c +++ b/components/esp_bootloader_format/esp_bootloader_desc.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -10,9 +10,7 @@ #include "sdkconfig.h" // Bootloader version info -#if BOOTLOADER_BUILD __attribute__((section(".data_bootloader_desc"))) -#endif __attribute__((weak)) const esp_bootloader_desc_t esp_bootloader_desc = { .magic_byte = ESP_BOOTLOADER_DESC_MAGIC_BYTE, diff --git a/components/esp_bootloader_format/include/esp_bootloader_desc.h b/components/esp_bootloader_format/include/esp_bootloader_desc.h index 5bee2f4d0a7..190557f5604 100644 --- a/components/esp_bootloader_format/include/esp_bootloader_desc.h +++ b/components/esp_bootloader_format/include/esp_bootloader_desc.h @@ -36,6 +36,7 @@ typedef struct { ESP_STATIC_ASSERT(sizeof(esp_bootloader_desc_t) == 80, "esp_bootloader_desc_t should be 80 bytes"); /** @endcond */ +#if BOOTLOADER_BUILD /** * @brief Return esp_bootloader_desc structure. * @@ -43,6 +44,7 @@ ESP_STATIC_ASSERT(sizeof(esp_bootloader_desc_t) == 80, "esp_bootloader_desc_t sh * @return Pointer to esp_bootloader_desc structure. */ const esp_bootloader_desc_t *esp_bootloader_get_description(void); +#endif // BOOTLOADER_BUILD #ifdef __cplusplus }