ST / ST_Events-old

Dependents:   HelloWorld_CCA01M1 HelloWorld_CCA02M1 CI-data-logger-server HelloWorld_CCA02M1 ... more

This is a fork of the events subdirectory of https://github.com/ARMmbed/mbed-os.

Note, you must import this library with import name: events!!!

Files at this revision

API Documentation at this revision

Comitter:
Russ Butler
Date:
Wed Feb 08 14:29:52 2017 -0600
Parent:
9747:3e6b88fc2c98
Child:
9795:090a4729a692
Commit message:
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.

Changed in this revision

tools/export/iar/__init__.py Show annotated file Show diff for this revision Revisions of this file
--- a/tools/export/iar/__init__.py	Thu Feb 02 11:05:59 2017 -0600
+++ b/tools/export/iar/__init__.py	Wed Feb 08 14:29:52 2017 -0600
@@ -25,11 +25,19 @@
     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 @@
 
     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": "",