dhgdh

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by joey shelton

Committer:
nexpaq
Date:
Sat Sep 17 16:32:05 2016 +0000
Revision:
1:55a6170b404f
checking in for sharing

Who changed what in which revision?

UserRevisionLine numberNew 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 from tools.targets import TARGETS
nexpaq 1:55a6170b404f 20
nexpaq 1:55a6170b404f 21 # filter all the GCC_ARM targets out of the target list
nexpaq 1:55a6170b404f 22 gccTargets = []
nexpaq 1:55a6170b404f 23 for t in TARGETS:
nexpaq 1:55a6170b404f 24 if 'GCC_ARM' in t.supported_toolchains:
nexpaq 1:55a6170b404f 25 gccTargets.append(t.name)
nexpaq 1:55a6170b404f 26
nexpaq 1:55a6170b404f 27 class IntermediateFile(Exporter):
nexpaq 1:55a6170b404f 28 NAME = 'EmBlocks'
nexpaq 1:55a6170b404f 29 TOOLCHAIN = 'GCC_ARM'
nexpaq 1:55a6170b404f 30
nexpaq 1:55a6170b404f 31 # we support all GCC targets (is handled on IDE side)
nexpaq 1:55a6170b404f 32 TARGETS = gccTargets
nexpaq 1:55a6170b404f 33
nexpaq 1:55a6170b404f 34 MBED_CONFIG_HEADER_SUPPORTED = True
nexpaq 1:55a6170b404f 35
nexpaq 1:55a6170b404f 36 FILE_TYPES = {
nexpaq 1:55a6170b404f 37 'headers': 'h',
nexpaq 1:55a6170b404f 38 'c_sources': 'c',
nexpaq 1:55a6170b404f 39 's_sources': 'a',
nexpaq 1:55a6170b404f 40 'cpp_sources': 'cpp'
nexpaq 1:55a6170b404f 41 }
nexpaq 1:55a6170b404f 42
nexpaq 1:55a6170b404f 43
nexpaq 1:55a6170b404f 44 def generate(self):
nexpaq 1:55a6170b404f 45 self.resources.win_to_unix()
nexpaq 1:55a6170b404f 46 source_files = []
nexpaq 1:55a6170b404f 47 for r_type, n in IntermediateFile.FILE_TYPES.iteritems():
nexpaq 1:55a6170b404f 48 for file in getattr(self.resources, r_type):
nexpaq 1:55a6170b404f 49 source_files.append({
nexpaq 1:55a6170b404f 50 'name': file, 'type': n
nexpaq 1:55a6170b404f 51 })
nexpaq 1:55a6170b404f 52
nexpaq 1:55a6170b404f 53 libraries = []
nexpaq 1:55a6170b404f 54 for lib in self.resources.libraries:
nexpaq 1:55a6170b404f 55 l, _ = splitext(basename(lib))
nexpaq 1:55a6170b404f 56 libraries.append(l[3:])
nexpaq 1:55a6170b404f 57
nexpaq 1:55a6170b404f 58
nexpaq 1:55a6170b404f 59 if self.resources.linker_script is None:
nexpaq 1:55a6170b404f 60 self.resources.linker_script = ''
nexpaq 1:55a6170b404f 61
nexpaq 1:55a6170b404f 62 ctx = {
nexpaq 1:55a6170b404f 63 'name': self.project_name,
nexpaq 1:55a6170b404f 64 'target': self.target,
nexpaq 1:55a6170b404f 65 'toolchain': self.toolchain.name,
nexpaq 1:55a6170b404f 66 'source_files': source_files,
nexpaq 1:55a6170b404f 67 'include_paths': self.resources.inc_dirs,
nexpaq 1:55a6170b404f 68 'script_file': self.resources.linker_script,
nexpaq 1:55a6170b404f 69 'library_paths': self.resources.lib_dirs,
nexpaq 1:55a6170b404f 70 'libraries': libraries,
nexpaq 1:55a6170b404f 71 'symbols': self.toolchain.get_symbols(),
nexpaq 1:55a6170b404f 72 'object_files': self.resources.objects,
nexpaq 1:55a6170b404f 73 'sys_libs': self.toolchain.sys_libs,
nexpaq 1:55a6170b404f 74 'cc_org': self.flags['common_flags'] + self.flags['c_flags'],
nexpaq 1:55a6170b404f 75 'ld_org': self.flags['common_flags'] + self.flags['ld_flags'],
nexpaq 1:55a6170b404f 76 'cppc_org': self.flags['common_flags'] + self.flags['cxx_flags']
nexpaq 1:55a6170b404f 77 }
nexpaq 1:55a6170b404f 78
nexpaq 1:55a6170b404f 79 # EmBlocks intermediate file template
nexpaq 1:55a6170b404f 80 self.gen_file('emblocks.eix.tmpl', ctx, '%s.eix' % self.project_name)