Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers __init__.py Source File

__init__.py

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