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