Skip to content

Commit 654f4d9

Browse files
committed
Modify ARM_STD,ARM_MICRO,ARMC6 constructors to be compatible with older versions of build tools
1 parent 4e7d34b commit 654f4d9

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

tools/toolchains/arm.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,13 @@ def __init__(self, target, notify=None, macros=None,
342342
build_profile=None, build_dir=None):
343343
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
344344
build_profile=build_profile)
345-
#check only for ARMC5 because ARM_STD means using ARMC5, and thus supported_toolchains must include ARMC5
346-
if "ARMC5" not in target.supported_toolchains:
347-
raise NotSupportedException("ARM compiler 5 support is required for ARM build")
345+
if int(target.build_tools_metadata["version"]) > 0:
346+
#check only for ARMC5 because ARM_STD means using ARMC5, and thus supported_toolchains must include ARMC5
347+
if "ARMC5" not in target.supported_toolchains:
348+
raise NotSupportedException("ARM compiler 5 support is required for ARM build")
349+
else:
350+
if not set(("ARM", "uARM")).intersection(set(target.supported_toolchains)):
351+
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
348352

349353
class ARM_MICRO(ARM):
350354
PATCHED_LIBRARY = False
@@ -354,13 +358,16 @@ def __init__(self, target, notify=None, macros=None,
354358
build_dir=None):
355359
target.default_toolchain = "uARM"
356360

357-
#At this point we already know that we want to use ARMC5+Microlib, so check for if they are supported
358-
#For, AC6+Microlib we still use ARMC6 class
359-
if not set(("uARM","ARMC5")).issubset(set(target.supported_toolchains)):
360-
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
361+
if int(target.build_tools_metadata["version"]) > 0:
362+
#At this point we already know that we want to use ARMC5+Microlib, so check for if they are supported
363+
#For, AC6+Microlib we still use ARMC6 class
364+
if not set(("ARMC5","uARM")).issubset(set(target.supported_toolchains)):
365+
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
366+
else:
367+
if not set(("ARM", "uARM")).intersection(set(target.supported_toolchains)):
368+
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
361369
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
362370
build_profile=build_profile)
363-
364371

365372
class ARMC6(ARM_STD):
366373
OFFICIALLY_SUPPORTED = True
@@ -382,8 +389,12 @@ def __init__(self, target, *args, **kwargs):
382389
raise NotSupportedException(
383390
"this compiler does not support the core %s" % target.core)
384391

385-
if not set(("ARM", "ARMC6", "uARM")).intersection(set(target.supported_toolchains)):
386-
raise NotSupportedException("ARM/ARMC6 compiler support is required for ARMC6 build")
392+
if int(target.build_tools_metadata["version"]) > 0:
393+
if not set(("ARM", "ARMC6", "uARM")).intersection(set(target.supported_toolchains)):
394+
raise NotSupportedException("ARM/ARMC6 compiler support is required for ARMC6 build")
395+
else:
396+
if not set(("ARM", "ARMC6")).intersection(set(target.supported_toolchains)):
397+
raise NotSupportedException("ARM/ARMC6 compiler support is required for ARMC6 build")
387398

388399
if getattr(target, "default_toolchain", "ARMC6") == "uARM":
389400
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:

0 commit comments

Comments
 (0)