tools/export/ds5_5.py@0:0e018d759a2a, 2016-11-08 (annotated)
- Committer:
- switches
- Date:
- Tue Nov 08 18:27:11 2016 +0000
- Revision:
- 0:0e018d759a2a
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:0e018d759a2a | 1 | """ |
switches | 0:0e018d759a2a | 2 | mbed SDK |
switches | 0:0e018d759a2a | 3 | Copyright (c) 2011-2016 ARM Limited |
switches | 0:0e018d759a2a | 4 | |
switches | 0:0e018d759a2a | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
switches | 0:0e018d759a2a | 6 | you may not use this file except in compliance with the License. |
switches | 0:0e018d759a2a | 7 | You may obtain a copy of the License at |
switches | 0:0e018d759a2a | 8 | |
switches | 0:0e018d759a2a | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
switches | 0:0e018d759a2a | 10 | |
switches | 0:0e018d759a2a | 11 | Unless required by applicable law or agreed to in writing, software |
switches | 0:0e018d759a2a | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
switches | 0:0e018d759a2a | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
switches | 0:0e018d759a2a | 14 | See the License for the specific language governing permissions and |
switches | 0:0e018d759a2a | 15 | limitations under the License. |
switches | 0:0e018d759a2a | 16 | """ |
switches | 0:0e018d759a2a | 17 | from exporters import Exporter |
switches | 0:0e018d759a2a | 18 | from os.path import basename |
switches | 0:0e018d759a2a | 19 | |
switches | 0:0e018d759a2a | 20 | |
switches | 0:0e018d759a2a | 21 | class DS5_5(Exporter): |
switches | 0:0e018d759a2a | 22 | NAME = 'DS5' |
switches | 0:0e018d759a2a | 23 | |
switches | 0:0e018d759a2a | 24 | TARGETS = [ |
switches | 0:0e018d759a2a | 25 | 'LPC1768', |
switches | 0:0e018d759a2a | 26 | 'LPC11U24', |
switches | 0:0e018d759a2a | 27 | 'LPC812', |
switches | 0:0e018d759a2a | 28 | 'UBLOX_C027', |
switches | 0:0e018d759a2a | 29 | 'ARCH_PRO', |
switches | 0:0e018d759a2a | 30 | 'RZ_A1H', |
switches | 0:0e018d759a2a | 31 | ] |
switches | 0:0e018d759a2a | 32 | |
switches | 0:0e018d759a2a | 33 | USING_MICROLIB = [ |
switches | 0:0e018d759a2a | 34 | 'LPC812', |
switches | 0:0e018d759a2a | 35 | ] |
switches | 0:0e018d759a2a | 36 | |
switches | 0:0e018d759a2a | 37 | FILE_TYPES = { |
switches | 0:0e018d759a2a | 38 | 'c_sources':'1', |
switches | 0:0e018d759a2a | 39 | 'cpp_sources':'8', |
switches | 0:0e018d759a2a | 40 | 's_sources':'2' |
switches | 0:0e018d759a2a | 41 | } |
switches | 0:0e018d759a2a | 42 | |
switches | 0:0e018d759a2a | 43 | TOOLCHAIN = "ARM" |
switches | 0:0e018d759a2a | 44 | |
switches | 0:0e018d759a2a | 45 | def get_toolchain(self): |
switches | 0:0e018d759a2a | 46 | return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM' |
switches | 0:0e018d759a2a | 47 | |
switches | 0:0e018d759a2a | 48 | def generate(self): |
switches | 0:0e018d759a2a | 49 | source_files = [] |
switches | 0:0e018d759a2a | 50 | for r_type, n in DS5_5.FILE_TYPES.iteritems(): |
switches | 0:0e018d759a2a | 51 | for file in getattr(self.resources, r_type): |
switches | 0:0e018d759a2a | 52 | source_files.append({ |
switches | 0:0e018d759a2a | 53 | 'name': basename(file), 'type': n, 'path': file |
switches | 0:0e018d759a2a | 54 | }) |
switches | 0:0e018d759a2a | 55 | |
switches | 0:0e018d759a2a | 56 | ctx = { |
switches | 0:0e018d759a2a | 57 | 'name': self.project_name, |
switches | 0:0e018d759a2a | 58 | 'include_paths': self.resources.inc_dirs, |
switches | 0:0e018d759a2a | 59 | 'scatter_file': self.resources.linker_script, |
switches | 0:0e018d759a2a | 60 | 'object_files': self.resources.objects + self.resources.libraries, |
switches | 0:0e018d759a2a | 61 | 'source_files': source_files, |
switches | 0:0e018d759a2a | 62 | 'symbols': self.toolchain.get_symbols() |
switches | 0:0e018d759a2a | 63 | } |
switches | 0:0e018d759a2a | 64 | target = self.target.lower() |
switches | 0:0e018d759a2a | 65 | |
switches | 0:0e018d759a2a | 66 | # Project file |
switches | 0:0e018d759a2a | 67 | self.gen_file('ds5_5_%s.project.tmpl' % target, ctx, '.project') |
switches | 0:0e018d759a2a | 68 | self.gen_file('ds5_5_%s.cproject.tmpl' % target, ctx, '.cproject') |
switches | 0:0e018d759a2a | 69 | self.gen_file('ds5_5_%s.launch.tmpl' % target, ctx, 'ds5_%s.launch' % target) |