]> granicus.if.org Git - esp-idf/commitdiff
make bootloader depend on IDF_TARGET
authorsuda-morris <362953310@qq.com>
Thu, 4 Apr 2019 07:20:24 +0000 (15:20 +0800)
committersuda-morris <362953310@qq.com>
Mon, 8 Apr 2019 03:08:06 +0000 (11:08 +0800)
components/bootloader/subproject/CMakeLists.txt
components/bootloader/subproject/Makefile
components/bootloader/subproject/main/component.mk
tools/cmake/idf_functions.cmake

index e576ccc1557ff68553c148709f62adb194496641..83b7cb911b3ecb5e9cf9b19e605ea72ba7417fd0 100644 (file)
@@ -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)
 
index 33ab19c6e34e21e16e6b7a841fee3ef21ae21182..f23964b0ca7beb3ccacd48928fa47106126eb332 100644 (file)
@@ -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.
 #
index 3c4ee81a38267e6e1a6f15a10fa5846ec639056e..e2cae1b03f47ab435206834ebe20806bf5545c30 100644 (file)
@@ -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))
index a2412426e537f4910896eda1029ea34fc671aee8..9da794313ad8694174d9f2ff271935132d11f90e 100644 (file)
@@ -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)