kopia lustrzana https://github.com/espressif/esp-idf
cmake, make: fix long cmd line args for ldgen
rodzic
fffa98647b
commit
a7a1c32a8e
|
@ -6,14 +6,27 @@ LDGEN_FRAGMENT_FILES = $(COMPONENT_LDFRAGMENTS)
|
|||
# Target to generate linker script generator from fragments presented by each of
|
||||
# the components
|
||||
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))'
|
||||
$(PYTHON) $(IDF_PATH)/tools/ldgen/ldgen.py \
|
||||
--input $(1) \
|
||||
--config $(SDKCONFIG) \
|
||||
--fragments $(LDGEN_FRAGMENT_FILES) \
|
||||
--output $(2) \
|
||||
--sections $(LDGEN_SECTIONS_INFO_FILES) \
|
||||
--sections $(BUILD_DIR_BASE)/ldgen.section_infos \
|
||||
--kconfig $(IDF_PATH)/Kconfig \
|
||||
--env "COMPONENT_KCONFIGS=$(COMPONENT_KCONFIGS)" \
|
||||
--env "COMPONENT_KCONFIGS_PROJBUILD=$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
||||
|
@ -26,11 +39,12 @@ $(foreach lib, $(COMPONENT_LIBRARIES), \
|
|||
|
||||
ldgen-clean:
|
||||
rm -f $(LDGEN_SECTIONS_INFO_FILES)
|
||||
rm -f $(BUILD_DIR_BASE)/ldgen.section_infos
|
||||
endef
|
||||
|
||||
# Target to generate sections info file from objdump of component archive
|
||||
define ldgen_generate_target_sections_info
|
||||
$(1).sections_info: $(1)
|
||||
@echo 'Generating $(notdir $(1).sections_info)'
|
||||
@echo 'Generating $(notdir $(1).sections_info)'
|
||||
$(OBJDUMP) -h $(1) > $(1).sections_info
|
||||
endef
|
||||
|
|
|
@ -47,6 +47,9 @@ endfunction()
|
|||
# Passes a linker script template to the linker script generation tool for
|
||||
# processing
|
||||
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.
|
||||
add_custom_command(
|
||||
OUTPUT ${output}
|
||||
|
@ -55,7 +58,7 @@ function(ldgen_process_template template output)
|
|||
--fragments "$<JOIN:$<TARGET_PROPERTY:ldgen,FRAGMENT_FILES>,\t>"
|
||||
--input ${template}
|
||||
--output ${output}
|
||||
--sections "$<JOIN:$<TARGET_PROPERTY:ldgen_section_infos,SECTIONS_INFO_FILES>,\t>"
|
||||
--sections ${CMAKE_BINARY_DIR}/ldgen.section_infos
|
||||
--kconfig ${IDF_PATH}/Kconfig
|
||||
--env "COMPONENT_KCONFIGS=${COMPONENT_KCONFIGS}"
|
||||
--env "COMPONENT_KCONFIGS_PROJBUILD=${COMPONENT_KCONFIGS_PROJBUILD}"
|
||||
|
|
|
@ -45,7 +45,7 @@ def main():
|
|||
"--sections", "-s",
|
||||
type = argparse.FileType("r"),
|
||||
help = "Library sections info",
|
||||
nargs = "+")
|
||||
)
|
||||
|
||||
argparser.add_argument(
|
||||
"--output", "-o",
|
||||
|
@ -79,8 +79,12 @@ def main():
|
|||
try:
|
||||
sections_infos = SectionsInfo()
|
||||
|
||||
for sections_info_file in sections_info_files:
|
||||
sections_infos.add_sections_info(sections_info_file)
|
||||
section_info_contents = [s.strip() for s in sections_info_files.read().split("\n")]
|
||||
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()
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue