summaryrefslogtreecommitdiff
path: root/build/scons_tools
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2023-04-30 21:53:45 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2023-04-30 21:53:45 +0200
commit666cb1b85259cfbea52e1f4fc69eb1640f2764c2 (patch)
tree99fb316eaacf561729f47633031bc4535ec66d48 /build/scons_tools
parent51c91e98efc5a6ae1ee59f3fff44971a60c7f94d (diff)
build: Allow patching/overriding platform spec.
Diffstat (limited to 'build/scons_tools')
-rw-r--r--build/scons_tools/tool_selectmcu.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/build/scons_tools/tool_selectmcu.py b/build/scons_tools/tool_selectmcu.py
index f73caa1..38b154d 100644
--- a/build/scons_tools/tool_selectmcu.py
+++ b/build/scons_tools/tool_selectmcu.py
@@ -1,6 +1,14 @@
from SCons.Script import *
-def SelectMCU(env, mcu, variant_dir = None):
+def do_patch(target, source):
+ for k, v in source.items():
+ if k in target and isinstance(v, dict):
+ do_patch(target[k], v)
+
+ else:
+ target[k] = v
+
+def SelectMCU(env, mcu, variant_dir = None, patch = None):
spec = env.PlatformSpec(mcu = mcu)
@@ -8,6 +16,9 @@ def SelectMCU(env, mcu, variant_dir = None):
print('Unknown MCU: %s' % mcu)
Exit(1)
+ if patch:
+ do_patch(spec, patch)
+
detected_gcc = env.Detect([f'{toolchain}-gcc' for toolchain in spec['toolchains']])
if detected_gcc is None:
print('Couldn\'t find a suitable toolchain.')