Rizky Ardi Maulana / mbed-os
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers __init__.py Source File

__init__.py

00001 from os.path import join, exists, realpath, relpath, basename
00002 from os import makedirs
00003 
00004 from tools.export.makefile import Makefile, GccArm, Armc5, IAR
00005 
00006 class Eclipse (Makefile ):
00007     """Generic Eclipse project. Intended to be subclassed by classes that
00008     specify a type of Makefile.
00009     """
00010     def generate (self):
00011         """Generate Makefile, .cproject & .project Eclipse project file,
00012         py_ocd_settings launch file, and software link .p2f file
00013         """
00014         super(Eclipse, self).generate()
00015         ctx = {
00016             'name': self.project_name,
00017             'elf_location': join('.build',self.project_name)+'.elf',
00018             'c_symbols': self.toolchain.get_symbols(),
00019             'asm_symbols': self.toolchain.get_symbols(True),
00020             'target': self.target,
00021             'include_paths': self.resources.inc_dirs,
00022             'load_exe': str(self.LOAD_EXE).lower()
00023         }
00024 
00025         if not exists(join(self.export_dir,'eclipse-extras')):
00026             makedirs(join(self.export_dir,'eclipse-extras'))
00027 
00028 
00029         self.gen_file('cdt/pyocd_settings.tmpl', ctx,
00030                       join('eclipse-extras',self.target+'_pyocd_settings.launch'))
00031         self.gen_file('cdt/necessary_software.tmpl', ctx,
00032                       join('eclipse-extras','necessary_software.p2f'))
00033 
00034         self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject')
00035         self.gen_file('cdt/.project.tmpl', ctx, '.project')
00036 
00037 
00038 class EclipseGcc(Eclipse , GccArm):
00039     LOAD_EXE = True
00040     NAME = "Eclipse-GCC-ARM"
00041 
00042 class EclipseArmc5(Eclipse , Armc5):
00043     LOAD_EXE = False
00044     NAME = "Eclipse-Armc5"
00045 
00046 class EclipseIAR(Eclipse , IAR):
00047     LOAD_EXE = True
00048     NAME = "Eclipse-IAR"
00049 
00050