Skip to content

Commit

Permalink
Implement Linker command/response files in make export
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherjimmy committed Jul 23, 2018
1 parent 5d5ca62 commit 387747f
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
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 %}
$(file > $@.in, $(filter %.o, $^))
+@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}}$@.in $(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 @@ -100,6 +100,7 @@ def generate(self):
'link_script_option': self.LINK_SCRIPT_OPTION,
'user_library_flag': self.USER_LIBRARY_FLAG,
'needs_asm_preproc': self.PREPROCESS_ASM,
'response_option': self.RESPONSE_OPTION,
}

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

@staticmethod
def prepare_lib(libname):
Expand All @@ -234,6 +236,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 @@ -284,6 +287,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 387747f

Please sign in to comment.