Clone of official tools

Revision:
20:835f6355470d
Parent:
18:11afe2c1837e
Child:
21:4fdf0dd04f6f
--- a/toolchains/__init__.py	Fri Jul 15 13:11:30 2016 +0100
+++ b/toolchains/__init__.py	Fri Jul 15 15:28:09 2016 +0100
@@ -632,6 +632,20 @@
             mkdir(obj_dir)
         return join(obj_dir, name + '.o')
 
+    def get_link_file(self, cmd):
+        link_file = join(self.build_dir, ".link_files.txt")
+        with open(link_file, "wb") as f:
+            cmd_list = []
+            for c in cmd:
+                if c:
+                    c = c.replace("\\", "/")
+                    if self.CHROOT:
+                        c = c.replace(self.CHROOT, '')
+                    cmd_list.append(('"%s"' % c) if not c.startswith('-') else c)
+            string = " ".join(cmd_list)
+            f.write(string)
+        return link_file
+
     def get_inc_file(self, includes):
         include_file = join(self.build_dir, ".includes_%s.txt" % self.inc_md5)
         if not exists(include_file):
@@ -639,7 +653,10 @@
                 cmd_list = []
                 for c in includes:
                     if c:
-                        cmd_list.append(('-I%s' % c).replace("\\", "/"))                    
+                        c = c.replace("\\", "/")
+                        if self.CHROOT:
+                            c = c.replace(self.CHROOT, '')
+                        cmd_list.append('-I%s' % c)
                 string = " ".join(cmd_list)
                 f.write(string)
         return include_file
@@ -858,7 +875,7 @@
 
     def default_cmd(self, command):
         self.debug("Command: %s"% ' '.join(command))
-        _stdout, _stderr, _rc = run_cmd(command)
+        _stdout, _stderr, _rc = run_cmd(command, work_dir=getcwd(), chroot=self.CHROOT)
 
         self.debug("Return: %s"% _rc)
 
@@ -949,13 +966,14 @@
     def get_config_macros(self):
         return Config.config_to_macros(self.config_data) if self.config_data else []
 
-from tools.settings import ARM_BIN
+
+from tools.settings import ARM_PATH
 from tools.settings import GCC_ARM_PATH, GCC_CR_PATH
 from tools.settings import IAR_PATH
 
-TOOLCHAIN_BIN_PATH = {
-    'ARM': ARM_BIN,
-    'uARM': ARM_BIN,
+TOOLCHAIN_PATHS = {
+    'ARM': ARM_PATH,
+    'uARM': ARM_PATH,
     'GCC_ARM': GCC_ARM_PATH,
     'GCC_CR': GCC_CR_PATH,
     'IAR': IAR_PATH