]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/workspace_tools/export/gccarm.py
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / workspace_tools / export / gccarm.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 GccArm(Exporter):
22     NAME = 'GccArm'
23     TOOLCHAIN = 'GCC_ARM'
24
25     TARGETS = [
26         'LPC1768',
27         'LPC1549',
28         'KL05Z',
29         'KL25Z',
30         'KL43Z',
31         'KL46Z',
32         'K64F',
33         'K22F',
34         'K20D50M',
35         'LPC4088',
36         'LPC4088_DM',
37         'LPC4330_M4',
38         'LPC11U24',
39         'LPC1114',
40         'LPC11U35_401',
41         'LPC11U35_501',
42         'LPC11U37H_401',
43         'LPC824',
44         'SSCI824',
45         'STM32F407',
46         'DISCO_F100RB',
47         'DISCO_F051R8',
48         'DISCO_F407VG',
49         'DISCO_F303VC',
50         'UBLOX_C027',
51         'ARCH_PRO',
52         'NRF51822',
53         'HRM1017',
54         'RBLAB_NRF51822',
55         'LPC2368',
56         'LPCCAPPUCCINO',
57         'ARCH_BLE',
58         'MTS_GAMBIT',
59         'ARCH_MAX',
60         'NUCLEO_F401RE',
61         'NUCLEO_F411RE',
62         'ARCH_MAX',
63         'DISCO_F429ZI',
64         'NUCLEO_F030R8',
65         'NUCLEO_F070RB',
66         'NUCLEO_F072RB',
67         'NUCLEO_F091RC',
68         'NUCLEO_F103RB',
69         'NUCLEO_F302R8',
70         'NUCLEO_F303RE',
71         'NUCLEO_F334R8',
72         'DISCO_L053C8',
73         'NUCLEO_L053R8',
74         'NUCLEO_L073RZ',
75         'DISCO_F334C8',
76         'MAX32600MBED',
77         'MAXWSNENV',
78         'MTS_MDOT_F405RG',
79         'MTS_MDOT_F411RE',
80         'NUCLEO_L152RE',
81         'NRF51_DK',
82         'NRF51_DONGLE',
83         'SEEED_TINY_BLE',
84         'DISCO_F401VC',
85                 'DELTA_DFCM_NNN40',
86         'RZ_A1H',
87         'MOTE_L152RC',
88     ]
89
90     DOT_IN_RELATIVE_PATH = True
91
92     def generate(self):
93         # "make" wants Unix paths
94         self.resources.win_to_unix()
95
96         to_be_compiled = []
97         for r_type in ['s_sources', 'c_sources', 'cpp_sources']:
98             r = getattr(self.resources, r_type)
99             if r:
100                 for source in r:
101                     base, ext = splitext(source)
102                     to_be_compiled.append(base + '.o')
103
104         libraries = []
105         for lib in self.resources.libraries:
106             l, _ = splitext(basename(lib))
107             libraries.append(l[3:])
108
109         ctx = {
110             'name': self.program_name,
111             'to_be_compiled': to_be_compiled,
112             'object_files': self.resources.objects,
113             'include_paths': self.resources.inc_dirs,
114             'library_paths': self.resources.lib_dirs,
115             'linker_script': self.resources.linker_script,
116             'libraries': libraries,
117             'symbols': self.get_symbols()
118         }
119         self.gen_file('gcc_arm_%s.tmpl' % self.target.lower(), ctx, 'Makefile')