Merge branch 'bugfix/remove_lddeps_resolution' into 'master'

Remove lddeps resolution for linker script generator template

See merge request idf/esp-idf!4326
pull/3089/head
Ivan Grokhotkov 2019-02-22 11:28:10 +08:00
commit f4bc6be1d4
6 zmienionych plików z 3 dodań i 91 usunięć

Wyświetl plik

@ -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) \

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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 "$<JOIN:$<TARGET_PROPERTY:ldgen_section_infos,SECTIONS_INFO_FILES>,\n>")
@ -78,7 +66,7 @@ function(ldgen_process_template template output)
--env "IDF_PATH=${IDF_PATH}"
--env "IDF_TARGET=${IDF_TARGET}"
DEPENDS ${template} $<TARGET_PROPERTY:ldgen,FRAGMENT_FILES> ${SDKCONFIG}
ldgen_section_infos ${template_includes}
ldgen_section_infos
)
get_filename_component(output_name ${output} NAME)

Wyświetl plik

@ -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()