]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/workspace_tools/export/codesourcery.py
Merge commit 'f6d56675f9f981c5464f0ca7a1fbb0162154e8c5'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / workspace_tools / export / codesourcery.py
1 """
2 mbed SDK
3 Copyright (c) 2011-2013 ARM Limited
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 """
17 from exporters import Exporter
18 from os.path import splitext, basename
19
20
21 class CodeSourcery(Exporter):
22 NAME = 'CodeSourcery'
23 TOOLCHAIN = 'GCC_CS'
24
25 TARGETS = [
26 'LPC1768',
27 'UBLOX_C027',
28 'ARCH_PRO',
29 ]
30
31 DOT_IN_RELATIVE_PATH = True
32
33 def generate(self):
34 # "make" wants Unix paths
35 self.resources.win_to_unix()
36
37 to_be_compiled = []
38 for r_type in ['s_sources', 'c_sources', 'cpp_sources']:
39 r = getattr(self.resources, r_type)
40 if r:
41 for source in r:
42 base, ext = splitext(source)
43 to_be_compiled.append(base + '.o')
44
45 libraries = []
46 for lib in self.resources.libraries:
47 l, _ = splitext(basename(lib))
48 libraries.append(l[3:])
49
50 ctx = {
51 'name': self.program_name,
52 'to_be_compiled': to_be_compiled,
53 'object_files': self.resources.objects,
54 'include_paths': self.resources.inc_dirs,
55 'library_paths': self.resources.lib_dirs,
56 'linker_script': self.resources.linker_script,
57 'libraries': libraries,
58 'symbols': self.get_symbols()
59 }
60 self.gen_file('codesourcery_%s.tmpl' % self.target.lower(), ctx, 'Makefile')
Imprint / Impressum