Brian Daniels / mbed-tools

Fork of mbed-tools by Morpheus

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers codered.py Source File

codered.py

00001 """
00002 mbed SDK
00003 Copyright (c) 2011-2013 ARM Limited
00004 
00005 Licensed under the Apache License, Version 2.0 (the "License");
00006 you may not use this file except in compliance with the License.
00007 You may obtain a copy of the License at
00008 
00009 http://www.apache.org/licenses/LICENSE-2.0
00010 
00011 Unless required by applicable law or agreed to in writing, software
00012 distributed under the License is distributed on an "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 See the License for the specific language governing permissions and
00015 limitations under the License.
00016 """
00017 from exporters import Exporter
00018 from os.path import splitext, basename
00019 
00020 
00021 class CodeRed(Exporter):
00022     NAME = 'CodeRed'
00023     TOOLCHAIN = 'GCC_CR'
00024 
00025     TARGETS = [
00026         'LPC1768',
00027         'LPC4088',
00028         'LPC4088_DM',
00029         'LPC4330_M4',
00030         'LPC1114',
00031         'LPC11U35_401',
00032         'LPC11U35_501',
00033         'UBLOX_C027',
00034         'ARCH_PRO',
00035         'LPC1549',
00036         'LPC11U68',
00037         'LPCCAPPUCCINO',
00038         'LPC824',
00039         'LPC11U37H_401',
00040     ]
00041 
00042     def generate(self):
00043         libraries = []
00044         for lib in self.resources.libraries:
00045             l, _ = splitext(basename(lib))
00046             libraries.append(l[3:])
00047 
00048         ctx = {
00049             'name': self.program_name,
00050             'include_paths': self.resources.inc_dirs,
00051             'linker_script': self.resources.linker_script,
00052             'object_files': self.resources.objects,
00053             'libraries': libraries,
00054             'symbols': self.get_symbols()
00055         }
00056         self.gen_file('codered_%s_project.tmpl' % self.target.lower(), ctx, '.project')
00057         self.gen_file('codered_%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')