Skip to content

Commit 5ec7a0b

Browse files
Jammu Kekkonen0xc0170
authored andcommitted
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.
1 parent b7c3b35 commit 5ec7a0b

File tree

1 file changed

+39
-49
lines changed

1 file changed

+39
-49
lines changed

tools/toolchains/mbed_toolchain.py

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -895,62 +895,52 @@ def add_regions(self):
895895
"""Add regions to the build profile, if there are any.
896896
"""
897897
if self.config.has_regions:
898-
try:
899-
regions = list(self.config.regions)
900-
regions.sort(key=lambda x: x.start)
901-
self.notify.info("Using ROM region%s %s in this build." % (
902-
"s" if len(regions) > 1 else "",
903-
", ".join(r.name for r in regions)
904-
))
905-
self._add_all_regions(regions, "MBED_APP")
906-
except ConfigException:
907-
pass
898+
regions = list(self.config.regions)
899+
regions.sort(key=lambda x: x.start)
900+
self.notify.info("Using ROM region%s %s in this build." % (
901+
"s" if len(regions) > 1 else "",
902+
", ".join(r.name for r in regions)
903+
))
904+
self._add_all_regions(regions, "MBED_APP")
908905

909906
if self.config.has_ram_regions:
910-
try:
911-
regions = list(self.config.ram_regions)
912-
self.notify.info("Using RAM region%s %s in this build." % (
913-
"s" if len(regions) > 1 else "",
914-
", ".join(r.name for r in regions)
915-
))
916-
self._add_all_regions(regions, None)
917-
except ConfigException:
918-
pass
907+
regions = list(self.config.ram_regions)
908+
self.notify.info("Using RAM region%s %s in this build." % (
909+
"s" if len(regions) > 1 else "",
910+
", ".join(r.name for r in regions)
911+
))
912+
self._add_all_regions(regions, None)
919913

920914
Region = namedtuple("Region", "name start size")
921915

922-
try:
923-
# Add all available ROM regions to build profile
924-
if not getattr(self.target, "static_memory_defines", False):
925-
raise ConfigException()
926-
rom_available_regions = self.config.get_all_active_memories(
927-
ROM_ALL_MEMORIES
916+
# Add all available ROM regions to build profile
917+
if not getattr(self.target, "static_memory_defines", False):
918+
raise ConfigException()
919+
rom_available_regions = self.config.get_all_active_memories(
920+
ROM_ALL_MEMORIES
921+
)
922+
for key, value in rom_available_regions.items():
923+
rom_start, rom_size = value
924+
self._add_defines_from_region(
925+
Region("MBED_" + key, rom_start, rom_size),
926+
True,
927+
suffixes=["_START", "_SIZE"]
928928
)
929-
for key, value in rom_available_regions.items():
930-
rom_start, rom_size = value
931-
self._add_defines_from_region(
932-
Region("MBED_" + key, rom_start, rom_size),
933-
True,
934-
suffixes=["_START", "_SIZE"]
935-
)
936-
except ConfigException:
937-
pass
938-
try:
939-
# Add all available RAM regions to build profile
940-
if not getattr(self.target, "static_memory_defines", False):
941-
raise ConfigException()
942-
ram_available_regions = self.config.get_all_active_memories(
943-
RAM_ALL_MEMORIES
929+
930+
# Add all available RAM regions to build profile
931+
if not getattr(self.target, "static_memory_defines", False):
932+
raise ConfigException()
933+
ram_available_regions = self.config.get_all_active_memories(
934+
RAM_ALL_MEMORIES
935+
)
936+
for key, value in ram_available_regions.items():
937+
ram_start, ram_size = value
938+
self._add_defines_from_region(
939+
Region("MBED_" + key, ram_start, ram_size),
940+
True,
941+
suffixes=["_START", "_SIZE"]
944942
)
945-
for key, value in ram_available_regions.items():
946-
ram_start, ram_size = value
947-
self._add_defines_from_region(
948-
Region("MBED_" + key, ram_start, ram_size),
949-
True,
950-
suffixes=["_START", "_SIZE"]
951-
)
952-
except ConfigException:
953-
pass
943+
954944

955945
STACK_PARAM = "target.boot-stack-size"
956946
TFM_LVL_PARAM = "tfm.level"

0 commit comments

Comments
 (0)