Generic makefile in eclipse

pull/2833/head
Sarah Marsh 2016-08-24 12:54:34 -05:00
parent f949a6d4f8
commit 32b1203b6c
4 changed files with 54 additions and 9 deletions

View File

@ -21,7 +21,7 @@ import yaml
from tools.export import uvision4, uvision5, codered, makefile, ds5_5, iar
from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
from tools.export import sw4stm32, e2studio, zip, eclipse
from tools.export import sw4stm32, e2studio, zip, cdt
from tools.export.exporters import OldLibrariesException, FailedBuildException
from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP
@ -45,6 +45,9 @@ EXPORTERS = {
'atmelstudio' : atmelstudio.AtmelStudio,
'sw4stm32' : sw4stm32.Sw4STM32,
'e2studio' : e2studio.E2Studio,
'eclipse_gcc_arm' : cdt.EclipseGcc,
'eclipse_iar' : cdt.EclipseIAR,
'eclipse_armc5' : cdt.EclipseArmc5,
'zip' : zip.ZIP
}

View File

@ -18,7 +18,7 @@
<folderInfo id="0.936619452." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.957782855" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.957782855.1870418474" name=""/>
<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"/>
<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"/>
<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"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.302788810" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1008027188" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">

View File

@ -0,0 +1,47 @@
from os.path import join, exists, realpath, relpath, basename
from os import makedirs
from tools.export.makefile import Makefile, GccArm, Armc5, IAR
class Eclipse(Makefile):
"""Generic Eclipse project. Intended to be subclassed by classes that
specify a type of Makefile.
"""
def generate(self):
"""Generate Makefile, .cproject & .project Eclipse project file,
py_ocd_settings launch file, and software link .p2f file
"""
super(Eclipse, self).generate()
ctx = {
'name': self.project_name,
'elf_location': join('.build',self.project_name)+'.elf',
'c_symbols': self.toolchain.get_symbols(),
'asm_symbols': self.toolchain.get_symbols(True),
'target': self.target,
'include_paths': self.resources.inc_dirs
}
if not exists(join(self.export_dir,'eclipse-extras')):
makedirs(join(self.export_dir,'eclipse-extras'))
self.gen_file('cdt/py_ocd_settings.tmpl', ctx,
join('eclipse-extras',self.target+'_py_ocd_settings.launch'))
self.gen_file('cdt/necessary_software.tmpl', ctx,
join('eclipse-extras','necessary_software.p2f'))
cproj = relpath('.cproject',self.export_dir)
self.gen_file('cdt/.cproject.tmpl', ctx,
cproj)
proj = relpath('.project',self.export_dir)
self.gen_file('cdt/.project.tmpl', ctx,
proj)
class EclipseGcc(Eclipse, GccArm): pass
class EclipseArmc5(Eclipse, Armc5): pass
class EclipseIAR(Eclipse, IAR): pass

View File

@ -1,13 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<?p2f version='1.0.0'?>
<p2f version='1.0.0'>
<ius size='2'>
<iu id='ilg.gnuarmeclipse.managedbuild.cross.feature.group' name='GNU ARM C/C++ Cross Compiler' version='2.2.1.201606210758'>
<repositories size='1'>
<repository location='http://gnuarmeclipse.sourceforge.net/updates'/>
</repositories>
</iu>
<iu id='ilg.gnuarmeclipse.debug.gdbjtag.openocd.feature.group' name='GNU ARM C/C++ OpenOCD Debugging' version='4.1.1.201606210758'>
<ius size='1'>
<iu id='ilg.gnuarmeclipse.debug.gdbjtag.pyocd.feature.group' name='GNU ARM C/C++ PyOCD Debugging' version='1.1.1.201606210758'>
<repositories size='1'>
<repository location='http://gnuarmeclipse.sourceforge.net/updates'/>
</repositories>