Configure sector information in targets.json

pull/10188/head
Jimmy Brisson 2019-03-21 10:04:19 -05:00
parent db8a018fec
commit 03f9a0cd23
1 changed files with 15 additions and 10 deletions

View File

@ -649,16 +649,21 @@ class Config(object):
@property
def sectors(self):
"""Return a list of tuples of sector start,size"""
cache = Cache(False, False)
if self.target.device_name not in cache.index:
raise ConfigException("Bootloader not supported on this target: "
"targets.json `device_name` not found in "
"arm_pack_manager index.")
cmsis_part = cache.index[self.target.device_name]
sectors = cmsis_part['sectors']
if sectors:
return sectors
raise ConfigException("No sector info available")
try:
return self.target.sectors
except AttributeError:
cache = Cache(False, False)
if self.target.device_name not in cache.index:
raise ConfigException(
"Bootloader not supported on this target: "
"targets.json `device_name` not found in "
"arm_pack_manager index."
)
cmsis_part = cache.index[self.target.device_name]
sectors = cmsis_part['sectors']
if sectors:
return sectors
raise ConfigException("No sector info available")
def _get_cmsis_part(self):
if not hasattr(self.target, "device_name"):