exporters: allow target name to be used for IAR

Allow the IAR exporter to fall back to a target's name if the
device_name entry is missing.
pull/3755/head
Russ Butler 2017-02-08 14:29:52 -06:00 committed by Martin Kojtal
parent 62b61505ae
commit 45fa0f28b1
1 changed files with 16 additions and 6 deletions

View File

@ -25,11 +25,19 @@ class IAR(Exporter):
with open(def_loc, 'r') as f:
IAR_DEFS = json.load(f)
#supported targets have a device name and corresponding definition in
#iar_definitions.json
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
if hasattr(obj, 'device_name') and
obj.device_name in IAR_DEFS.keys() and "IAR" in obj.supported_toolchains]
def _iar_support(tgt, iar_targets):
if "IAR" not in tgt.supported_toolchains:
return False
if hasattr(tgt, 'device_name') and tgt.device_name in iar_targets:
return True
if tgt.name in iar_targets:
return True
return False
#supported targets have a name or device_name which maps to a definition
#in iar_definitions.json
TARGETS = [target for target, obj in TARGET_MAP.iteritems() if
_iar_support(obj, IAR_DEFS.keys())]
def iar_groups(self, grouped_src):
"""Return a namedtuple of group info
@ -56,7 +64,9 @@ class IAR(Exporter):
def iar_device(self):
"""Retrieve info from iar_definitions.json"""
device_name = TARGET_MAP[self.target].device_name
tgt = TARGET_MAP[self.target]
device_name = (tgt.device_name if hasattr(tgt, "device_name") else
tgt.name)
device_info = self.IAR_DEFS[device_name]
iar_defaults ={
"OGChipSelectEditMenu": "",