Skip to content

Commit 32b1203

Browse files
committed
Generic makefile in eclipse
1 parent f949a6d commit 32b1203

File tree

4 files changed

+54
-9
lines changed

4 files changed

+54
-9
lines changed

tools/export/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from tools.export import uvision4, uvision5, codered, makefile, ds5_5, iar
2323
from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
24-
from tools.export import sw4stm32, e2studio, zip, eclipse
24+
from tools.export import sw4stm32, e2studio, zip, cdt
2525
from tools.export.exporters import OldLibrariesException, FailedBuildException
2626
from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP
2727

@@ -45,6 +45,9 @@
4545
'atmelstudio' : atmelstudio.AtmelStudio,
4646
'sw4stm32' : sw4stm32.Sw4STM32,
4747
'e2studio' : e2studio.E2Studio,
48+
'eclipse_gcc_arm' : cdt.EclipseGcc,
49+
'eclipse_iar' : cdt.EclipseIAR,
50+
'eclipse_armc5' : cdt.EclipseArmc5,
4851
'zip' : zip.ZIP
4952
}
5053

tools/export/cdt/.cproject.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<folderInfo id="0.936619452." name="/" resourcePath="">
1919
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.957782855" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
2020
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.957782855.1870418474" name=""/>
21-
<builder arguments="compile -j0 -t GCC_ARM -m {{target}} -o debug-info" command="mbed-cli" id="org.eclipse.cdt.build.core.settings.default.builder.1415080330" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
21+
<builder arguments="-j" command="make" id="org.eclipse.cdt.build.core.settings.default.builder.1415080330" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
2222
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.445325914" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
2323
<tool id="org.eclipse.cdt.build.core.settings.holder.302788810" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
2424
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1008027188" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">

tools/export/cdt/__init__.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from os.path import join, exists, realpath, relpath, basename
2+
from os import makedirs
3+
4+
from tools.export.makefile import Makefile, GccArm, Armc5, IAR
5+
6+
class Eclipse(Makefile):
7+
"""Generic Eclipse project. Intended to be subclassed by classes that
8+
specify a type of Makefile.
9+
"""
10+
def generate(self):
11+
"""Generate Makefile, .cproject & .project Eclipse project file,
12+
py_ocd_settings launch file, and software link .p2f file
13+
"""
14+
super(Eclipse, self).generate()
15+
ctx = {
16+
'name': self.project_name,
17+
'elf_location': join('.build',self.project_name)+'.elf',
18+
'c_symbols': self.toolchain.get_symbols(),
19+
'asm_symbols': self.toolchain.get_symbols(True),
20+
'target': self.target,
21+
'include_paths': self.resources.inc_dirs
22+
}
23+
24+
if not exists(join(self.export_dir,'eclipse-extras')):
25+
makedirs(join(self.export_dir,'eclipse-extras'))
26+
27+
28+
self.gen_file('cdt/py_ocd_settings.tmpl', ctx,
29+
join('eclipse-extras',self.target+'_py_ocd_settings.launch'))
30+
self.gen_file('cdt/necessary_software.tmpl', ctx,
31+
join('eclipse-extras','necessary_software.p2f'))
32+
33+
cproj = relpath('.cproject',self.export_dir)
34+
self.gen_file('cdt/.cproject.tmpl', ctx,
35+
cproj)
36+
proj = relpath('.project',self.export_dir)
37+
self.gen_file('cdt/.project.tmpl', ctx,
38+
proj)
39+
40+
41+
class EclipseGcc(Eclipse, GccArm): pass
42+
43+
class EclipseArmc5(Eclipse, Armc5): pass
44+
45+
class EclipseIAR(Eclipse, IAR): pass
46+
47+

tools/export/cdt/necessary_software.tmpl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<?p2f version='1.0.0'?>
33
<p2f version='1.0.0'>
4-
<ius size='2'>
5-
<iu id='ilg.gnuarmeclipse.managedbuild.cross.feature.group' name='GNU ARM C/C++ Cross Compiler' version='2.2.1.201606210758'>
6-
<repositories size='1'>
7-
<repository location='http://gnuarmeclipse.sourceforge.net/updates'/>
8-
</repositories>
9-
</iu>
10-
<iu id='ilg.gnuarmeclipse.debug.gdbjtag.openocd.feature.group' name='GNU ARM C/C++ OpenOCD Debugging' version='4.1.1.201606210758'>
4+
<ius size='1'>
5+
<iu id='ilg.gnuarmeclipse.debug.gdbjtag.pyocd.feature.group' name='GNU ARM C/C++ PyOCD Debugging' version='1.1.1.201606210758'>
116
<repositories size='1'>
127
<repository location='http://gnuarmeclipse.sourceforge.net/updates'/>
138
</repositories>

0 commit comments

Comments
 (0)