Skip to content

Commit

Permalink
Merge branch 'bugfix/make_bootloader_depends_on_target' into 'master'
Browse files Browse the repository at this point in the history
make bootloader depend on IDF_TARGET

See merge request idf/esp-idf!4704
  • Loading branch information
projectgus committed Apr 10, 2019
2 parents 83d2ff0 + 7803487 commit c064e00
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
18 changes: 9 additions & 9 deletions components/bootloader/subproject/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions components/bootloader/subproject/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
12 changes: 6 additions & 6 deletions components/bootloader/subproject/main/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
5 changes: 5 additions & 0 deletions tools/cmake/idf_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c064e00

Please sign in to comment.