the other jimmy / mbed-sdk-tools

Fork of mbed-sdk-tools by mbed official

Revision:
20:835f6355470d
Parent:
13:ab47a20b66f0
Child:
21:4fdf0dd04f6f
diff -r 3604ee113e2d -r 835f6355470d toolchains/iar.py
--- a/toolchains/iar.py	Fri Jul 15 13:11:30 2016 +0100
+++ b/toolchains/iar.py	Fri Jul 15 15:28:09 2016 +0100
@@ -18,8 +18,7 @@
 from os import remove
 from os.path import join, exists, dirname, splitext, exists
 
-from tools.toolchains import mbedToolchain
-from tools.settings import IAR_PATH
+from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
 from tools.settings import GOANNA_PATH
 from tools.hooks import hook_tool
 
@@ -66,12 +65,12 @@
         if target.core == "Cortex-M4F":
           c_flags_cmd = [
               "--cpu", "Cortex-M4F",
-              "--thumb", "--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h")
+              "--thumb", "--dlib_config", join(TOOLCHAIN_PATHS['IAR'], "inc", "c", "DLib_Config_Full.h")
           ]
         else:
           c_flags_cmd = [
               "--cpu", cpuchoice,
-              "--thumb", "--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h")
+              "--thumb", "--dlib_config", join(TOOLCHAIN_PATHS['IAR'], "inc", "c", "DLib_Config_Full.h")
           ]
         # custom c++ cmd flags
         cxx_flags_cmd = [
@@ -90,7 +89,7 @@
         else:
             c_flags_cmd.append("-Oh")
 
-        IAR_BIN = join(IAR_PATH, "bin")
+        IAR_BIN = join(TOOLCHAIN_PATHS['IAR'], "bin")
         main_cc = join(IAR_BIN, "iccarm")
 
         self.asm  = [join(IAR_BIN, "iasmarm")] + asm_flags_cmd + self.flags["asm"]
@@ -202,15 +201,8 @@
         cmd = self.hook.get_cmdline_linker(cmd)
 
         # Split link command to linker executable + response file
-        link_files = join(dirname(output), ".link_files.txt")
-        with open(link_files, "wb") as f:
-            cmd_linker = cmd[0]
-            cmd_list = []
-            for c in cmd[1:]:
-                if c:
-                    cmd_list.append(('"%s"' % c) if not c.startswith('-') else c)                    
-            string = " ".join(cmd_list).replace("\\", "/")
-            f.write(string)
+        cmd_linker = cmd[0]
+        link_files = self.get_link_file(cmd[1:])
 
         # Exec command
         self.default_cmd([cmd_linker, '-f', link_files])