Skip to content

Commit 0a14cc4

Browse files
committed
Merge pull request #61 from 0xc0170/fix_#59
Fixes #59 - build and make - handle toolchain/target name errors
2 parents 7f1306f + 3e91490 commit 0a14cc4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tools/build_api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ def build_project(src_path, build_path, target, toolchain_name,
8383
""" This function builds project. Project can be for example one test / UT
8484
"""
8585
# Toolchain instance
86-
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros, silent, extra_verbose=extra_verbose)
86+
try:
87+
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros, silent, extra_verbose=extra_verbose)
88+
except KeyError as e:
89+
raise KeyError("Toolchain %s not supported" % toolchain_name)
90+
8791
toolchain.VERBOSE = verbose
8892
toolchain.jobs = jobs
8993
toolchain.build_all = clean

tools/make.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@
240240
if options.build_dir is not None:
241241
build_dir = options.build_dir
242242

243-
target = TARGET_MAP[mcu]
243+
try:
244+
target = TARGET_MAP[mcu]
245+
except KeyError:
246+
print "[ERROR] Target %s not supported" % mcu
247+
sys.exit(1)
248+
244249
try:
245250
bin_file = build_project(test.source_dir, build_dir, target, toolchain, test.dependencies, options.options,
246251
linker_script=options.linker_script,

0 commit comments

Comments
 (0)