Skip to content

Implement Linker command/response files in make export #9596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/export/makefile/Makefile.tmpl
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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