From d7e0012bc79d1e94f9e10be5367de2341d25900e Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 9 Dec 2019 10:37:40 +0000 Subject: [PATCH] tools: regions only if bootloader is supported We removed catching and passing, we want to know for any misconfiguration if bootloader is supported. Regions should check if bootloader is supported. In case not, just return. Otherwise we catch any error. This should help us to uncover missing regions or other config error (in case bootloader is enabled via bootloader_supported set to true). --- tools/toolchains/mbed_toolchain.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/toolchains/mbed_toolchain.py b/tools/toolchains/mbed_toolchain.py index 301f5f91bc..52ca8da35a 100755 --- a/tools/toolchains/mbed_toolchain.py +++ b/tools/toolchains/mbed_toolchain.py @@ -894,6 +894,10 @@ class mbedToolchain(with_metaclass(ABCMeta, object)): def add_regions(self): """Add regions to the build profile, if there are any. """ + + if not getattr(self.target, "bootloader_supported", False): + return + if self.config.has_regions: regions = list(self.config.regions) regions.sort(key=lambda x: x.start) @@ -913,6 +917,7 @@ class mbedToolchain(with_metaclass(ABCMeta, object)): Region = namedtuple("Region", "name start size") + # Add all available ROM regions to build profile if not getattr(self.target, "static_memory_defines", False): raise ConfigException() @@ -926,7 +931,6 @@ class mbedToolchain(with_metaclass(ABCMeta, object)): True, suffixes=["_START", "_SIZE"] ) - # Add all available RAM regions to build profile if not getattr(self.target, "static_memory_defines", False): raise ConfigException() @@ -941,7 +945,6 @@ class mbedToolchain(with_metaclass(ABCMeta, object)): suffixes=["_START", "_SIZE"] ) - STACK_PARAM = "target.boot-stack-size" TFM_LVL_PARAM = "tfm.level" XIP_ENABLE_PARAM = "target.xip-enable"