mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(esp_rom): exclude TLSF/multi_heap ROM patches from bootloader build
The bootloader does not use the heap allocator or TLSF, so the ROM patch files esp_rom_tlsf.c and esp_rom_multi_heap.c are not needed in the bootloader build. In the cmakev1 build system this was never an issue because cmakev1 uses an early expansion phase where only Kconfig files for components listed in BUILD_COMPONENTS are processed. Since the heap component is not part of the bootloader's component list, its Kconfig options (CONFIG_HEAP_TLSF_USE_ROM_IMPL, etc.) were never defined and the conditional compilation of these source files was effectively skipped. In the cmakev2 build system, Kconfig options from all discovered components are visible regardless of whether the component is part of the build. Because the bootloader reuses the main project's sdkconfig (where CONFIG_HEAP_TLSF_USE_ROM_IMPL defaults to y on targets with ROM TLSF support like esp32c2), the TLSF patch sources were being compiled into the bootloader's esp_rom. This caused a build failure because esp_rom_tlsf.c includes tlsf_block_functions.h from the heap component, which is not a dependency of esp_rom and is not part of the bootloader build. Guard the TLSF and multi_heap ROM patch sources with NOT BOOTLOADER_BUILD to prevent them from being compiled in the bootloader context. This fix is compatible with both cmakev1 and cmakev2. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -24,14 +24,16 @@ else()
|
||||
"patches/esp_rom_efuse.c"
|
||||
"patches/esp_rom_gpio.c")
|
||||
|
||||
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL AND CONFIG_ESP_ROM_TLSF_CHECK_PATCH)
|
||||
# This file shall be included in the build if TLSF in ROM is activated
|
||||
list(APPEND sources "patches/esp_rom_tlsf.c")
|
||||
endif()
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL AND CONFIG_ESP_ROM_TLSF_CHECK_PATCH)
|
||||
# This file shall be included in the build if TLSF in ROM is activated
|
||||
list(APPEND sources "patches/esp_rom_tlsf.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL AND CONFIG_ESP_ROM_MULTI_HEAP_WALK_PATCH)
|
||||
# This file shall be included in the build if TLSF in ROM is activated
|
||||
list(APPEND sources "patches/esp_rom_multi_heap.c")
|
||||
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL AND CONFIG_ESP_ROM_MULTI_HEAP_WALK_PATCH)
|
||||
# This file shall be included in the build if TLSF in ROM is activated
|
||||
list(APPEND sources "patches/esp_rom_multi_heap.c")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND private_required_comp soc hal esp_hal_uart)
|
||||
|
||||
Reference in New Issue
Block a user