Merge branch 'bugfix/ldgen_cmd_args_too_long' into 'master'
Fix issue with generating linker script using Windows command line See merge request idf/esp-idf!3865
This commit is contained in:
commit
2946b5f384
3 changed files with 28 additions and 7 deletions
|
@ -6,14 +6,27 @@ LDGEN_FRAGMENT_FILES = $(COMPONENT_LDFRAGMENTS)
|
||||||
# Target to generate linker script generator from fragments presented by each of
|
# Target to generate linker script generator from fragments presented by each of
|
||||||
# the components
|
# the components
|
||||||
define ldgen_process_template
|
define ldgen_process_template
|
||||||
$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(LDGEN_SECTIONS_INFO_FILES)
|
ifeq ($(OS), Windows_NT)
|
||||||
|
$(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES)
|
||||||
|
echo -ne "$(foreach section_info,$(LDGEN_SECTIONS_INFO_FILES),$(section_info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||||
|
sed -i 's|^[[:blank:]]*||g' $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||||
|
mv $(BUILD_DIR_BASE)/ldgen.section_infos $(BUILD_DIR_BASE)/ldgen.section_infos.temp
|
||||||
|
cygpath -w -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp > $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||||
|
rm -f $(BUILD_DIR_BASE)/ldgen.section_infos.temp
|
||||||
|
else
|
||||||
|
$(BUILD_DIR_BASE)/ldgen.section_infos: $(LDGEN_SECTIONS_INFO_FILES)
|
||||||
|
echo "$(foreach section_info,$(LDGEN_SECTIONS_INFO_FILES),$(section_info)\n)" > $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||||
|
sed -i 's|^[[:blank:]]*||g' $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(2): $(1) $(LDGEN_FRAGMENT_FILES) $(SDKCONFIG) $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||||
@echo 'Generating $(notdir $(2))'
|
@echo 'Generating $(notdir $(2))'
|
||||||
$(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
|
$(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
|
||||||
--input $(1) \
|
--input $(1) \
|
||||||
--config $(SDKCONFIG) \
|
--config $(SDKCONFIG) \
|
||||||
--fragments $(LDGEN_FRAGMENT_FILES) \
|
--fragments $(LDGEN_FRAGMENT_FILES) \
|
||||||
--output $(2) \
|
--output $(2) \
|
||||||
--sections $(LDGEN_SECTIONS_INFO_FILES) \
|
--sections $(BUILD_DIR_BASE)/ldgen.section_infos \
|
||||||
--kconfig $(IDF_PATH)/Kconfig \
|
--kconfig $(IDF_PATH)/Kconfig \
|
||||||
--env "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \
|
--env "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \
|
||||||
--env "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
--env "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
||||||
|
@ -26,6 +39,7 @@ $(foreach lib, $(COMPONENT_LIBRARIES), \
|
||||||
|
|
||||||
ldgen-clean:
|
ldgen-clean:
|
||||||
rm -f $(LDGEN_SECTIONS_INFO_FILES)
|
rm -f $(LDGEN_SECTIONS_INFO_FILES)
|
||||||
|
rm -f $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Target to generate sections info file from objdump of component archive
|
# Target to generate sections info file from objdump of component archive
|
||||||
|
|
|
@ -47,6 +47,9 @@ endfunction()
|
||||||
# Passes a linker script template to the linker script generation tool for
|
# Passes a linker script template to the linker script generation tool for
|
||||||
# processing
|
# processing
|
||||||
function(ldgen_process_template template output)
|
function(ldgen_process_template template output)
|
||||||
|
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/ldgen.section_infos
|
||||||
|
CONTENT "$<JOIN:$<TARGET_PROPERTY:ldgen_section_infos,SECTIONS_INFO_FILES>,\n>")
|
||||||
|
|
||||||
# Create command to invoke the linker script generator tool.
|
# Create command to invoke the linker script generator tool.
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${output}
|
OUTPUT ${output}
|
||||||
|
@ -55,7 +58,7 @@ function(ldgen_process_template template output)
|
||||||
--fragments "$<JOIN:$<TARGET_PROPERTY:ldgen,FRAGMENT_FILES>,\t>"
|
--fragments "$<JOIN:$<TARGET_PROPERTY:ldgen,FRAGMENT_FILES>,\t>"
|
||||||
--input ${template}
|
--input ${template}
|
||||||
--output ${output}
|
--output ${output}
|
||||||
--sections "$<JOIN:$<TARGET_PROPERTY:ldgen_section_infos,SECTIONS_INFO_FILES>,\t>"
|
--sections ${CMAKE_BINARY_DIR}/ldgen.section_infos
|
||||||
--kconfig ${IDF_PATH}/Kconfig
|
--kconfig ${IDF_PATH}/Kconfig
|
||||||
--env "COMPONENT_KCONFIGS=${COMPONENT_KCONFIGS}"
|
--env "COMPONENT_KCONFIGS=${COMPONENT_KCONFIGS}"
|
||||||
--env "COMPONENT_KCONFIGS_PROJBUILD=${COMPONENT_KCONFIGS_PROJBUILD}"
|
--env "COMPONENT_KCONFIGS_PROJBUILD=${COMPONENT_KCONFIGS_PROJBUILD}"
|
||||||
|
|
|
@ -45,7 +45,7 @@ def main():
|
||||||
"--sections", "-s",
|
"--sections", "-s",
|
||||||
type = argparse.FileType("r"),
|
type = argparse.FileType("r"),
|
||||||
help = "Library sections info",
|
help = "Library sections info",
|
||||||
nargs = "+")
|
)
|
||||||
|
|
||||||
argparser.add_argument(
|
argparser.add_argument(
|
||||||
"--output", "-o",
|
"--output", "-o",
|
||||||
|
@ -79,8 +79,12 @@ def main():
|
||||||
try:
|
try:
|
||||||
sections_infos = SectionsInfo()
|
sections_infos = SectionsInfo()
|
||||||
|
|
||||||
for sections_info_file in sections_info_files:
|
section_info_contents = [s.strip() for s in sections_info_files.read().split("\n")]
|
||||||
sections_infos.add_sections_info(sections_info_file)
|
section_info_contents = [s for s in section_info_contents if s]
|
||||||
|
|
||||||
|
for sections_info_file in section_info_contents:
|
||||||
|
with open(sections_info_file) as sections_info_file_obj:
|
||||||
|
sections_infos.add_sections_info(sections_info_file_obj)
|
||||||
|
|
||||||
generation_model = GenerationModel()
|
generation_model = GenerationModel()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue