diff --git a/components/bootloader/subproject/CMakeLists.txt b/components/bootloader/subproject/CMakeLists.txt index e576ccc15..83b7cb911 100644 --- a/components/bootloader/subproject/CMakeLists.txt +++ b/components/bootloader/subproject/CMakeLists.txt @@ -10,28 +10,28 @@ if(NOT IDF_PATH) "in by the parent build process.") endif() -set(COMPONENTS bootloader esptool_py esp32 partition_table soc bootloader_support log spi_flash micro-ecc main efuse) +set(COMPONENTS bootloader esptool_py partition_table soc bootloader_support log spi_flash micro-ecc main efuse) set(BOOTLOADER_BUILD 1) add_definitions(-DBOOTLOADER_BUILD=1) -set(COMPONENT_REQUIRES_COMMON log esp32 soc esp_rom esp_common xtensa) +set(COMPONENT_REQUIRES_COMMON log soc esp_rom esp_common xtensa) include("${IDF_PATH}/tools/cmake/project.cmake") project(bootloader) target_linker_script(bootloader.elf - "main/esp32.bootloader.ld" - "main/esp32.bootloader.rom.ld" + "main/${IDF_TARGET}.bootloader.ld" + "main/${IDF_TARGET}.bootloader.rom.ld" ) # as cmake won't attach linker args to a header-only library, attach # linker args directly to the bootloader.elf -set(ESP32_BOOTLOADER_LINKER_SCRIPTS - "../../esp_rom/esp32/ld/esp32.rom.ld" - "../../esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld" - "../../esp32/ld/esp32.peripherals.ld") +set(BOOTLOADER_LINKER_SCRIPTS + "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.ld" + "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.spiram_incompatible_fns.ld" + "${IDF_PATH}/components/${IDF_TARGET}/ld/${IDF_TARGET}.peripherals.ld") -target_linker_script(bootloader.elf ${ESP32_BOOTLOADER_LINKER_SCRIPTS}) +target_linker_script(bootloader.elf ${BOOTLOADER_LINKER_SCRIPTS}) target_link_libraries(bootloader.elf gcc) diff --git a/components/bootloader/subproject/Makefile b/components/bootloader/subproject/Makefile index 33ab19c6e..f23964b0c 100644 --- a/components/bootloader/subproject/Makefile +++ b/components/bootloader/subproject/Makefile @@ -14,11 +14,11 @@ COMPONENTS := esptool_py bootloader_support log spi_flash micro-ecc soc main efu CFLAGS = CXXFLAGS = -#We cannot include the esp32, esp_rom, esp_common component directly but we need their includes. -CFLAGS += -I $(IDF_PATH)/components/esp32/include +#We cannot include the idf_target, esp_rom, esp_common component directly but we need their includes. +CFLAGS += -I $(IDF_PATH)/components/$(IDF_TARGET)/include CFLAGS += -I $(IDF_PATH)/components/esp_rom/include CFLAGS += -I $(IDF_PATH)/components/esp_common/include -CFLAGS += -I $(IDF_PATH)/components/xtensa/include -I $(IDF_PATH)/components/xtensa/esp32/include +CFLAGS += -I $(IDF_PATH)/components/xtensa/include -I $(IDF_PATH)/components/xtensa/$(IDF_TARGET)/include # The bootloader pseudo-component is also included in this build, for its Kconfig.projbuild to be included. # diff --git a/components/bootloader/subproject/main/component.mk b/components/bootloader/subproject/main/component.mk index 3c4ee81a3..e2cae1b03 100644 --- a/components/bootloader/subproject/main/component.mk +++ b/components/bootloader/subproject/main/component.mk @@ -6,14 +6,14 @@ # LINKER_SCRIPTS := \ - esp32.bootloader.ld \ - $(IDF_PATH)/components/esp_rom/esp32/ld/esp32.rom.ld \ - $(IDF_PATH)/components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld \ - $(IDF_PATH)/components/esp32/ld/esp32.peripherals.ld \ - esp32.bootloader.rom.ld + $(IDF_TARGET).bootloader.ld \ + $(IDF_TARGET).bootloader.rom.ld \ + $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.ld \ + $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.spiram_incompatible_fns.ld \ + $(IDF_PATH)/components/$(IDF_TARGET)/ld/$(IDF_TARGET).peripherals.ld ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH -LINKER_SCRIPTS += $(IDF_PATH)/components/esp_rom/esp32/ld/esp32.rom.spiflash.ld +LINKER_SCRIPTS += $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.spiflash.ld endif COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH) $(addprefix -T ,$(LINKER_SCRIPTS)) diff --git a/tools/cmake/idf_functions.cmake b/tools/cmake/idf_functions.cmake index a2412426e..9da794313 100644 --- a/tools/cmake/idf_functions.cmake +++ b/tools/cmake/idf_functions.cmake @@ -61,6 +61,11 @@ macro(idf_set_variables) set_default(IDF_COMPONENT_REQUIRES_COMMON "cxx ${IDF_TARGET} newlib freertos heap log soc \ esp_rom esp_common xtensa") + list(FIND IDF_COMPONENT_REQUIRES_COMMON "${IDF_TARGET}" result) + if(result EQUAL -1) + list(APPEND IDF_COMPONENT_REQUIRES_COMMON "${IDF_TARGET}") + endif() + set(IDF_PROJECT_PATH "${CMAKE_SOURCE_DIR}") set(ESP_PLATFORM 1 CACHE BOOL INTERNAL)