From 24284b3afd8375fa63d78a1fb97eff04b8a06799 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Thu, 21 Feb 2019 14:11:09 +0800 Subject: [PATCH] ldgen: remove resolution of template includes --- make/ldgen.mk | 6 ++-- tools/ci/executable-list.txt | 1 - tools/ci/test_build_system.sh | 7 ---- tools/ci/test_build_system_cmake.sh | 10 ------ tools/cmake/ldgen.cmake | 14 +------- tools/ldgen/lddeps.py | 56 ----------------------------- 6 files changed, 3 insertions(+), 91 deletions(-) delete mode 100644 tools/ldgen/lddeps.py diff --git a/make/ldgen.mk b/make/ldgen.mk index 244de1690..705edcb56 100644 --- a/make/ldgen.mk +++ b/make/ldgen.mk @@ -18,8 +18,7 @@ define ldgen_process_template $(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES) $(IDF_PATH)/make/ldgen.mk printf "$(foreach info,$(LDGEN_SECTIONS_INFO_FILES),$(subst \,/,$(shell cygpath -w $(info)))\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos -$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos \ -$(shell $(PYTHON) $(IDF_PATH)/tools/ldgen/lddeps.py $(abspath $(1))) +$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos @echo 'Generating $(notdir $(2))' $(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \ --input $(1) \ @@ -37,8 +36,7 @@ define ldgen_process_template $(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES) $(IDF_PATH)/make/ldgen.mk printf "$(foreach info,$(LDGEN_SECTIONS_INFO_FILES),$(info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos -$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos \ -$(shell $(PYTHON) $(IDF_PATH)/tools/ldgen/lddeps.py $(abspath $(1))) +$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos @echo 'Generating $(notdir $(2))' $(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \ --input $(1) \ diff --git a/tools/ci/executable-list.txt b/tools/ci/executable-list.txt index ba84bd213..06821ebbd 100644 --- a/tools/ci/executable-list.txt +++ b/tools/ci/executable-list.txt @@ -66,7 +66,6 @@ tools/ci/multirun_with_pyenv.sh components/espcoredump/test/test_espcoredump.py components/espcoredump/test/test_espcoredump.sh tools/ldgen/ldgen.py -tools/ldgen/lddeps.py tools/ldgen/test/test_fragments.py tools/ldgen/test/test_generation.py examples/build_system/cmake/idf_as_lib/build.sh diff --git a/tools/ci/test_build_system.sh b/tools/ci/test_build_system.sh index 4c49de625..99da318d6 100755 --- a/tools/ci/test_build_system.sh +++ b/tools/ci/test_build_system.sh @@ -171,13 +171,6 @@ function run_tests() assert_rebuilt ${APP_BINS} assert_not_rebuilt ${BOOTLOADER_BINS} - print_status "Touching linker script included in template should re-link app" - take_build_snapshot - touch ${IDF_PATH}/components/esp32/ld/esp32.spiram.rom-functions-iram.ld - make - assert_rebuilt ${APP_BINS} - assert_not_rebuilt ${BOOTLOADER_BINS} - print_status "sdkconfig update triggers full recompile" make take_build_snapshot diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index 48ef8c185..3fb5cb103 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -186,16 +186,6 @@ function run_tests() assert_not_rebuilt ${BOOTLOADER_BINS} mv esp32_fragments.lf ${IDF_PATH}/components/esp32/ld/ - print_status "Updating linker script included in template should re-link app" - take_build_snapshot - cp ${IDF_PATH}/components/esp32/ld/esp32.spiram.rom-functions-iram.ld . - sleep 1 # ninja may ignore if the timestamp delta is too low - echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp32/ld/esp32.spiram.rom-functions-iram.ld - idf.py build || failure "Failed to build with modified linker script included in template" - assert_rebuilt ${APP_BINS} - assert_not_rebuilt ${BOOTLOADER_BINS} - mv esp32.spiram.rom-functions-iram.ld ${IDF_PATH}/components/esp32/ld/ - print_status "sdkconfig update triggers full recompile" clean_build_dir idf.py build diff --git a/tools/cmake/ldgen.cmake b/tools/cmake/ldgen.cmake index 6ea6d5d83..8cc277986 100644 --- a/tools/cmake/ldgen.cmake +++ b/tools/cmake/ldgen.cmake @@ -47,18 +47,6 @@ endfunction() # Passes a linker script template to the linker script generation tool for # processing function(ldgen_process_template template output) - get_filename_component(template ${template} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_LIST_DIR}) - execute_process(COMMAND ${PYTHON} ${IDF_PATH}/tools/ldgen/lddeps.py ${template} - OUTPUT_VARIABLE template_includes - ERROR_VARIABLE template_includes_err - ) - - if(template_includes_err) - message(FATAL_ERROR "Unable to parse linker script template for INCLUDEs\n" ${template_includes_err}) - endif() - - spaces2list(template_includes) - file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/ldgen.section_infos CONTENT "$,\n>") @@ -78,7 +66,7 @@ function(ldgen_process_template template output) --env "IDF_PATH=${IDF_PATH}" --env "IDF_TARGET=${IDF_TARGET}" DEPENDS ${template} $ ${SDKCONFIG} - ldgen_section_infos ${template_includes} + ldgen_section_infos ) get_filename_component(output_name ${output} NAME) diff --git a/tools/ldgen/lddeps.py b/tools/ldgen/lddeps.py deleted file mode 100644 index f3963955a..000000000 --- a/tools/ldgen/lddeps.py +++ /dev/null @@ -1,56 +0,0 @@ - -# !/usr/bin/env python -# -# Copyright 2019 Espressif Systems (Shanghai) PTE LTD -# -# This script is used by the linker script generation in order to list a template's -# INCLUDE'd linker scripts recursively. This is so that updates to these INCLUDE'd -# scripts also trigger a relink of the app. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import re -import argparse - - -INCLUDE_PATTERN = re.compile(r"INCLUDE[\t ]+([^\n]+)") - - -def find_includes(file_path, includes_list): - # Find include files recursively - file_dir = os.path.dirname(file_path) - - with open(file_path, "r") as f: - includes_list.append(file_path) - includes = re.findall(INCLUDE_PATTERN, f.read()) - - for include in includes: - include_file_path = os.path.abspath(os.path.join(file_dir, include)) - find_includes(include_file_path, includes_list) - - -def main(): - argparser = argparse.ArgumentParser(description="List INCLUDE'd linker scripts recursively") - argparser.add_argument("input", help="input linker script") - args = argparser.parse_args() - - includes_list = list() - find_includes(args.input, includes_list) - includes_list.remove(args.input) - - print(" ".join(includes_list)) - - -if __name__ == "__main__": - main()