Skip to content

Commit 0c594a4

Browse files
committed
The check for managed bootloader support should be in regions and we need a try/catch when we call it.
Moved "bootloader_not_supported" check to where it was and handle that exception at only one place. Removed ram/rom size info for realtek from targets.json. THe info we have is not correct. was Not handling config exceptions from regions and ram_regions property adding rom-ram info for REALTEK_RTL8195AM
1 parent e3c4dae commit 0c594a4

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

platform/mbed_stats.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,14 @@ void mbed_stats_sys_get(mbed_stats_sys_t *stats)
131131

132132
#if defined(MBED_SYS_STATS_ENABLED)
133133
stats->os_version = MBED_VERSION;
134+
#if defined(MBED_RAM_START) && defined(MBED_RAM_SIZE)
134135
stats->ram_start[0] = MBED_RAM_START;
135136
stats->ram_size[0] = MBED_RAM_SIZE;
137+
#endif
138+
#if defined(MBED_ROM_START) && defined(MBED_ROM_SIZE)
136139
stats->rom_start[0] = MBED_ROM_START;
137140
stats->rom_size[0] = MBED_ROM_SIZE;
141+
#endif
138142
#if defined(MBED_RAM1_START) && defined(MBED_RAM1_SIZE)
139143
stats->ram_start[1] = MBED_RAM1_START;
140144
stats->ram_size[1] = MBED_RAM1_SIZE;

tools/config/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def get_all_active_memories(self, memory_list):
630630
# Counter to keep track of ROM/RAM memories supported by target
631631
active_memory_counter = 0
632632
# Find which memory we are dealing with, RAM/ROM
633-
active_memory = 'RAM' if any('RAM' in mem_list for mem_list in memory_list) else 'ROM'
633+
active_memory = 'ROM' if any('ROM' in mem_list for mem_list in memory_list) else 'RAM'
634634

635635
try:
636636
cmsis_part = self._get_cmsis_part()
@@ -699,9 +699,9 @@ def ram_regions(self):
699699

700700
@property
701701
def regions(self):
702-
"""Generate a list of regions from the config"""
703702
if not getattr(self.target, "bootloader_supported", False):
704703
raise ConfigException("Bootloader not supported on this target.")
704+
"""Generate a list of regions from the config"""
705705
if ((self.target.bootloader_img or self.target.restrict_size) and
706706
(self.target.mbed_app_start or self.target.mbed_app_size)):
707707
raise ConfigException(

tools/toolchains/__init__.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -724,19 +724,26 @@ def add_regions(self):
724724
"""Add regions to the build profile, if there are any.
725725
"""
726726
if self.config.has_regions:
727-
regions = list(self.config.regions)
728-
self.notify.info("Using ROM region%s %s in this build." % (
729-
"s" if len(regions) > 1 else "",
730-
", ".join(r.name for r in regions)
731-
))
732-
self._add_all_regions(regions, "MBED_APP")
727+
try:
728+
regions = list(self.config.regions)
729+
self.notify.info("Using ROM region%s %s in this build." % (
730+
"s" if len(regions) > 1 else "",
731+
", ".join(r.name for r in regions)
732+
))
733+
self._add_all_regions(regions, "MBED_APP")
734+
except ConfigException:
735+
pass
736+
733737
if self.config.has_ram_regions:
734-
regions = list(self.config.ram_regions)
735-
self.notify.info("Using RAM region%s %s in this build." % (
736-
"s" if len(regions) > 1 else "",
737-
", ".join(r.name for r in regions)
738-
))
739-
self._add_all_regions(regions, "MBED_RAM")
738+
try:
739+
regions = list(self.config.ram_regions)
740+
self.notify.info("Using RAM region%s %s in this build." % (
741+
"s" if len(regions) > 1 else "",
742+
", ".join(r.name for r in regions)
743+
))
744+
self._add_all_regions(regions, "MBED_RAM")
745+
except ConfigException:
746+
pass
740747

741748
Region = namedtuple("Region", "name start size")
742749

0 commit comments

Comments
 (0)