Skip to content

Commit

Permalink
Merge pull request ARMmbed#7559 from theotherjimmy/make-armc6-v8m
Browse files Browse the repository at this point in the history
Export: Support Make + ArmC6 + v8m
  • Loading branch information
0xc0170 committed Aug 10, 2018
2 parents 1027bd5 + d9c78b4 commit c833cc8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
6 changes: 3 additions & 3 deletions tools/export/makefile/Makefile.tmpl
Expand Up @@ -75,11 +75,11 @@ SREC_CAT = srec_cat
{%- endif %}
{%- block additional_executables -%}{%- endblock %}

{% for flag in c_flags %}C_FLAGS += {{flag}}
{% for flag in c_flags %}C_FLAGS += {{shell_escape(flag)}}
{% endfor %}
{% for flag in cxx_flags %}CXX_FLAGS += {{flag}}
{% for flag in cxx_flags %}CXX_FLAGS += {{shell_escape(flag)}}
{% endfor %}
{% for flag in asm_flags %}ASM_FLAGS += {{flag}}
{% for flag in asm_flags %}ASM_FLAGS += {{shell_escape(flag)}}
{% endfor %}

LD_FLAGS :={%- block ld_flags -%} {{ld_flags|join(" ")}} {% endblock %}
Expand Down
33 changes: 16 additions & 17 deletions tools/export/makefile/__init__.py
Expand Up @@ -29,6 +29,15 @@
from tools.utils import NotSupportedException
from tools.targets import TARGET_MAP

SHELL_ESCAPE_TABLE = {
"(": "\(",
")": "\)",
}


def shell_escape(string):
return "".join(SHELL_ESCAPE_TABLE.get(char, char) for char in string)


class Makefile(Exporter):
"""Generic Makefile template that mimics the behavior of the python build
Expand Down Expand Up @@ -88,18 +97,16 @@ def generate(self):
if (basename(dirname(dirname(self.export_dir)))
== "projectfiles")
else [".."]),
'cc_cmd': " ".join([basename(self.toolchain.cc[0])] +
self.toolchain.cc[1:]),
'cppc_cmd': " ".join([basename(self.toolchain.cppc[0])] +
self.toolchain.cppc[1:]),
'asm_cmd': " ".join([basename(self.toolchain.asm[0])] +
self.toolchain.asm[1:]),
'cc_cmd': basename(self.toolchain.cc[0]),
'cppc_cmd': basename(self.toolchain.cppc[0]),
'asm_cmd': basename(self.toolchain.asm[0]),
'ld_cmd': basename(self.toolchain.ld[0]),
'elf2bin_cmd': basename(self.toolchain.elf2bin),
'link_script_ext': self.toolchain.LINKER_EXT,
'link_script_option': self.LINK_SCRIPT_OPTION,
'user_library_flag': self.USER_LIBRARY_FLAG,
'needs_asm_preproc': self.PREPROCESS_ASM,
'shell_escape': shell_escape,
}

if hasattr(self.toolchain, "preproc"):
Expand All @@ -123,6 +130,9 @@ def generate(self):
'to_be_compiled']:
ctx[key] = sorted(ctx[key])
ctx.update(self.format_flags())
ctx['asm_flags'].extend(self.toolchain.asm[1:])
ctx['c_flags'].extend(self.toolchain.cc[1:])
ctx['cxx_flags'].extend(self.toolchain.cppc[1:])

# Add the virtual path the the include option in the ASM flags
new_asm_flags = []
Expand Down Expand Up @@ -265,17 +275,6 @@ class Armc6(Arm):
NAME = 'Make-ARMc6'
TOOLCHAIN = "ARMC6"

@classmethod
def is_target_supported(cls, target_name):
target = TARGET_MAP[target_name]
if target.core in (
"Cortex-M23", "Cortex-M23-NS",
"Cortex-M33", "Cortex-M33-NS"
):
return False
return apply_supported_whitelist(
cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target)


class IAR(Makefile):
"""IAR specific makefile target"""
Expand Down
2 changes: 1 addition & 1 deletion tools/resources/__init__.py
Expand Up @@ -352,7 +352,7 @@ def lib_refs(self):
def linker_script(self):
options = self.get_file_names(FileType.LD_SCRIPT)
if options:
return options[-1]
return options[0]
else:
return None

Expand Down

0 comments on commit c833cc8

Please sign in to comment.