Clone of official tools
export/ds5_5/__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:
- 41:2a77626a4c21
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) 2011-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 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 DS5_5(Exporter): |
The Other Jimmy |
35:da9c89f8be7d | 23 | NAME = 'DS5' |
The Other Jimmy |
35:da9c89f8be7d | 24 | |
The Other Jimmy |
35:da9c89f8be7d | 25 | TARGETS = [ |
The Other Jimmy |
35:da9c89f8be7d | 26 | 'LPC1768', |
The Other Jimmy |
35:da9c89f8be7d | 27 | 'LPC11U24', |
The Other Jimmy |
35:da9c89f8be7d | 28 | 'LPC812', |
The Other Jimmy |
35:da9c89f8be7d | 29 | 'UBLOX_C027', |
The Other Jimmy |
35:da9c89f8be7d | 30 | 'ARCH_PRO', |
The Other Jimmy |
35:da9c89f8be7d | 31 | 'RZ_A1H', |
The Other Jimmy |
35:da9c89f8be7d | 32 | ] |
The Other Jimmy |
35:da9c89f8be7d | 33 | |
The Other Jimmy |
35:da9c89f8be7d | 34 | USING_MICROLIB = [ |
The Other Jimmy |
35:da9c89f8be7d | 35 | 'LPC812', |
The Other Jimmy |
35:da9c89f8be7d | 36 | ] |
The Other Jimmy |
35:da9c89f8be7d | 37 | |
The Other Jimmy |
35:da9c89f8be7d | 38 | FILE_TYPES = { |
The Other Jimmy |
35:da9c89f8be7d | 39 | 'c_sources':'1', |
The Other Jimmy |
35:da9c89f8be7d | 40 | 'cpp_sources':'8', |
The Other Jimmy |
35:da9c89f8be7d | 41 | 's_sources':'2' |
The Other Jimmy |
35:da9c89f8be7d | 42 | } |
The Other Jimmy |
35:da9c89f8be7d | 43 | |
The Other Jimmy |
35:da9c89f8be7d | 44 | TOOLCHAIN = "ARM" |
The Other Jimmy |
35:da9c89f8be7d | 45 | |
The Other Jimmy |
35:da9c89f8be7d | 46 | def get_toolchain(self): |
The Other Jimmy |
35:da9c89f8be7d | 47 | return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM' |
The Other Jimmy |
35:da9c89f8be7d | 48 | |
The Other Jimmy |
35:da9c89f8be7d | 49 | def generate(self): |
The Other Jimmy |
35:da9c89f8be7d | 50 | source_files = [] |
The Other Jimmy |
35:da9c89f8be7d | 51 | for r_type, n in DS5_5.FILE_TYPES.iteritems(): |
The Other Jimmy |
35:da9c89f8be7d | 52 | for file in getattr(self.resources, r_type): |
The Other Jimmy |
35:da9c89f8be7d | 53 | source_files.append({ |
The Other Jimmy |
35:da9c89f8be7d | 54 | 'name': basename(file), 'type': n, 'path': file |
The Other Jimmy |
35:da9c89f8be7d | 55 | }) |
The Other Jimmy |
35:da9c89f8be7d | 56 | |
The Other Jimmy |
35:da9c89f8be7d | 57 | ctx = { |
The Other Jimmy |
35:da9c89f8be7d | 58 | 'name': self.project_name, |
The Other Jimmy |
35:da9c89f8be7d | 59 | 'include_paths': self.resources.inc_dirs, |
The Other Jimmy |
35:da9c89f8be7d | 60 | 'scatter_file': self.resources.linker_script, |
The Other Jimmy |
35:da9c89f8be7d | 61 | 'object_files': self.resources.objects + self.resources.libraries, |
The Other Jimmy |
35:da9c89f8be7d | 62 | 'source_files': source_files, |
The Other Jimmy |
35:da9c89f8be7d | 63 | 'symbols': self.toolchain.get_symbols() |
The Other Jimmy |
35:da9c89f8be7d | 64 | } |
The Other Jimmy |
35:da9c89f8be7d | 65 | target = self.target.lower() |
The Other Jimmy |
35:da9c89f8be7d | 66 | |
The Other Jimmy |
35:da9c89f8be7d | 67 | # Project file |
The Other Jimmy |
35:da9c89f8be7d | 68 | self.gen_file('ds5_5/%s.project.tmpl' % target, ctx, '.project') |
The Other Jimmy |
35:da9c89f8be7d | 69 | self.gen_file('ds5_5/%s.cproject.tmpl' % target, ctx, '.cproject') |
The Other Jimmy |
35:da9c89f8be7d | 70 | self.gen_file('ds5_5/%s.launch.tmpl' % target, ctx, 'ds5_%s.launch' % target) |