Clone of official tools

Revision:
36:96847d42f010
Parent:
35:da9c89f8be7d
Child:
38:399953da035d
--- a/export/iar/__init__.py	Wed Feb 15 13:53:18 2017 -0600
+++ b/export/iar/__init__.py	Thu Jun 22 11:12:28 2017 -0500
@@ -10,6 +10,7 @@
 from tools.export.exporters import Exporter, TargetNotSupportedException
 import json
 from tools.export.cmsis import DeviceCMSIS
+from tools.utils import NotSupportedException
 from multiprocessing import cpu_count
 
 class IAR(Exporter):
@@ -18,8 +19,7 @@
 
     #iar_definitions.json location
     def_loc = os.path.join(
-        os.path.dirname(os.path.abspath(__file__)), '..', '..', '..',
-        'tools','export', 'iar', 'iar_definitions.json')
+        os.path.dirname(os.path.abspath(__file__)), 'iar_definitions.json')
 
     #create a dictionary of the definitions
     with open(def_loc, 'r') as f:
@@ -78,6 +78,9 @@
             "FPU2": 0,
             "NrRegs": 0,
             "NEON": '',
+            "CExtraOptionsCheck": 0,
+            "CExtraOptions": "",
+            "CMSISDAPJtagSpeedList": 0,
         }
 
         iar_defaults.update(device_info)
@@ -97,6 +100,8 @@
 
     def generate(self):
         """Generate the .eww, .ewd, and .ewp files"""
+        if not self.resources.linker_script:
+            raise NotSupportedException("No linker script found.")
         srcs = self.resources.headers + self.resources.s_sources + \
                self.resources.c_sources + self.resources.cpp_sources + \
                self.resources.objects + self.resources.libraries
@@ -108,7 +113,7 @@
         template = ["--vla", "--no_static_destruction"]
         # Flag invalid if set in template
         # Optimizations are also set in template
-        invalid_flag = lambda x: x in template or re.match("-O(\d|time|n)", x)
+        invalid_flag = lambda x: x in template or re.match("-O(\d|time|n|hz?)", x)
         flags['c_flags'] = [flag for flag in c_flags if not invalid_flag(flag)]
 
         try: