From 0c8f66f87bf0f45ff57f2a51607713dd6f6c0ad6 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 12 Jun 2018 09:28:43 -0500 Subject: [PATCH 1/4] Correct supported check of uvision to include uARM --- tools/export/uvision/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/export/uvision/__init__.py b/tools/export/uvision/__init__.py index e75a8e07a8..7500edd6e8 100644 --- a/tools/export/uvision/__init__.py +++ b/tools/export/uvision/__init__.py @@ -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, From b922201a9c02c3a2358f4aa85be346e8f56f2342 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 12 Jun 2018 09:29:10 -0500 Subject: [PATCH 2/4] Heed default_lib in arm compiler --- tools/toolchains/arm.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 766662e5a8..e7dc533882 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -56,6 +56,12 @@ class ARM(mbedToolchain): raise NotSupportedException( "this compiler does not support the core %s" % target.core) + if getattr(target, "defalut_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": @@ -291,8 +297,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): From 1d9fd830af179562c7b712030b133b101ea66f9f Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Tue, 12 Jun 2018 09:54:34 -0500 Subject: [PATCH 3/4] Compute ARM_STD and ARM_MICRO labels with target attrs --- tools/toolchains/__init__.py | 9 +++++++-- tools/toolchains/arm.py | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py index b4e47a2ee8..bad01b4924 100644 --- a/tools/toolchains/__init__.py +++ b/tools/toolchains/__init__.py @@ -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): diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index e7dc533882..0b2f07b870 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -91,6 +91,12 @@ class ARM(mbedToolchain): self.SHEBANG += " --cpu=%s" % cpu + def _get_toolchain_labels(self): + if getattr(self.target, "defalut_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(): @@ -394,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) From 34792e60c6cad202191b4e147b7ae8a7483a1232 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Wed, 13 Jun 2018 09:51:50 -0500 Subject: [PATCH 4/4] Correct "defalut" typo --- tools/toolchains/arm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 0b2f07b870..bc2eb891b5 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -56,7 +56,7 @@ class ARM(mbedToolchain): raise NotSupportedException( "this compiler does not support the core %s" % target.core) - if getattr(target, "defalut_lib", "std") == "small": + 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']: @@ -92,7 +92,7 @@ class ARM(mbedToolchain): self.SHEBANG += " --cpu=%s" % cpu def _get_toolchain_labels(self): - if getattr(self.target, "defalut_lib", "std") == "small": + if getattr(self.target, "default_lib", "std") == "small": return ["ARM", "ARM_MICRO"] else: return ["ARM", "ARM_STD"]