Skip to content

Commit

Permalink
Merge pull request #9596 from vmedcy/make-cmd-files
Browse files Browse the repository at this point in the history
Implement Linker command/response files in make export
  • Loading branch information
0xc0170 committed Feb 7, 2019
2 parents 09db995 + 6918e6a commit 7e18cc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/export/makefile/Makefile.tmpl
Expand Up @@ -135,8 +135,9 @@ $(PROJECT).link_script{{link_script_ext}}: $(LINKER_SCRIPT)

{% block target_project_elf %}
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) {% if pp_cmd -%} $(PROJECT).link_script{{link_script_ext}} {% else%} $(LINKER_SCRIPT) {% endif %}
+@echo "$(filter %.o, $^)" > .link_options.txt
+@echo "link: $(notdir $@)"
@$(LD) $(LD_FLAGS) {{link_script_option}} $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS)
@$(LD) $(LD_FLAGS) {{link_script_option}} $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ {{response_option}}.link_options.txt $(LIBRARIES) $(LD_SYS_LIBS)
{% endblock %}

$(PROJECT).bin: $(PROJECT).elf
Expand Down
4 changes: 4 additions & 0 deletions tools/export/makefile/__init__.py
Expand Up @@ -113,6 +113,7 @@ def generate(self):
'user_library_flag': self.USER_LIBRARY_FLAG,
'needs_asm_preproc': self.PREPROCESS_ASM,
'shell_escape': shell_escape,
'response_option': self.RESPONSE_OPTION,
}

if hasattr(self.toolchain, "preproc"):
Expand Down Expand Up @@ -233,6 +234,7 @@ class GccArm(Makefile):
TOOLCHAIN = "GCC_ARM"
LINK_SCRIPT_OPTION = "-T"
USER_LIBRARY_FLAG = "-L"
RESPONSE_OPTION = "@"

@staticmethod
def prepare_lib(libname):
Expand All @@ -250,6 +252,7 @@ class Arm(Makefile):
LINK_SCRIPT_OPTION = "--scatter"
USER_LIBRARY_FLAG = "--userlibpath "
TEMPLATE = 'make-arm'
RESPONSE_OPTION = "--via "

@staticmethod
def prepare_lib(libname):
Expand Down Expand Up @@ -289,6 +292,7 @@ class IAR(Makefile):
TOOLCHAIN = "IAR"
LINK_SCRIPT_OPTION = "--config"
USER_LIBRARY_FLAG = "-L"
RESPONSE_OPTION = "-f "

@staticmethod
def prepare_lib(libname):
Expand Down

0 comments on commit 7e18cc5

Please sign in to comment.