dhgdh
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
mbd_os/tools/export/coide.py@9:6bb35cef007d, 2016-10-22 (annotated)
- Committer:
- cyberjoey
- Date:
- Sat Oct 22 01:31:58 2016 +0000
- Revision:
- 9:6bb35cef007d
- Parent:
- 1:55a6170b404f
WORKING
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nexpaq | 1:55a6170b404f | 1 | """ |
nexpaq | 1:55a6170b404f | 2 | mbed SDK |
nexpaq | 1:55a6170b404f | 3 | Copyright (c) 2014-2016 ARM Limited |
nexpaq | 1:55a6170b404f | 4 | |
nexpaq | 1:55a6170b404f | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
nexpaq | 1:55a6170b404f | 6 | you may not use this file except in compliance with the License. |
nexpaq | 1:55a6170b404f | 7 | You may obtain a copy of the License at |
nexpaq | 1:55a6170b404f | 8 | |
nexpaq | 1:55a6170b404f | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
nexpaq | 1:55a6170b404f | 10 | |
nexpaq | 1:55a6170b404f | 11 | Unless required by applicable law or agreed to in writing, software |
nexpaq | 1:55a6170b404f | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
nexpaq | 1:55a6170b404f | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
nexpaq | 1:55a6170b404f | 14 | See the License for the specific language governing permissions and |
nexpaq | 1:55a6170b404f | 15 | limitations under the License. |
nexpaq | 1:55a6170b404f | 16 | """ |
nexpaq | 1:55a6170b404f | 17 | from exporters import Exporter |
nexpaq | 1:55a6170b404f | 18 | from os.path import splitext, basename |
nexpaq | 1:55a6170b404f | 19 | |
nexpaq | 1:55a6170b404f | 20 | |
nexpaq | 1:55a6170b404f | 21 | class CoIDE(Exporter): |
nexpaq | 1:55a6170b404f | 22 | NAME = 'CoIDE' |
nexpaq | 1:55a6170b404f | 23 | TOOLCHAIN = 'GCC_ARM' |
nexpaq | 1:55a6170b404f | 24 | |
nexpaq | 1:55a6170b404f | 25 | TARGETS = [ |
nexpaq | 1:55a6170b404f | 26 | 'KL25Z', |
nexpaq | 1:55a6170b404f | 27 | 'KL05Z', |
nexpaq | 1:55a6170b404f | 28 | 'LPC1768', |
nexpaq | 1:55a6170b404f | 29 | 'ARCH_PRO', |
nexpaq | 1:55a6170b404f | 30 | 'ARCH_MAX', |
nexpaq | 1:55a6170b404f | 31 | 'UBLOX_C027', |
nexpaq | 1:55a6170b404f | 32 | 'NUCLEO_L011K4', |
nexpaq | 1:55a6170b404f | 33 | 'NUCLEO_L053R8', |
nexpaq | 1:55a6170b404f | 34 | 'NUCLEO_L152RE', |
nexpaq | 1:55a6170b404f | 35 | 'NUCLEO_F030R8', |
nexpaq | 1:55a6170b404f | 36 | 'NUCLEO_F042K6', |
nexpaq | 1:55a6170b404f | 37 | 'NUCLEO_F070RB', |
nexpaq | 1:55a6170b404f | 38 | 'NUCLEO_F072RB', |
nexpaq | 1:55a6170b404f | 39 | 'NUCLEO_F091RC', |
nexpaq | 1:55a6170b404f | 40 | 'NUCLEO_F103RB', |
nexpaq | 1:55a6170b404f | 41 | 'NUCLEO_F207ZG', |
nexpaq | 1:55a6170b404f | 42 | 'NUCLEO_F302R8', |
nexpaq | 1:55a6170b404f | 43 | 'NUCLEO_F303K8', |
nexpaq | 1:55a6170b404f | 44 | 'NUCLEO_F303RE', |
nexpaq | 1:55a6170b404f | 45 | 'NUCLEO_F334R8', |
nexpaq | 1:55a6170b404f | 46 | 'NUCLEO_F303ZE', |
nexpaq | 1:55a6170b404f | 47 | 'NUCLEO_F401RE', |
nexpaq | 1:55a6170b404f | 48 | 'NUCLEO_F410RB', |
nexpaq | 1:55a6170b404f | 49 | 'NUCLEO_F411RE', |
nexpaq | 1:55a6170b404f | 50 | 'NUCLEO_F429ZI', |
nexpaq | 1:55a6170b404f | 51 | 'NUCLEO_F446RE', |
nexpaq | 1:55a6170b404f | 52 | 'NUCLEO_F446ZE', |
nexpaq | 1:55a6170b404f | 53 | 'DISCO_L053C8', |
nexpaq | 1:55a6170b404f | 54 | 'DISCO_F051R8', |
nexpaq | 1:55a6170b404f | 55 | 'DISCO_F100RB', |
nexpaq | 1:55a6170b404f | 56 | 'DISCO_F303VC', |
nexpaq | 1:55a6170b404f | 57 | 'DISCO_F334C8', |
nexpaq | 1:55a6170b404f | 58 | 'DISCO_F401VC', |
nexpaq | 1:55a6170b404f | 59 | 'DISCO_F407VG', |
nexpaq | 1:55a6170b404f | 60 | 'DISCO_F429ZI', |
nexpaq | 1:55a6170b404f | 61 | 'DISCO_F469NI', |
nexpaq | 1:55a6170b404f | 62 | 'MTS_MDOT_F405RG', |
nexpaq | 1:55a6170b404f | 63 | 'MTS_MDOT_F411RE', |
nexpaq | 1:55a6170b404f | 64 | 'MOTE_L152RC', |
nexpaq | 1:55a6170b404f | 65 | 'NZ32_SC151', |
nexpaq | 1:55a6170b404f | 66 | ] |
nexpaq | 1:55a6170b404f | 67 | |
nexpaq | 1:55a6170b404f | 68 | # seems like CoIDE currently supports only one type |
nexpaq | 1:55a6170b404f | 69 | FILE_TYPES = { |
nexpaq | 1:55a6170b404f | 70 | 'c_sources':'1', |
nexpaq | 1:55a6170b404f | 71 | 'cpp_sources':'1', |
nexpaq | 1:55a6170b404f | 72 | 's_sources':'1' |
nexpaq | 1:55a6170b404f | 73 | } |
nexpaq | 1:55a6170b404f | 74 | FILE_TYPES2 = { |
nexpaq | 1:55a6170b404f | 75 | 'headers':'1' |
nexpaq | 1:55a6170b404f | 76 | } |
nexpaq | 1:55a6170b404f | 77 | |
nexpaq | 1:55a6170b404f | 78 | def generate(self): |
nexpaq | 1:55a6170b404f | 79 | self.resources.win_to_unix() |
nexpaq | 1:55a6170b404f | 80 | source_files = [] |
nexpaq | 1:55a6170b404f | 81 | for r_type, n in CoIDE.FILE_TYPES.iteritems(): |
nexpaq | 1:55a6170b404f | 82 | for file in getattr(self.resources, r_type): |
nexpaq | 1:55a6170b404f | 83 | source_files.append({ |
nexpaq | 1:55a6170b404f | 84 | 'name': basename(file), 'type': n, 'path': file |
nexpaq | 1:55a6170b404f | 85 | }) |
nexpaq | 1:55a6170b404f | 86 | header_files = [] |
nexpaq | 1:55a6170b404f | 87 | for r_type, n in CoIDE.FILE_TYPES2.iteritems(): |
nexpaq | 1:55a6170b404f | 88 | for file in getattr(self.resources, r_type): |
nexpaq | 1:55a6170b404f | 89 | header_files.append({ |
nexpaq | 1:55a6170b404f | 90 | 'name': basename(file), 'type': n, 'path': file |
nexpaq | 1:55a6170b404f | 91 | }) |
nexpaq | 1:55a6170b404f | 92 | |
nexpaq | 1:55a6170b404f | 93 | libraries = [] |
nexpaq | 1:55a6170b404f | 94 | for lib in self.resources.libraries: |
nexpaq | 1:55a6170b404f | 95 | l, _ = splitext(basename(lib)) |
nexpaq | 1:55a6170b404f | 96 | libraries.append(l[3:]) |
nexpaq | 1:55a6170b404f | 97 | |
nexpaq | 1:55a6170b404f | 98 | if self.resources.linker_script is None: |
nexpaq | 1:55a6170b404f | 99 | self.resources.linker_script = '' |
nexpaq | 1:55a6170b404f | 100 | |
nexpaq | 1:55a6170b404f | 101 | ctx = { |
nexpaq | 1:55a6170b404f | 102 | 'name': self.project_name, |
nexpaq | 1:55a6170b404f | 103 | 'source_files': source_files, |
nexpaq | 1:55a6170b404f | 104 | 'header_files': header_files, |
nexpaq | 1:55a6170b404f | 105 | 'include_paths': self.resources.inc_dirs, |
nexpaq | 1:55a6170b404f | 106 | 'scatter_file': self.resources.linker_script, |
nexpaq | 1:55a6170b404f | 107 | 'library_paths': self.resources.lib_dirs, |
nexpaq | 1:55a6170b404f | 108 | 'object_files': self.resources.objects, |
nexpaq | 1:55a6170b404f | 109 | 'libraries': libraries, |
nexpaq | 1:55a6170b404f | 110 | 'symbols': self.toolchain.get_symbols() |
nexpaq | 1:55a6170b404f | 111 | } |
nexpaq | 1:55a6170b404f | 112 | target = self.target.lower() |
nexpaq | 1:55a6170b404f | 113 | |
nexpaq | 1:55a6170b404f | 114 | # Project file |
nexpaq | 1:55a6170b404f | 115 | self.gen_file('coide_%s.coproj.tmpl' % target, ctx, '%s.coproj' % self.project_name) |