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, 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 766662e5a8..bc2eb891b5 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, "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)