Skip to content

Commit 2a824a1

Browse files
authored
Merge pull request ARMmbed#7559 from theotherjimmy/make-armc6-v8m
Export: Support Make + ArmC6 + v8m
2 parents 54f40a0 + 58180db commit 2a824a1

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

tools/export/makefile/Makefile.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ SREC_CAT = srec_cat
7575
{%- endif %}
7676
{%- block additional_executables -%}{%- endblock %}
7777

78-
{% for flag in c_flags %}C_FLAGS += {{flag}}
78+
{% for flag in c_flags %}C_FLAGS += {{shell_escape(flag)}}
7979
{% endfor %}
80-
{% for flag in cxx_flags %}CXX_FLAGS += {{flag}}
80+
{% for flag in cxx_flags %}CXX_FLAGS += {{shell_escape(flag)}}
8181
{% endfor %}
82-
{% for flag in asm_flags %}ASM_FLAGS += {{flag}}
82+
{% for flag in asm_flags %}ASM_FLAGS += {{shell_escape(flag)}}
8383
{% endfor %}
8484

8585
LD_FLAGS :={%- block ld_flags -%} {{ld_flags|join(" ")}} {% endblock %}

tools/export/makefile/__init__.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929
from tools.utils import NotSupportedException
3030
from tools.targets import TARGET_MAP
3131

32+
SHELL_ESCAPE_TABLE = {
33+
"(": "\(",
34+
")": "\)",
35+
}
36+
37+
38+
def shell_escape(string):
39+
return "".join(SHELL_ESCAPE_TABLE.get(char, char) for char in string)
40+
3241

3342
class Makefile(Exporter):
3443
"""Generic Makefile template that mimics the behavior of the python build
@@ -88,18 +97,16 @@ def generate(self):
8897
if (basename(dirname(dirname(self.export_dir)))
8998
== "projectfiles")
9099
else [".."]),
91-
'cc_cmd': " ".join([basename(self.toolchain.cc[0])] +
92-
self.toolchain.cc[1:]),
93-
'cppc_cmd': " ".join([basename(self.toolchain.cppc[0])] +
94-
self.toolchain.cppc[1:]),
95-
'asm_cmd': " ".join([basename(self.toolchain.asm[0])] +
96-
self.toolchain.asm[1:]),
100+
'cc_cmd': basename(self.toolchain.cc[0]),
101+
'cppc_cmd': basename(self.toolchain.cppc[0]),
102+
'asm_cmd': basename(self.toolchain.asm[0]),
97103
'ld_cmd': basename(self.toolchain.ld[0]),
98104
'elf2bin_cmd': basename(self.toolchain.elf2bin),
99105
'link_script_ext': self.toolchain.LINKER_EXT,
100106
'link_script_option': self.LINK_SCRIPT_OPTION,
101107
'user_library_flag': self.USER_LIBRARY_FLAG,
102108
'needs_asm_preproc': self.PREPROCESS_ASM,
109+
'shell_escape': shell_escape,
103110
}
104111

105112
if hasattr(self.toolchain, "preproc"):
@@ -123,6 +130,9 @@ def generate(self):
123130
'to_be_compiled']:
124131
ctx[key] = sorted(ctx[key])
125132
ctx.update(self.format_flags())
133+
ctx['asm_flags'].extend(self.toolchain.asm[1:])
134+
ctx['c_flags'].extend(self.toolchain.cc[1:])
135+
ctx['cxx_flags'].extend(self.toolchain.cppc[1:])
126136

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

268-
@classmethod
269-
def is_target_supported(cls, target_name):
270-
target = TARGET_MAP[target_name]
271-
if target.core in (
272-
"Cortex-M23", "Cortex-M23-NS",
273-
"Cortex-M33", "Cortex-M33-NS"
274-
):
275-
return False
276-
return apply_supported_whitelist(
277-
cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target)
278-
279278

280279
class IAR(Makefile):
281280
"""IAR specific makefile target"""

tools/resources/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def lib_refs(self):
352352
def linker_script(self):
353353
options = self.get_file_names(FileType.LD_SCRIPT)
354354
if options:
355-
return options[-1]
355+
return options[0]
356356
else:
357357
return None
358358

0 commit comments

Comments
 (0)