Skip to content

Commit 10d9f7f

Browse files
author
Cruz Monrreal
authored
Merge pull request #7197 from theotherjimmy/uarm-uvision
Tools: Allow exporting of uARM-only targets to uvision
2 parents a588d15 + 34792e6 commit 10d9f7f

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

tools/export/uvision/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,16 @@ class Uvision(Exporter):
133133
@classmethod
134134
def is_target_supported(cls, target_name):
135135
target = TARGET_MAP[target_name]
136-
return apply_supported_whitelist(
137-
cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target) and\
138-
DeviceCMSIS.check_supported(target_name)
136+
if not (set(target.supported_toolchains) and set(["ARM", "uARM"])):
137+
return False
138+
if not DeviceCMSIS.check_supported(target_name):
139+
return False
140+
if not hasattr(target, "post_binary_hook"):
141+
return True
142+
if target.post_binary_hook['function'] in cls.POST_BINARY_WHITELIST:
143+
return True
144+
else:
145+
return False
139146

140147
#File associations within .uvprojx file
141148
file_types = {'.cpp': 8, '.c': 1, '.s': 2,

tools/toolchains/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,7 @@ def add_macros(self, new_macros):
532532

533533
def get_labels(self):
534534
if self.labels is None:
535-
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
536-
toolchain_labels.remove('mbedToolchain')
535+
toolchain_labels = self._get_toolchain_labels()
537536
self.labels = {
538537
'TARGET': self.target.labels,
539538
'FEATURE': self.target.features,
@@ -551,6 +550,12 @@ def get_labels(self):
551550
self.labels['TARGET'].append("RELEASE")
552551
return self.labels
553552

553+
def _get_toolchain_labels(self):
554+
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
555+
toolchain_labels.remove('mbedToolchain')
556+
toolchain_labels.remove('object')
557+
return toolchain_labels
558+
554559

555560
# Determine whether a source file needs updating/compiling
556561
def need_update(self, target, dependencies):

tools/toolchains/arm.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ def __init__(self, target, notify=None, macros=None,
5656
raise NotSupportedException(
5757
"this compiler does not support the core %s" % target.core)
5858

59+
if getattr(target, "default_lib", "std") == "small":
60+
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
61+
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
62+
if "--library_type=microlib" not in self.flags['ld']:
63+
self.flags['ld'].append("--library_type=microlib")
64+
5965
if target.core == "Cortex-M0+":
6066
cpu = "Cortex-M0"
6167
elif target.core == "Cortex-M4F":
@@ -85,6 +91,12 @@ def __init__(self, target, notify=None, macros=None,
8591

8692
self.SHEBANG += " --cpu=%s" % cpu
8793

94+
def _get_toolchain_labels(self):
95+
if getattr(self.target, "default_lib", "std") == "small":
96+
return ["ARM", "ARM_MICRO"]
97+
else:
98+
return ["ARM", "ARM_STD"]
99+
88100
def parse_dependencies(self, dep_path):
89101
dependencies = []
90102
for line in open(dep_path).readlines():
@@ -291,8 +303,8 @@ def __init__(self, target, notify=None, macros=None,
291303
build_profile=None, build_dir=None):
292304
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
293305
build_profile=build_profile)
294-
if "ARM" not in target.supported_toolchains:
295-
raise NotSupportedException("ARM compiler support is required for ARM build")
306+
if not set(("ARM", "uARM")).intersection(set(target.supported_toolchains)):
307+
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
296308

297309

298310
class ARM_MICRO(ARM):
@@ -388,6 +400,9 @@ def __init__(self, target, *args, **kwargs):
388400
self.ar = [join(TOOLCHAIN_PATHS["ARMC6"], "armar")]
389401
self.elf2bin = join(TOOLCHAIN_PATHS["ARMC6"], "fromelf")
390402

403+
def _get_toolchain_labels(self):
404+
return ["ARM", "ARM_STD", "ARMC6"]
405+
391406
def parse_dependencies(self, dep_path):
392407
return mbedToolchain.parse_dependencies(self, dep_path)
393408

0 commit comments

Comments
 (0)