From c40eb0b2d6966760899d1d0c2743770ea130ff09 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Wed, 4 May 2022 23:17:53 +0200 Subject: build: Detect available toolchains. --- build/scons_tools/tool_selectmcu.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'build/scons_tools') diff --git a/build/scons_tools/tool_selectmcu.py b/build/scons_tools/tool_selectmcu.py index 7c011c3..e99df5e 100644 --- a/build/scons_tools/tool_selectmcu.py +++ b/build/scons_tools/tool_selectmcu.py @@ -8,8 +8,16 @@ def SelectMCU(env, mcu, variant_dir = None): print('Unknown MCU: %s' % mcu) Exit(1) + detected_gcc = env.Detect([f'{toolchain}-gcc' for toolchain in spec['toolchains']]) + if detected_gcc is None: + print('Couldn\'t find a suitable toolchain.') + print('Toolchains searched for:') + for toolchain in spec['toolchains']: + print(f' * {toolchain}') + Exit(1) + env.SetDefault( - TOOLCHAIN = '%s-' % spec['toolchains'][0], + TOOLCHAIN = detected_gcc[:-3], ) env.Replace( -- cgit v1.2.3