Skip to content

Commit b886386

Browse files
Merge pull request #4959 from phyokyaw/master
e2 studio exporter update
2 parents c6f655c + 2cbca70 commit b886386

File tree

9 files changed

+453
-757
lines changed

9 files changed

+453
-757
lines changed

tools/export/e2studio/.cproject.tmpl

Lines changed: 414 additions & 0 deletions
Large diffs are not rendered by default.

tools/export/e2studio/__init__.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,34 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17-
from os.path import splitext, basename
17+
from tools.export.gnuarmeclipse import GNUARMEclipse
1818

19-
from tools.export.exporters import Exporter, deprecated_exporter
20-
21-
@deprecated_exporter
22-
class E2Studio(Exporter):
19+
class E2Studio(GNUARMEclipse):
2320
NAME = 'e2 studio'
2421
TOOLCHAIN = 'GCC_ARM'
2522

2623
TARGETS = [
2724
'RZ_A1H',
2825
]
2926

27+
# override
3028
def generate(self):
31-
libraries = []
32-
for lib in self.resources.libraries:
33-
l, _ = splitext(basename(lib))
34-
libraries.append(l[3:])
35-
36-
ctx = {
37-
'name': self.project_name,
38-
'include_paths': self.resources.inc_dirs,
39-
'linker_script': self.resources.linker_script,
29+
30+
jinja_ctx = self.collect_tmpl_vars()
4031

41-
'object_files': self.resources.objects,
42-
'libraries': libraries,
43-
'symbols': self.toolchain.get_symbols()
44-
}
45-
self.gen_file('e2studio/%s_project.tmpl' % self.target.lower(), ctx, '.project')
46-
self.gen_file('e2studio/%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')
47-
self.gen_file('e2studio/%s_gdbinit.tmpl' % self.target.lower(), ctx, '.gdbinit')
48-
self.gen_file('e2studio/launch.tmpl', ctx, '%s OpenOCD.launch' % self.project_name)
32+
print
33+
print 'Create a e2 studio C++ managed project'
34+
print 'Project name: {0}'.format(self.project_name)
35+
print 'Target: {0}'.format(self.toolchain.target.name)
36+
print 'Toolchain: {0}'.format(self.TOOLCHAIN)
37+
38+
self.gen_file('e2studio/.cproject.tmpl', jinja_ctx, '.cproject', trim_blocks=True, lstrip_blocks=True)
39+
self.gen_file('e2studio/.gdbinit.tmpl', jinja_ctx, '.gdbinit')
40+
self.gen_file('e2studio/launch.tmpl', jinja_ctx, '%s OpenOCD.launch' % self.project_name, trim_blocks=True, lstrip_blocks=True)
41+
42+
self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx, '.project', trim_blocks=True, lstrip_blocks=True)
43+
self.gen_file('gnuarmeclipse/mbedignore.tmpl', jinja_ctx, '.mbedignore')
44+
self.gen_file('gnuarmeclipse/makefile.targets.tmpl', jinja_ctx, 'makefile.targets', trim_blocks=True, lstrip_blocks=True)
45+
46+
print
47+
print 'Done. Import the project located at \'{0}\' in e2 studio.'.format(self.project_name)

tools/export/e2studio/rz_a1h_cproject.tmpl

Lines changed: 0 additions & 324 deletions
This file was deleted.

tools/export/e2studio/rz_a1h_project.tmpl

Lines changed: 0 additions & 27 deletions
This file was deleted.

tools/export/e2studio/vk_rz_a1h_cproject.tmpl

Lines changed: 0 additions & 318 deletions
This file was deleted.

tools/export/e2studio/vk_rz_a1h_gdbinit.tmpl

Lines changed: 0 additions & 29 deletions
This file was deleted.

tools/export/e2studio/vk_rz_a1h_project.tmpl

Lines changed: 0 additions & 27 deletions
This file was deleted.

tools/export/gnuarmeclipse/__init__.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,13 @@ def toolchain_flags(self, toolchain):
126126
flags['cxx_flags'] += header_options
127127
return flags
128128

129-
# override
130-
def generate(self):
131-
"""
132-
Generate the .project and .cproject files.
133-
"""
129+
def validate_resources(self):
134130
if not self.resources.linker_script:
135131
raise NotSupportedException("No linker script found.")
136132

137-
print
138-
print 'Create a GNU ARM Eclipse C++ managed project'
139-
print 'Project name: {0}'.format(self.project_name)
140-
print 'Target: {0}'.format(self.toolchain.target.name)
141-
print 'Toolchain: {0}'.format(self.TOOLCHAIN)
133+
def create_jinja_ctx(self):
134+
135+
self.validate_resources()
142136

143137
self.resources.win_to_unix()
144138

@@ -276,6 +270,20 @@ def generate(self):
276270
# will be called repeatedly, to generate multiple UIDs.
277271
'u': u,
278272
}
273+
return jinja_ctx
274+
275+
# override
276+
def generate(self):
277+
"""
278+
Generate the .project and .cproject files.
279+
"""
280+
jinja_ctx = self.create_jinja_ctx()
281+
282+
print
283+
print 'Create a GNU ARM Eclipse C++ managed project'
284+
print 'Project name: {0}'.format(self.project_name)
285+
print 'Target: {0}'.format(self.toolchain.target.name)
286+
print 'Toolchain: {0}'.format(self.TOOLCHAIN)
279287

280288
self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx,
281289
'.project', trim_blocks=True, lstrip_blocks=True)

0 commit comments

Comments
 (0)