From 2347e68e6b3c00ce9cc27ca8e318ea5bf1aece07 Mon Sep 17 00:00:00 2001 From: SalimTerryLi Date: Wed, 21 Jul 2021 21:09:45 +0800 Subject: [PATCH] soc: move peripheral linker scripts out of target component --- components/bootloader/subproject/main/component.mk | 3 +-- components/esp32/CMakeLists.txt | 2 -- components/esp32/component.mk | 3 --- components/esp32c3/CMakeLists.txt | 2 -- components/esp32h2/CMakeLists.txt | 2 -- components/esp32s2/CMakeLists.txt | 2 -- components/esp32s3/CMakeLists.txt | 2 -- components/soc/CMakeLists.txt | 2 ++ components/soc/component.mk | 3 +++ components/{ => soc}/esp32/ld/esp32.peripherals.ld | 0 components/{ => soc}/esp32c3/ld/esp32c3.peripherals.ld | 0 components/{ => soc}/esp32h2/ld/esp32h2.peripherals.ld | 0 components/{ => soc}/esp32s2/ld/esp32s2.peripherals.ld | 0 components/{ => soc}/esp32s3/ld/esp32s3.peripherals.ld | 0 14 files changed, 6 insertions(+), 15 deletions(-) rename components/{ => soc}/esp32/ld/esp32.peripherals.ld (100%) rename components/{ => soc}/esp32c3/ld/esp32c3.peripherals.ld (100%) rename components/{ => soc}/esp32h2/ld/esp32h2.peripherals.ld (100%) rename components/{ => soc}/esp32s2/ld/esp32s2.peripherals.ld (100%) rename components/{ => soc}/esp32s3/ld/esp32s3.peripherals.ld (100%) diff --git a/components/bootloader/subproject/main/component.mk b/components/bootloader/subproject/main/component.mk index 29702b9175..c41e8b7095 100644 --- a/components/bootloader/subproject/main/component.mk +++ b/components/bootloader/subproject/main/component.mk @@ -10,8 +10,7 @@ LINKER_SCRIPTS := \ $(COMPONENT_PATH)/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.newlib-funcs.ld \ - $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.api.ld \ - $(IDF_PATH)/components/$(IDF_TARGET)/ld/$(IDF_TARGET).peripherals.ld + $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.api.ld # SPI driver patch for ROM is only needed in ESP32 ifdef CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 27442c948c..a6eaa1b31d 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -12,5 +12,3 @@ endif() idf_component_register(INCLUDE_DIRS include REQUIRES xtensa "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32) - -target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32.peripherals.ld") diff --git a/components/esp32/component.mk b/components/esp32/component.mk index 2132712504..ebd7a7d59b 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -1,6 +1,3 @@ # # Component Makefile # - -COMPONENT_ADD_LINKER_DEPS := $(COMPONENT_PATH) ld/esp32.peripherals.ld -COMPONENT_ADD_LDFLAGS := -T $(COMPONENT_PATH)/ld/esp32.peripherals.ld diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index fa6658cc0d..0b4306ec90 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -11,5 +11,3 @@ endif() idf_component_register(REQUIRES riscv "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32c3) - -target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") diff --git a/components/esp32h2/CMakeLists.txt b/components/esp32h2/CMakeLists.txt index 58cc2fa226..de20b8490f 100644 --- a/components/esp32h2/CMakeLists.txt +++ b/components/esp32h2/CMakeLists.txt @@ -11,5 +11,3 @@ endif() idf_component_register(REQUIRES riscv "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32h2) - -target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32h2.peripherals.ld") diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index 0918864d18..662cf9f91f 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -11,5 +11,3 @@ endif() idf_component_register(REQUIRES xtensa "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32s2) - -target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2.peripherals.ld") diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index 02b509b91f..b28a01f8fd 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -11,5 +11,3 @@ endif() idf_component_register(REQUIRES xtensa "${legacy_reqs}" REQUIRED_IDF_TARGETS esp32s3) - -target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s3.peripherals.ld") diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index a86afd16a1..646a183eb4 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -6,3 +6,5 @@ idf_component_register(SRCS "lldesc.c" idf_build_get_property(target IDF_TARGET) add_subdirectory(${target}) + +target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/ld/${target}.peripherals.ld") diff --git a/components/soc/component.mk b/components/soc/component.mk index fc463da3e8..f2dba93ca3 100644 --- a/components/soc/component.mk +++ b/components/soc/component.mk @@ -1,4 +1,7 @@ COMPONENT_SRCDIRS := . $(IDF_TARGET) COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET) $(IDF_TARGET)/include +COMPONENT_ADD_LINKER_DEPS += $(COMPONENT_PATH) esp32/ld/esp32.peripherals.ld +COMPONENT_ADD_LDFLAGS += -T $(COMPONENT_PATH)/esp32/ld/esp32.peripherals.ld + COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/esp32/ld/esp32.peripherals.ld b/components/soc/esp32/ld/esp32.peripherals.ld similarity index 100% rename from components/esp32/ld/esp32.peripherals.ld rename to components/soc/esp32/ld/esp32.peripherals.ld diff --git a/components/esp32c3/ld/esp32c3.peripherals.ld b/components/soc/esp32c3/ld/esp32c3.peripherals.ld similarity index 100% rename from components/esp32c3/ld/esp32c3.peripherals.ld rename to components/soc/esp32c3/ld/esp32c3.peripherals.ld diff --git a/components/esp32h2/ld/esp32h2.peripherals.ld b/components/soc/esp32h2/ld/esp32h2.peripherals.ld similarity index 100% rename from components/esp32h2/ld/esp32h2.peripherals.ld rename to components/soc/esp32h2/ld/esp32h2.peripherals.ld diff --git a/components/esp32s2/ld/esp32s2.peripherals.ld b/components/soc/esp32s2/ld/esp32s2.peripherals.ld similarity index 100% rename from components/esp32s2/ld/esp32s2.peripherals.ld rename to components/soc/esp32s2/ld/esp32s2.peripherals.ld diff --git a/components/esp32s3/ld/esp32s3.peripherals.ld b/components/soc/esp32s3/ld/esp32s3.peripherals.ld similarity index 100% rename from components/esp32s3/ld/esp32s3.peripherals.ld rename to components/soc/esp32s3/ld/esp32s3.peripherals.ld