Skip to content

Commit 5f7c439

Browse files
theotherjimmyadbridge
authored andcommitted
Configure sector information in targets.json
1 parent 2cff0ef commit 5f7c439

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

tools/config/__init__.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -649,16 +649,21 @@ def deliver_into(self):
649649
@property
650650
def sectors(self):
651651
"""Return a list of tuples of sector start,size"""
652-
cache = Cache(False, False)
653-
if self.target.device_name not in cache.index:
654-
raise ConfigException("Bootloader not supported on this target: "
655-
"targets.json `device_name` not found in "
656-
"arm_pack_manager index.")
657-
cmsis_part = cache.index[self.target.device_name]
658-
sectors = cmsis_part['sectors']
659-
if sectors:
660-
return sectors
661-
raise ConfigException("No sector info available")
652+
try:
653+
return self.target.sectors
654+
except AttributeError:
655+
cache = Cache(False, False)
656+
if self.target.device_name not in cache.index:
657+
raise ConfigException(
658+
"Bootloader not supported on this target: "
659+
"targets.json `device_name` not found in "
660+
"arm_pack_manager index."
661+
)
662+
cmsis_part = cache.index[self.target.device_name]
663+
sectors = cmsis_part['sectors']
664+
if sectors:
665+
return sectors
666+
raise ConfigException("No sector info available")
662667

663668
def _get_cmsis_part(self):
664669
if not hasattr(self.target, "device_name"):

0 commit comments

Comments
 (0)