]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/workspace_tools/export/coide.py
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / workspace_tools / export / coide.py
1 """
2 mbed SDK
3 Copyright (c) 2014 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 CoIDE(Exporter):
22 NAME = 'CoIDE'
23 TOOLCHAIN = 'GCC_ARM'
24
25 TARGETS = [
26 'KL25Z',
27 'KL05Z',
28 'LPC1768',
29 'ARCH_PRO',
30 'ARCH_MAX',
31 'UBLOX_C027',
32 'NUCLEO_L053R8',
33 'NUCLEO_L152RE',
34 'NUCLEO_F030R8',
35 'NUCLEO_F070RB',
36 'NUCLEO_F072RB',
37 'NUCLEO_F091RC',
38 'NUCLEO_F103RB',
39 'NUCLEO_F302R8',
40 'NUCLEO_F303RE',
41 'NUCLEO_F334R8',
42 'NUCLEO_F401RE',
43 'NUCLEO_F411RE',
44 'DISCO_L053C8',
45 'DISCO_F051R8',
46 'DISCO_F100RB',
47 'DISCO_F303VC',
48 'DISCO_F334C8',
49 'DISCO_F401VC',
50 'DISCO_F407VG',
51 'DISCO_F429ZI',
52 'MTS_MDOT_F405RG',
53 'MTS_MDOT_F411RE',
54 'MOTE_L152RC',
55 ]
56
57 # seems like CoIDE currently supports only one type
58 FILE_TYPES = {
59 'c_sources':'1',
60 'cpp_sources':'1',
61 's_sources':'1'
62 }
63 FILE_TYPES2 = {
64 'headers':'1'
65 }
66
67 def generate(self):
68 self.resources.win_to_unix()
69 source_files = []
70 for r_type, n in CoIDE.FILE_TYPES.iteritems():
71 for file in getattr(self.resources, r_type):
72 source_files.append({
73 'name': basename(file), 'type': n, 'path': file
74 })
75 header_files = []
76 for r_type, n in CoIDE.FILE_TYPES2.iteritems():
77 for file in getattr(self.resources, r_type):
78 header_files.append({
79 'name': basename(file), 'type': n, 'path': file
80 })
81
82 libraries = []
83 for lib in self.resources.libraries:
84 l, _ = splitext(basename(lib))
85 libraries.append(l[3:])
86
87 if self.resources.linker_script is None:
88 self.resources.linker_script = ''
89
90 ctx = {
91 'name': self.program_name,
92 'source_files': source_files,
93 'header_files': header_files,
94 'include_paths': self.resources.inc_dirs,
95 'scatter_file': self.resources.linker_script,
96 'library_paths': self.resources.lib_dirs,
97 'object_files': self.resources.objects,
98 'libraries': libraries,
99 'symbols': self.get_symbols()
100 }
101 target = self.target.lower()
102
103 # Project file
104 self.gen_file('coide_%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.program_name)
Imprint / Impressum