Merge branch 'bugfix/make_bootloader_depends_on_target' into 'master'

make bootloader depend on IDF_TARGET

See merge request idf/esp-idf!4704
This commit is contained in:
Angus Gratton 2019-04-10 13:07:52 +08:00
commit c064e00842
4 changed files with 23 additions and 18 deletions

View 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)

View 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.
#

View 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))

View 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)