Merge pull request #7197 from theotherjimmy/uarm-uvision

Tools: Allow exporting of uARM-only targets to uvision
pull/7224/head
Cruz Monrreal 2018-06-14 17:29:25 -05:00 committed by GitHub
commit 10d9f7fda1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 7 deletions

View File

@ -133,9 +133,16 @@ class Uvision(Exporter):
@classmethod
def is_target_supported(cls, target_name):
target = TARGET_MAP[target_name]
return apply_supported_whitelist(
cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target) and\
DeviceCMSIS.check_supported(target_name)
if not (set(target.supported_toolchains) and set(["ARM", "uARM"])):
return False
if not DeviceCMSIS.check_supported(target_name):
return False
if not hasattr(target, "post_binary_hook"):
return True
if target.post_binary_hook['function'] in cls.POST_BINARY_WHITELIST:
return True
else:
return False
#File associations within .uvprojx file
file_types = {'.cpp': 8, '.c': 1, '.s': 2,

View File

@ -532,8 +532,7 @@ class mbedToolchain:
def get_labels(self):
if self.labels is None:
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
toolchain_labels.remove('mbedToolchain')
toolchain_labels = self._get_toolchain_labels()
self.labels = {
'TARGET': self.target.labels,
'FEATURE': self.target.features,
@ -551,6 +550,12 @@ class mbedToolchain:
self.labels['TARGET'].append("RELEASE")
return self.labels
def _get_toolchain_labels(self):
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
toolchain_labels.remove('mbedToolchain')
toolchain_labels.remove('object')
return toolchain_labels
# Determine whether a source file needs updating/compiling
def need_update(self, target, dependencies):

View File

@ -56,6 +56,12 @@ class ARM(mbedToolchain):
raise NotSupportedException(
"this compiler does not support the core %s" % target.core)
if getattr(target, "default_lib", "std") == "small":
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
if "--library_type=microlib" not in self.flags['ld']:
self.flags['ld'].append("--library_type=microlib")
if target.core == "Cortex-M0+":
cpu = "Cortex-M0"
elif target.core == "Cortex-M4F":
@ -85,6 +91,12 @@ class ARM(mbedToolchain):
self.SHEBANG += " --cpu=%s" % cpu
def _get_toolchain_labels(self):
if getattr(self.target, "default_lib", "std") == "small":
return ["ARM", "ARM_MICRO"]
else:
return ["ARM", "ARM_STD"]
def parse_dependencies(self, dep_path):
dependencies = []
for line in open(dep_path).readlines():
@ -291,8 +303,8 @@ class ARM_STD(ARM):
build_profile=None, build_dir=None):
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
build_profile=build_profile)
if "ARM" not in target.supported_toolchains:
raise NotSupportedException("ARM compiler support is required for ARM build")
if not set(("ARM", "uARM")).intersection(set(target.supported_toolchains)):
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
class ARM_MICRO(ARM):
@ -388,6 +400,9 @@ class ARMC6(ARM_STD):
self.ar = [join(TOOLCHAIN_PATHS["ARMC6"], "armar")]
self.elf2bin = join(TOOLCHAIN_PATHS["ARMC6"], "fromelf")
def _get_toolchain_labels(self):
return ["ARM", "ARM_STD", "ARMC6"]
def parse_dependencies(self, dep_path):
return mbedToolchain.parse_dependencies(self, dep_path)