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