Skip to content

Commit cadab34

Browse files
theotherjimmyadbridge
authored andcommitted
Prevent compiling with unsupported compilers
1 parent 753f092 commit cadab34

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
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:

0 commit comments

Comments
 (0)