Skip to content

Commit b33ab74

Browse files
author
Cruz Monrreal
authored
Merge pull request #6540 from theotherjimmy/compile-check
Prevent compiling with unsupported compilers
2 parents b033a6e + c0410d7 commit b33ab74

File tree

19 files changed

+34
-1
lines changed

19 files changed

+34
-1
lines changed

tools/build_api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,13 @@ def get_mbed_official_release(version):
289289

290290
return mbed_official_release
291291

292+
ARM_COMPILERS = ("ARM", "ARMC6", "uARM")
293+
def target_supports_toolchain(target, toolchain_name):
294+
if toolchain_name in ARM_COMPILERS:
295+
return any(tc in target.supported_toolchains for tc in ARM_COMPILERS)
296+
else:
297+
return toolchain_name in target.supported_toolchains
298+
292299

293300
def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
294301
macros=None, clean=False, jobs=1,
@@ -322,6 +329,11 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
322329
# If the configuration object was not yet created, create it now
323330
config = config or Config(target, src_paths, app_config=app_config)
324331
target = config.target
332+
if not target_supports_toolchain(target, toolchain_name):
333+
raise NotSupportedException(
334+
"Target {} is not supported by toolchain {}".format(
335+
target.name, toolchain_name))
336+
325337
try:
326338
cur_tc = TOOLCHAIN_CLASSES[toolchain_name]
327339
except KeyError:

tools/test/config/app_override_libs/targets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"core": "Cortex-M0",
44
"extra_labels": [],
55
"features": [],
6-
"default_lib": "std"
6+
"default_lib": "std",
7+
"supported_toolchains": ["GCC_ARM"]
78
}
89
}

tools/test/config/compound_inheritance/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"base": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"extra_labels": [],
45
"default_lib": "std",
56
"core": "Cortex-M0",

tools/test/config/double_define/targets.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"first_base": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"extra_labels": [],
45
"default_lib": "std",
56
"core": "Cortex-M0",
@@ -10,6 +11,7 @@
1011
}
1112
},
1213
"second_base": {
14+
"supported_toolchains": ["GCC_ARM"],
1315
"extra_labels": [],
1416
"default_lib": "std",
1517
"core": "Cortex-M0",

tools/test/config/feature_compesition/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"test_target": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"core": "Cortex-M0",
45
"extra_labels": [],
56
"features": [],

tools/test/config/feature_recursive_add/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"test_target": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"core": "Cortex-M0",
45
"extra_labels": [],
56
"features": [],

tools/test/config/feature_recursive_complex/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"test_target": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"core": "Cortex-M0",
45
"extra_labels": [],
56
"features": [],

tools/test/config/feature_remove/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"test_target": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"core": "Cortex-M0",
45
"extra_labels": [],
56
"features": ["IPV4"],

tools/test/config/feature_uvisor/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"test_target": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"core": "Cortex-M0",
45
"extra_labels": [],
56
"features": [],

tools/test/config/macro_inheritance/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"test_target": {
3+
"supported_toolchains": ["GCC_ARM"],
34
"core": "Cortex-M0",
45
"extra_labels": [],
56
"features": [],

0 commit comments

Comments
 (0)