Remove hiding of config errors related to RAM and ROM regions handling.

Currently any misconfiguration of, for example, bootloader feature will cause the
build system to just silently drop it and continue building which can lead to
completed builds of something the user didn't want to build in worst case and
failing builds after compilation (=wasted time) in the best.
pull/12059/head
Jammu Kekkonen 2019-12-03 10:29:35 +02:00 committed by Martin Kojtal
parent b7c3b35d65
commit 5ec7a0b625
1 changed files with 39 additions and 49 deletions

View File

@ -895,62 +895,52 @@ class mbedToolchain(with_metaclass(ABCMeta, object)):
"""Add regions to the build profile, if there are any. """Add regions to the build profile, if there are any.
""" """
if self.config.has_regions: if self.config.has_regions:
try: regions = list(self.config.regions)
regions = list(self.config.regions) regions.sort(key=lambda x: x.start)
regions.sort(key=lambda x: x.start) self.notify.info("Using ROM region%s %s in this build." % (
self.notify.info("Using ROM region%s %s in this build." % ( "s" if len(regions) > 1 else "",
"s" if len(regions) > 1 else "", ", ".join(r.name for r in regions)
", ".join(r.name for r in regions) ))
)) self._add_all_regions(regions, "MBED_APP")
self._add_all_regions(regions, "MBED_APP")
except ConfigException:
pass
if self.config.has_ram_regions: if self.config.has_ram_regions:
try: regions = list(self.config.ram_regions)
regions = list(self.config.ram_regions) self.notify.info("Using RAM region%s %s in this build." % (
self.notify.info("Using RAM region%s %s in this build." % ( "s" if len(regions) > 1 else "",
"s" if len(regions) > 1 else "", ", ".join(r.name for r in regions)
", ".join(r.name for r in regions) ))
)) self._add_all_regions(regions, None)
self._add_all_regions(regions, None)
except ConfigException:
pass
Region = namedtuple("Region", "name start size") Region = namedtuple("Region", "name start size")
try: # Add all available ROM regions to build profile
# Add all available ROM regions to build profile if not getattr(self.target, "static_memory_defines", False):
if not getattr(self.target, "static_memory_defines", False): raise ConfigException()
raise ConfigException() rom_available_regions = self.config.get_all_active_memories(
rom_available_regions = self.config.get_all_active_memories( ROM_ALL_MEMORIES
ROM_ALL_MEMORIES )
for key, value in rom_available_regions.items():
rom_start, rom_size = value
self._add_defines_from_region(
Region("MBED_" + key, rom_start, rom_size),
True,
suffixes=["_START", "_SIZE"]
) )
for key, value in rom_available_regions.items():
rom_start, rom_size = value # Add all available RAM regions to build profile
self._add_defines_from_region( if not getattr(self.target, "static_memory_defines", False):
Region("MBED_" + key, rom_start, rom_size), raise ConfigException()
True, ram_available_regions = self.config.get_all_active_memories(
suffixes=["_START", "_SIZE"] RAM_ALL_MEMORIES
) )
except ConfigException: for key, value in ram_available_regions.items():
pass ram_start, ram_size = value
try: self._add_defines_from_region(
# Add all available RAM regions to build profile Region("MBED_" + key, ram_start, ram_size),
if not getattr(self.target, "static_memory_defines", False): True,
raise ConfigException() suffixes=["_START", "_SIZE"]
ram_available_regions = self.config.get_all_active_memories(
RAM_ALL_MEMORIES
) )
for key, value in ram_available_regions.items():
ram_start, ram_size = value
self._add_defines_from_region(
Region("MBED_" + key, ram_start, ram_size),
True,
suffixes=["_START", "_SIZE"]
)
except ConfigException:
pass
STACK_PARAM = "target.boot-stack-size" STACK_PARAM = "target.boot-stack-size"
TFM_LVL_PARAM = "tfm.level" TFM_LVL_PARAM = "tfm.level"