Skip to content

Export: Support Make + ArmC6 + v8m #7559

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 5 commits into from
Aug 10, 2018
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
6 changes: 3 additions & 3 deletions tools/export/makefile/Makefile.tmpl
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,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