Lee Kai Xuan / mbed-os

Fork of mbed-os by erkin yucel

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-2016 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     MBED_CONFIG_HEADER_SUPPORTED = True
00026 
00027     TARGETS = [
00028         'LPC1768',
00029         'LPC4088',
00030         'LPC4088_DM',
00031         'LPC4330_M4',
00032         'LPC1114',
00033         'LPC11U35_401',
00034         'LPC11U35_501',
00035         'UBLOX_C027',
00036         'ARCH_PRO',
00037         'LPC1549',
00038         'LPC11U68',
00039         'LPCCAPPUCCINO',
00040         'LPC824',
00041         'LPC11U37H_401',
00042     ]
00043 
00044     def generate(self):
00045         libraries = []
00046         for lib in self.resources.libraries:
00047             l, _ = splitext(basename(lib))
00048             libraries.append(l[3:])
00049 
00050         ctx = {
00051             'name': self.project_name,
00052             'include_paths': self.resources.inc_dirs,
00053             'linker_script': self.resources.linker_script,
00054             'object_files': self.resources.objects,
00055             'libraries': libraries,
00056             'symbols': self.toolchain.get_symbols()
00057         }
00058         ctx.update(self.flags)
00059         self.gen_file('codered_%s_project.tmpl' % self.target.lower(), ctx, '.project')
00060         self.gen_file('codered_%s_cproject.tmpl' % self.target.lower(), ctx, '.cproject')