ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

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, realpath, relpath, basename
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',self.target+'_pyocd_settings.launch'))
00034         self.gen_file('cdt/necessary_software.tmpl', ctx,
00035                       join('eclipse-extras','necessary_software.p2f'))
00036 
00037         self.gen_file('cdt/.cproject.tmpl', ctx, '.cproject')
00038         self.gen_file('cdt/.project.tmpl', ctx, '.project')
00039 
00040 
00041 class EclipseGcc(Eclipse , GccArm):
00042     LOAD_EXE = True
00043     NAME = "Eclipse-GCC-ARM"
00044 
00045 class EclipseArmc5(Eclipse , Armc5):
00046     LOAD_EXE = False
00047     NAME = "Eclipse-Armc5"
00048 
00049 class EclipseIAR(Eclipse , IAR):
00050     LOAD_EXE = True
00051     NAME = "Eclipse-IAR"
00052 
00053