File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -649,16 +649,21 @@ def deliver_into(self):
649
649
@property
650
650
def sectors (self ):
651
651
"""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" )
662
667
663
668
def _get_cmsis_part (self ):
664
669
if not hasattr (self .target , "device_name" ):
You can’t perform that action at this time.
0 commit comments