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.
__init__.py
00001 """ 00002 mbed SDK 00003 Copyright (c) 2014-2016 ARM Limited 00004 00005 Licensed under the Apache License, Version 2.0 (the "License"); 00006 you may not use this file except in compliance with the License. 00007 You may obtain a copy of the License at 00008 00009 http://www.apache.org/licenses/LICENSE-2.0 00010 00011 Unless required by applicable law or agreed to in writing, software 00012 distributed under the License is distributed on an "AS IS" BASIS, 00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 See the License for the specific language governing permissions and 00015 limitations under the License. 00016 """ 00017 from os.path import splitext, basename 00018 from os import remove 00019 from tools.targets import TARGET_MAP 00020 from tools.export.exporters import Exporter, apply_supported_whitelist 00021 00022 00023 POST_BINARY_WHITELIST = set([ 00024 "TEENSY3_1Code.binary_hook", 00025 "LPCTargetCode.lpc_patch", 00026 "LPC4088Code.binary_hook" 00027 ]) 00028 00029 00030 class EmBitz(Exporter ): 00031 NAME = 'EmBitz' 00032 TOOLCHAIN = 'GCC_ARM' 00033 00034 MBED_CONFIG_HEADER_SUPPORTED = True 00035 00036 FILE_TYPES = { 00037 'headers': 'h', 00038 'c_sources': 'c', 00039 's_sources': 'a', 00040 'cpp_sources': 'cpp' 00041 } 00042 00043 @classmethod 00044 def is_target_supported(cls, target_name): 00045 target = TARGET_MAP[target_name] 00046 return apply_supported_whitelist( 00047 cls.TOOLCHAIN, POST_BINARY_WHITELIST, target) 00048 00049 @staticmethod 00050 def _remove_symbols(sym_list): 00051 return [s for s in sym_list if not s.startswith("-D")] 00052 00053 def generate(self): 00054 self.resources.win_to_unix() 00055 source_files = [] 00056 for r_type, n in self.FILE_TYPES.items(): 00057 for file in getattr(self.resources, r_type): 00058 source_files.append({ 00059 'name': file, 'type': n 00060 }) 00061 00062 libraries = [] 00063 for lib in self.resources.libraries: 00064 l, _ = splitext(basename(lib)) 00065 libraries.append(l[3:]) 00066 00067 00068 if self.resources.linker_script is None: 00069 self.resources.linker_script = '' 00070 00071 ctx = { 00072 'name': self.project_name, 00073 'target': self.target, 00074 'toolchain': self.toolchain.name, 00075 'source_files': source_files, 00076 'include_paths': self.resources.inc_dirs, 00077 'script_file': self.resources.linker_script, 00078 'library_paths': self.resources.lib_dirs, 00079 'libraries': libraries, 00080 'symbols': self.toolchain.get_symbols(), 00081 'object_files': self.resources.objects, 00082 'sys_libs': self.toolchain.sys_libs, 00083 'cc_org': (self.flags['common_flags'] + 00084 self._remove_symbols(self.flags['c_flags'])), 00085 'ld_org': self.flags['ld_flags'], 00086 'cppc_org': (self.flags['common_flags'] + 00087 self._remove_symbols(self.flags['cxx_flags'])) 00088 } 00089 00090 self.gen_file('embitz/eix.tmpl', ctx, '%s.eix' % self.project_name) 00091 00092 @staticmethod 00093 def clean(project_name): 00094 remove("%s.eix" % project_name)
Generated on Tue Jul 12 2022 12:43:27 by
