Skip to content

Commit b0fc103

Browse files
committed
Check for core support in ARM toolchain
1 parent 3a2f58e commit b0fc103

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/toolchains/arm.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class ARM(mbedToolchain):
3333
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
3434
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
3535
SHEBANG = "#! armcc -E"
36+
SUPPORTED_CORES = ["Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4",
37+
"Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD"]
3638

3739
@staticmethod
3840
def check_executable():
@@ -48,6 +50,9 @@ def __init__(self, target, notify=None, macros=None,
4850
build_dir=build_dir,
4951
extra_verbose=extra_verbose,
5052
build_profile=build_profile)
53+
if target.core not in self.SUPPORTED_CORES:
54+
raise NotSupportedException(
55+
"this compiler does not support the core %s" % target.core)
5156

5257
if target.core == "Cortex-M0+":
5358
cpu = "Cortex-M0"
@@ -285,12 +290,19 @@ def __init__(self, target, notify=None, macros=None,
285290

286291
class ARMC6(ARM_STD):
287292
SHEBANG = "#! armclang -E --target=arm-arm-none-eabi -x c"
293+
SUPPORTED_CORES = ["Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4",
294+
"Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD",
295+
"Cortex-M23", "Cortex-M23-NS", "Cortex-M33",
296+
"CortexM33-NS"]
288297
@staticmethod
289298
def check_executable():
290299
return mbedToolchain.generic_check_executable("ARMC6", "armclang", 1)
291300

292301
def __init__(self, target, *args, **kwargs):
293302
mbedToolchain.__init__(self, target, *args, **kwargs)
303+
if target.core not in self.SUPPORTED_CORES:
304+
raise NotSupportedException(
305+
"this compiler does not support the core %s" % target.core)
294306

295307
if not set(("ARM", "ARMC6")).intersection(set(target.supported_toolchains)):
296308
raise NotSupportedException("ARM/ARMC6 compiler support is required for ARMC6 build")

0 commit comments

Comments
 (0)