diff --git a/tools/export/e2studio/.cproject.tmpl b/tools/export/e2studio/.cproject.tmpl new file mode 100644 index 0000000000..d8732301d3 --- /dev/null +++ b/tools/export/e2studio/.cproject.tmpl @@ -0,0 +1,414 @@ + + + + + + {% for cfg_key in options %} + {% set opts = options[cfg_key] %} + + + + + + + + + + + + + + + + + + + + + + + + + + {% endfor %} + + + + + + + {% for cfg_key in options %} + {% set opts = options[cfg_key] %} + + + + {% endfor %} + {% for cfg_key in options %} + {% set opts = options[cfg_key] %} + + + + {% endfor %} + + + + diff --git a/tools/export/e2studio/rz_a1h_gdbinit.tmpl b/tools/export/e2studio/.gdbinit.tmpl similarity index 100% rename from tools/export/e2studio/rz_a1h_gdbinit.tmpl rename to tools/export/e2studio/.gdbinit.tmpl diff --git a/tools/export/e2studio/__init__.py b/tools/export/e2studio/__init__.py index 447dee58a8..e937a318fa 100644 --- a/tools/export/e2studio/__init__.py +++ b/tools/export/e2studio/__init__.py @@ -14,12 +14,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ -from os.path import splitext, basename +from tools.export.gnuarmeclipse import GNUARMEclipse -from tools.export.exporters import Exporter, deprecated_exporter - -@deprecated_exporter -class E2Studio(Exporter): +class E2Studio(GNUARMEclipse): NAME = 'e2 studio' TOOLCHAIN = 'GCC_ARM' @@ -27,22 +24,24 @@ class E2Studio(Exporter): 'RZ_A1H', ] + # override def generate(self): - libraries = [] - for lib in self.resources.libraries: - l, _ = splitext(basename(lib)) - libraries.append(l[3:]) - ctx = { - 'name': self.project_name, - 'include_paths': self.resources.inc_dirs, - 'linker_script': self.resources.linker_script, + jinja_ctx = self.collect_tmpl_vars() - 'object_files': self.resources.objects, - 'libraries': libraries, - 'symbols': self.toolchain.get_symbols() - } - self.gen_file('e2studio/%s_project.tmpl' % self.target.lower(), ctx, '.project') - self.gen_file('e2studio/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject') - self.gen_file('e2studio/%s_gdbinit.tmpl' % self.target.lower(), ctx, '.gdbinit') - self.gen_file('e2studio/launch.tmpl', ctx, '%s OpenOCD.launch' % self.project_name) + print + print 'Create a e2 studio 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('e2studio/.cproject.tmpl', jinja_ctx, '.cproject', trim_blocks=True, lstrip_blocks=True) + self.gen_file('e2studio/.gdbinit.tmpl', jinja_ctx, '.gdbinit') + self.gen_file('e2studio/launch.tmpl', jinja_ctx, '%s OpenOCD.launch' % self.project_name, trim_blocks=True, lstrip_blocks=True) + + self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx, '.project', trim_blocks=True, lstrip_blocks=True) + self.gen_file('gnuarmeclipse/mbedignore.tmpl', jinja_ctx, '.mbedignore') + self.gen_file('gnuarmeclipse/makefile.targets.tmpl', jinja_ctx, 'makefile.targets', trim_blocks=True, lstrip_blocks=True) + + print + print 'Done. Import the project located at \'{0}\' in e2 studio.'.format(self.project_name) diff --git a/tools/export/e2studio/rz_a1h_cproject.tmpl b/tools/export/e2studio/rz_a1h_cproject.tmpl deleted file mode 100644 index d54ad2f337..0000000000 --- a/tools/export/e2studio/rz_a1h_cproject.tmpl +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/export/e2studio/rz_a1h_project.tmpl b/tools/export/e2studio/rz_a1h_project.tmpl deleted file mode 100644 index 0bab8dd408..0000000000 --- a/tools/export/e2studio/rz_a1h_project.tmpl +++ /dev/null @@ -1,27 +0,0 @@ - - - {{name}} - This file was automagically generated by mbed.org. For more information, see http://mbed.org/handbook/Exporting-To-e2studio - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/tools/export/e2studio/vk_rz_a1h_cproject.tmpl b/tools/export/e2studio/vk_rz_a1h_cproject.tmpl deleted file mode 100644 index 85dcd99424..0000000000 --- a/tools/export/e2studio/vk_rz_a1h_cproject.tmpl +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/export/e2studio/vk_rz_a1h_gdbinit.tmpl b/tools/export/e2studio/vk_rz_a1h_gdbinit.tmpl deleted file mode 100644 index a59f78c10c..0000000000 --- a/tools/export/e2studio/vk_rz_a1h_gdbinit.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -define hook-step -mon cortex_a maskisr on -end - -define hook-stepi -mon cortex_a maskisr on -end - -define hook-next -mon cortex_a maskisr on -end - -define hook-nexti -mon cortex_a maskisr on -end - -define hook-finish -mon cortex_a maskisr on -end - -define hook-stop -mon cortex_a maskisr off -end - -define hook-kill -mon reset init -end - -set mem inaccessible-by-default off \ No newline at end of file diff --git a/tools/export/e2studio/vk_rz_a1h_project.tmpl b/tools/export/e2studio/vk_rz_a1h_project.tmpl deleted file mode 100644 index 0bab8dd408..0000000000 --- a/tools/export/e2studio/vk_rz_a1h_project.tmpl +++ /dev/null @@ -1,27 +0,0 @@ - - - {{name}} - This file was automagically generated by mbed.org. For more information, see http://mbed.org/handbook/Exporting-To-e2studio - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/tools/export/gnuarmeclipse/__init__.py b/tools/export/gnuarmeclipse/__init__.py index 3a6f480d73..1a432a4c45 100644 --- a/tools/export/gnuarmeclipse/__init__.py +++ b/tools/export/gnuarmeclipse/__init__.py @@ -126,19 +126,13 @@ class GNUARMEclipse(Exporter): 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() @@ -276,6 +270,20 @@ class GNUARMEclipse(Exporter): # 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)