Clone of official tools

Revision:
41:2a77626a4c21
Parent:
40:7d3fa6b99b2b
Child:
43:2a7da56ebd24
--- a/export/gnuarmeclipse/__init__.py	Tue Oct 10 16:56:30 2017 -0500
+++ b/export/gnuarmeclipse/__init__.py	Wed Oct 25 14:46:50 2017 -0500
@@ -126,19 +126,13 @@
             flags['cxx_flags'] += header_options
         return flags
 
-    # override
-    def generate(self):
-        """
-        Generate the .project and .cproject files.
-        """
+    def validate_resources(self):
         if not self.resources.linker_script:
             raise NotSupportedException("No linker script found.")
 
-        print
-        print 'Create a GNU ARM Eclipse C++ managed project'
-        print 'Project name: {0}'.format(self.project_name)
-        print 'Target: {0}'.format(self.toolchain.target.name)
-        print 'Toolchain: {0}'.format(self.TOOLCHAIN)
+    def create_jinja_ctx(self):
+
+        self.validate_resources()
 
         self.resources.win_to_unix()
 
@@ -250,7 +244,7 @@
             opts['ld']['system_libraries'] = self.system_libraries
             opts['ld']['script'] = join(id.capitalize(),
                                         "linker-script-%s.ld" % id)
-            opts['cpp_cmd'] = " ".join(toolchain.preproc)
+            opts['cpp_cmd'] = '"{}"'.format(toolchain.preproc[0]) + " " + " ".join(toolchain.preproc[1:])
 
             # Unique IDs used in multiple places.
             # Those used only once are implemented with {{u.id}}.
@@ -276,6 +270,20 @@
             # will be called repeatedly, to generate multiple UIDs.
             'u': u,
         }
+        return jinja_ctx
+
+    # override
+    def generate(self):
+        """
+        Generate the .project and .cproject files.
+        """
+        jinja_ctx = self.create_jinja_ctx()
+
+        print
+        print 'Create a GNU ARM Eclipse C++ managed project'
+        print 'Project name: {0}'.format(self.project_name)
+        print 'Target: {0}'.format(self.toolchain.target.name)
+        print 'Toolchain: {0}'.format(self.TOOLCHAIN)
 
         self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx,
                       '.project', trim_blocks=True, lstrip_blocks=True)