BA
/
BaBoRo_test2
Backup 1
mbed-os/tools/toolchains/gcc.py@0:02dd72d1d465, 2018-04-24 (annotated)
- Committer:
- borlanic
- Date:
- Tue Apr 24 11:45:18 2018 +0000
- Revision:
- 0:02dd72d1d465
BaBoRo_test2 - backup 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
borlanic | 0:02dd72d1d465 | 1 | """ |
borlanic | 0:02dd72d1d465 | 2 | mbed SDK |
borlanic | 0:02dd72d1d465 | 3 | Copyright (c) 2011-2013 ARM Limited |
borlanic | 0:02dd72d1d465 | 4 | |
borlanic | 0:02dd72d1d465 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
borlanic | 0:02dd72d1d465 | 6 | you may not use this file except in compliance with the License. |
borlanic | 0:02dd72d1d465 | 7 | You may obtain a copy of the License at |
borlanic | 0:02dd72d1d465 | 8 | |
borlanic | 0:02dd72d1d465 | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
borlanic | 0:02dd72d1d465 | 10 | |
borlanic | 0:02dd72d1d465 | 11 | Unless required by applicable law or agreed to in writing, software |
borlanic | 0:02dd72d1d465 | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
borlanic | 0:02dd72d1d465 | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
borlanic | 0:02dd72d1d465 | 14 | See the License for the specific language governing permissions and |
borlanic | 0:02dd72d1d465 | 15 | limitations under the License. |
borlanic | 0:02dd72d1d465 | 16 | """ |
borlanic | 0:02dd72d1d465 | 17 | import re |
borlanic | 0:02dd72d1d465 | 18 | from os.path import join, basename, splitext, dirname, exists |
borlanic | 0:02dd72d1d465 | 19 | from distutils.spawn import find_executable |
borlanic | 0:02dd72d1d465 | 20 | |
borlanic | 0:02dd72d1d465 | 21 | from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS |
borlanic | 0:02dd72d1d465 | 22 | from tools.hooks import hook_tool |
borlanic | 0:02dd72d1d465 | 23 | |
borlanic | 0:02dd72d1d465 | 24 | class GCC(mbedToolchain): |
borlanic | 0:02dd72d1d465 | 25 | LINKER_EXT = '.ld' |
borlanic | 0:02dd72d1d465 | 26 | LIBRARY_EXT = '.a' |
borlanic | 0:02dd72d1d465 | 27 | |
borlanic | 0:02dd72d1d465 | 28 | STD_LIB_NAME = "lib%s.a" |
borlanic | 0:02dd72d1d465 | 29 | DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)') |
borlanic | 0:02dd72d1d465 | 30 | |
borlanic | 0:02dd72d1d465 | 31 | def __init__(self, target, notify=None, macros=None, |
borlanic | 0:02dd72d1d465 | 32 | silent=False, extra_verbose=False, build_profile=None, |
borlanic | 0:02dd72d1d465 | 33 | build_dir=None): |
borlanic | 0:02dd72d1d465 | 34 | mbedToolchain.__init__(self, target, notify, macros, silent, |
borlanic | 0:02dd72d1d465 | 35 | extra_verbose=extra_verbose, |
borlanic | 0:02dd72d1d465 | 36 | build_profile=build_profile, build_dir=build_dir) |
borlanic | 0:02dd72d1d465 | 37 | |
borlanic | 0:02dd72d1d465 | 38 | tool_path=TOOLCHAIN_PATHS['GCC_ARM'] |
borlanic | 0:02dd72d1d465 | 39 | # Add flags for current size setting |
borlanic | 0:02dd72d1d465 | 40 | default_lib = "std" |
borlanic | 0:02dd72d1d465 | 41 | if hasattr(target, "default_lib"): |
borlanic | 0:02dd72d1d465 | 42 | default_lib = target.default_lib |
borlanic | 0:02dd72d1d465 | 43 | elif hasattr(target, "default_build"): # Legacy |
borlanic | 0:02dd72d1d465 | 44 | default_lib = target.default_build |
borlanic | 0:02dd72d1d465 | 45 | |
borlanic | 0:02dd72d1d465 | 46 | if default_lib == "small": |
borlanic | 0:02dd72d1d465 | 47 | self.flags["common"].append("-DMBED_RTOS_SINGLE_THREAD") |
borlanic | 0:02dd72d1d465 | 48 | self.flags["ld"].append("--specs=nano.specs") |
borlanic | 0:02dd72d1d465 | 49 | |
borlanic | 0:02dd72d1d465 | 50 | if target.core == "Cortex-M0+": |
borlanic | 0:02dd72d1d465 | 51 | self.cpu = ["-mcpu=cortex-m0plus"] |
borlanic | 0:02dd72d1d465 | 52 | elif target.core.startswith("Cortex-M4"): |
borlanic | 0:02dd72d1d465 | 53 | self.cpu = ["-mcpu=cortex-m4"] |
borlanic | 0:02dd72d1d465 | 54 | elif target.core.startswith("Cortex-M7"): |
borlanic | 0:02dd72d1d465 | 55 | self.cpu = ["-mcpu=cortex-m7"] |
borlanic | 0:02dd72d1d465 | 56 | elif target.core.startswith("Cortex-M23"): |
borlanic | 0:02dd72d1d465 | 57 | self.cpu = ["-mcpu=cortex-m23"] |
borlanic | 0:02dd72d1d465 | 58 | elif target.core.startswith("Cortex-M33F"): |
borlanic | 0:02dd72d1d465 | 59 | self.cpu = ["-mcpu=cortex-m33"] |
borlanic | 0:02dd72d1d465 | 60 | elif target.core.startswith("Cortex-M33"): |
borlanic | 0:02dd72d1d465 | 61 | self.cpu = ["-march=armv8-m.main"] |
borlanic | 0:02dd72d1d465 | 62 | else: |
borlanic | 0:02dd72d1d465 | 63 | self.cpu = ["-mcpu={}".format(target.core.lower())] |
borlanic | 0:02dd72d1d465 | 64 | |
borlanic | 0:02dd72d1d465 | 65 | if target.core.startswith("Cortex-M"): |
borlanic | 0:02dd72d1d465 | 66 | self.cpu.append("-mthumb") |
borlanic | 0:02dd72d1d465 | 67 | |
borlanic | 0:02dd72d1d465 | 68 | # FPU handling, M7 possibly to have double FPU |
borlanic | 0:02dd72d1d465 | 69 | if target.core == "Cortex-M4F": |
borlanic | 0:02dd72d1d465 | 70 | self.cpu.append("-mfpu=fpv4-sp-d16") |
borlanic | 0:02dd72d1d465 | 71 | self.cpu.append("-mfloat-abi=softfp") |
borlanic | 0:02dd72d1d465 | 72 | elif target.core == "Cortex-M7F": |
borlanic | 0:02dd72d1d465 | 73 | self.cpu.append("-mfpu=fpv5-sp-d16") |
borlanic | 0:02dd72d1d465 | 74 | self.cpu.append("-mfloat-abi=softfp") |
borlanic | 0:02dd72d1d465 | 75 | elif target.core == "Cortex-M7FD": |
borlanic | 0:02dd72d1d465 | 76 | self.cpu.append("-mfpu=fpv5-d16") |
borlanic | 0:02dd72d1d465 | 77 | self.cpu.append("-mfloat-abi=softfp") |
borlanic | 0:02dd72d1d465 | 78 | |
borlanic | 0:02dd72d1d465 | 79 | if target.core == "Cortex-A9": |
borlanic | 0:02dd72d1d465 | 80 | self.cpu.append("-mthumb-interwork") |
borlanic | 0:02dd72d1d465 | 81 | self.cpu.append("-marm") |
borlanic | 0:02dd72d1d465 | 82 | self.cpu.append("-march=armv7-a") |
borlanic | 0:02dd72d1d465 | 83 | self.cpu.append("-mfpu=vfpv3") |
borlanic | 0:02dd72d1d465 | 84 | self.cpu.append("-mfloat-abi=hard") |
borlanic | 0:02dd72d1d465 | 85 | self.cpu.append("-mno-unaligned-access") |
borlanic | 0:02dd72d1d465 | 86 | |
borlanic | 0:02dd72d1d465 | 87 | if ((target.core.startswith("Cortex-M23") or |
borlanic | 0:02dd72d1d465 | 88 | target.core.startswith("Cortex-M33")) and |
borlanic | 0:02dd72d1d465 | 89 | not target.core.endswith("-NS")): |
borlanic | 0:02dd72d1d465 | 90 | self.cpu.append("-mcmse") |
borlanic | 0:02dd72d1d465 | 91 | elif target.core == "Cortex-M23-NS" or target.core == "Cortex-M33-NS": |
borlanic | 0:02dd72d1d465 | 92 | self.flags["ld"].append("-D__DOMAIN_NS=1") |
borlanic | 0:02dd72d1d465 | 93 | |
borlanic | 0:02dd72d1d465 | 94 | self.flags["common"] += self.cpu |
borlanic | 0:02dd72d1d465 | 95 | |
borlanic | 0:02dd72d1d465 | 96 | main_cc = join(tool_path, "arm-none-eabi-gcc") |
borlanic | 0:02dd72d1d465 | 97 | main_cppc = join(tool_path, "arm-none-eabi-g++") |
borlanic | 0:02dd72d1d465 | 98 | self.asm = [main_cc] + self.flags['asm'] + self.flags["common"] |
borlanic | 0:02dd72d1d465 | 99 | self.cc = [main_cc] |
borlanic | 0:02dd72d1d465 | 100 | self.cppc =[main_cppc] |
borlanic | 0:02dd72d1d465 | 101 | self.cc += self.flags['c'] + self.flags['common'] |
borlanic | 0:02dd72d1d465 | 102 | self.cppc += self.flags['cxx'] + self.flags['common'] |
borlanic | 0:02dd72d1d465 | 103 | |
borlanic | 0:02dd72d1d465 | 104 | self.flags['ld'] += self.cpu |
borlanic | 0:02dd72d1d465 | 105 | self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.flags['ld'] |
borlanic | 0:02dd72d1d465 | 106 | self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc", "nosys"] |
borlanic | 0:02dd72d1d465 | 107 | self.preproc = [join(tool_path, "arm-none-eabi-cpp"), "-E", "-P"] |
borlanic | 0:02dd72d1d465 | 108 | |
borlanic | 0:02dd72d1d465 | 109 | self.ar = join(tool_path, "arm-none-eabi-ar") |
borlanic | 0:02dd72d1d465 | 110 | self.elf2bin = join(tool_path, "arm-none-eabi-objcopy") |
borlanic | 0:02dd72d1d465 | 111 | |
borlanic | 0:02dd72d1d465 | 112 | def is_not_supported_error(self, output): |
borlanic | 0:02dd72d1d465 | 113 | return "error: #error [NOT_SUPPORTED]" in output |
borlanic | 0:02dd72d1d465 | 114 | |
borlanic | 0:02dd72d1d465 | 115 | def parse_output(self, output): |
borlanic | 0:02dd72d1d465 | 116 | # The warning/error notification is multiline |
borlanic | 0:02dd72d1d465 | 117 | msg = None |
borlanic | 0:02dd72d1d465 | 118 | for line in output.splitlines(): |
borlanic | 0:02dd72d1d465 | 119 | match = self.DIAGNOSTIC_PATTERN.search(line) |
borlanic | 0:02dd72d1d465 | 120 | if match is not None: |
borlanic | 0:02dd72d1d465 | 121 | if msg is not None: |
borlanic | 0:02dd72d1d465 | 122 | self.cc_info(msg) |
borlanic | 0:02dd72d1d465 | 123 | msg = None |
borlanic | 0:02dd72d1d465 | 124 | msg = { |
borlanic | 0:02dd72d1d465 | 125 | 'severity': match.group('severity').lower(), |
borlanic | 0:02dd72d1d465 | 126 | 'file': match.group('file'), |
borlanic | 0:02dd72d1d465 | 127 | 'line': match.group('line'), |
borlanic | 0:02dd72d1d465 | 128 | 'col': match.group('col'), |
borlanic | 0:02dd72d1d465 | 129 | 'message': match.group('message'), |
borlanic | 0:02dd72d1d465 | 130 | 'text': '', |
borlanic | 0:02dd72d1d465 | 131 | 'target_name': self.target.name, |
borlanic | 0:02dd72d1d465 | 132 | 'toolchain_name': self.name |
borlanic | 0:02dd72d1d465 | 133 | } |
borlanic | 0:02dd72d1d465 | 134 | |
borlanic | 0:02dd72d1d465 | 135 | if msg is not None: |
borlanic | 0:02dd72d1d465 | 136 | self.cc_info(msg) |
borlanic | 0:02dd72d1d465 | 137 | |
borlanic | 0:02dd72d1d465 | 138 | def get_dep_option(self, object): |
borlanic | 0:02dd72d1d465 | 139 | base, _ = splitext(object) |
borlanic | 0:02dd72d1d465 | 140 | dep_path = base + '.d' |
borlanic | 0:02dd72d1d465 | 141 | return ["-MD", "-MF", dep_path] |
borlanic | 0:02dd72d1d465 | 142 | |
borlanic | 0:02dd72d1d465 | 143 | def get_config_option(self, config_header): |
borlanic | 0:02dd72d1d465 | 144 | return ['-include', config_header] |
borlanic | 0:02dd72d1d465 | 145 | |
borlanic | 0:02dd72d1d465 | 146 | def get_compile_options(self, defines, includes, for_asm=False): |
borlanic | 0:02dd72d1d465 | 147 | opts = ['-D%s' % d for d in defines] |
borlanic | 0:02dd72d1d465 | 148 | if self.RESPONSE_FILES: |
borlanic | 0:02dd72d1d465 | 149 | opts += ['@%s' % self.get_inc_file(includes)] |
borlanic | 0:02dd72d1d465 | 150 | else: |
borlanic | 0:02dd72d1d465 | 151 | opts += ["-I%s" % i for i in includes] |
borlanic | 0:02dd72d1d465 | 152 | |
borlanic | 0:02dd72d1d465 | 153 | if not for_asm: |
borlanic | 0:02dd72d1d465 | 154 | config_header = self.get_config_header() |
borlanic | 0:02dd72d1d465 | 155 | if config_header is not None: |
borlanic | 0:02dd72d1d465 | 156 | opts = opts + self.get_config_option(config_header) |
borlanic | 0:02dd72d1d465 | 157 | return opts |
borlanic | 0:02dd72d1d465 | 158 | |
borlanic | 0:02dd72d1d465 | 159 | @hook_tool |
borlanic | 0:02dd72d1d465 | 160 | def assemble(self, source, object, includes): |
borlanic | 0:02dd72d1d465 | 161 | # Build assemble command |
borlanic | 0:02dd72d1d465 | 162 | cmd = self.asm + self.get_compile_options(self.get_symbols(True), includes) + ["-o", object, source] |
borlanic | 0:02dd72d1d465 | 163 | |
borlanic | 0:02dd72d1d465 | 164 | # Call cmdline hook |
borlanic | 0:02dd72d1d465 | 165 | cmd = self.hook.get_cmdline_assembler(cmd) |
borlanic | 0:02dd72d1d465 | 166 | |
borlanic | 0:02dd72d1d465 | 167 | # Return command array, don't execute |
borlanic | 0:02dd72d1d465 | 168 | return [cmd] |
borlanic | 0:02dd72d1d465 | 169 | |
borlanic | 0:02dd72d1d465 | 170 | @hook_tool |
borlanic | 0:02dd72d1d465 | 171 | def compile(self, cc, source, object, includes): |
borlanic | 0:02dd72d1d465 | 172 | # Build compile command |
borlanic | 0:02dd72d1d465 | 173 | cmd = cc + self.get_compile_options(self.get_symbols(), includes) |
borlanic | 0:02dd72d1d465 | 174 | |
borlanic | 0:02dd72d1d465 | 175 | cmd.extend(self.get_dep_option(object)) |
borlanic | 0:02dd72d1d465 | 176 | |
borlanic | 0:02dd72d1d465 | 177 | cmd.extend(["-o", object, source]) |
borlanic | 0:02dd72d1d465 | 178 | |
borlanic | 0:02dd72d1d465 | 179 | # Call cmdline hook |
borlanic | 0:02dd72d1d465 | 180 | cmd = self.hook.get_cmdline_compiler(cmd) |
borlanic | 0:02dd72d1d465 | 181 | |
borlanic | 0:02dd72d1d465 | 182 | return [cmd] |
borlanic | 0:02dd72d1d465 | 183 | |
borlanic | 0:02dd72d1d465 | 184 | def compile_c(self, source, object, includes): |
borlanic | 0:02dd72d1d465 | 185 | return self.compile(self.cc, source, object, includes) |
borlanic | 0:02dd72d1d465 | 186 | |
borlanic | 0:02dd72d1d465 | 187 | def compile_cpp(self, source, object, includes): |
borlanic | 0:02dd72d1d465 | 188 | return self.compile(self.cppc, source, object, includes) |
borlanic | 0:02dd72d1d465 | 189 | |
borlanic | 0:02dd72d1d465 | 190 | @hook_tool |
borlanic | 0:02dd72d1d465 | 191 | def link(self, output, objects, libraries, lib_dirs, mem_map): |
borlanic | 0:02dd72d1d465 | 192 | libs = [] |
borlanic | 0:02dd72d1d465 | 193 | for l in libraries: |
borlanic | 0:02dd72d1d465 | 194 | name, _ = splitext(basename(l)) |
borlanic | 0:02dd72d1d465 | 195 | libs.append("-l%s" % name[3:]) |
borlanic | 0:02dd72d1d465 | 196 | libs.extend(["-l%s" % l for l in self.sys_libs]) |
borlanic | 0:02dd72d1d465 | 197 | |
borlanic | 0:02dd72d1d465 | 198 | # Preprocess |
borlanic | 0:02dd72d1d465 | 199 | if mem_map: |
borlanic | 0:02dd72d1d465 | 200 | preproc_output = join(dirname(output), ".link_script.ld") |
borlanic | 0:02dd72d1d465 | 201 | cmd = (self.preproc + [mem_map] + self.ld[1:] + |
borlanic | 0:02dd72d1d465 | 202 | [ "-o", preproc_output]) |
borlanic | 0:02dd72d1d465 | 203 | self.cc_verbose("Preproc: %s" % ' '.join(cmd)) |
borlanic | 0:02dd72d1d465 | 204 | self.default_cmd(cmd) |
borlanic | 0:02dd72d1d465 | 205 | mem_map = preproc_output |
borlanic | 0:02dd72d1d465 | 206 | |
borlanic | 0:02dd72d1d465 | 207 | # Build linker command |
borlanic | 0:02dd72d1d465 | 208 | map_file = splitext(output)[0] + ".map" |
borlanic | 0:02dd72d1d465 | 209 | cmd = self.ld + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"] |
borlanic | 0:02dd72d1d465 | 210 | # Create Secure library |
borlanic | 0:02dd72d1d465 | 211 | if self.target.core == "Cortex-M23" or self.target.core == "Cortex-M33": |
borlanic | 0:02dd72d1d465 | 212 | secure_file = join(dirname(output), "cmse_lib.o") |
borlanic | 0:02dd72d1d465 | 213 | cmd.extend(["-Wl,--cmse-implib"]) |
borlanic | 0:02dd72d1d465 | 214 | cmd.extend(["-Wl,--out-implib=%s" % secure_file]) |
borlanic | 0:02dd72d1d465 | 215 | |
borlanic | 0:02dd72d1d465 | 216 | if mem_map: |
borlanic | 0:02dd72d1d465 | 217 | cmd.extend(['-T', mem_map]) |
borlanic | 0:02dd72d1d465 | 218 | |
borlanic | 0:02dd72d1d465 | 219 | for L in lib_dirs: |
borlanic | 0:02dd72d1d465 | 220 | cmd.extend(['-L', L]) |
borlanic | 0:02dd72d1d465 | 221 | cmd.extend(libs) |
borlanic | 0:02dd72d1d465 | 222 | |
borlanic | 0:02dd72d1d465 | 223 | # Call cmdline hook |
borlanic | 0:02dd72d1d465 | 224 | cmd = self.hook.get_cmdline_linker(cmd) |
borlanic | 0:02dd72d1d465 | 225 | |
borlanic | 0:02dd72d1d465 | 226 | if self.RESPONSE_FILES: |
borlanic | 0:02dd72d1d465 | 227 | # Split link command to linker executable + response file |
borlanic | 0:02dd72d1d465 | 228 | cmd_linker = cmd[0] |
borlanic | 0:02dd72d1d465 | 229 | link_files = self.get_link_file(cmd[1:]) |
borlanic | 0:02dd72d1d465 | 230 | cmd = [cmd_linker, "@%s" % link_files] |
borlanic | 0:02dd72d1d465 | 231 | |
borlanic | 0:02dd72d1d465 | 232 | # Exec command |
borlanic | 0:02dd72d1d465 | 233 | self.cc_verbose("Link: %s" % ' '.join(cmd)) |
borlanic | 0:02dd72d1d465 | 234 | self.default_cmd(cmd) |
borlanic | 0:02dd72d1d465 | 235 | if self.target.core == "Cortex-M23" or self.target.core == "Cortex-M33": |
borlanic | 0:02dd72d1d465 | 236 | self.info("Secure Library Object %s" %secure_file) |
borlanic | 0:02dd72d1d465 | 237 | |
borlanic | 0:02dd72d1d465 | 238 | @hook_tool |
borlanic | 0:02dd72d1d465 | 239 | def archive(self, objects, lib_path): |
borlanic | 0:02dd72d1d465 | 240 | if self.RESPONSE_FILES: |
borlanic | 0:02dd72d1d465 | 241 | param = ["@%s" % self.get_arch_file(objects)] |
borlanic | 0:02dd72d1d465 | 242 | else: |
borlanic | 0:02dd72d1d465 | 243 | param = objects |
borlanic | 0:02dd72d1d465 | 244 | |
borlanic | 0:02dd72d1d465 | 245 | # Exec command |
borlanic | 0:02dd72d1d465 | 246 | self.default_cmd([self.ar, 'rcs', lib_path] + param) |
borlanic | 0:02dd72d1d465 | 247 | |
borlanic | 0:02dd72d1d465 | 248 | @hook_tool |
borlanic | 0:02dd72d1d465 | 249 | def binary(self, resources, elf, bin): |
borlanic | 0:02dd72d1d465 | 250 | # Build binary command |
borlanic | 0:02dd72d1d465 | 251 | _, fmt = splitext(bin) |
borlanic | 0:02dd72d1d465 | 252 | bin_arg = {'.bin': 'binary', '.hex': 'ihex'}[fmt] |
borlanic | 0:02dd72d1d465 | 253 | cmd = [self.elf2bin, "-O", bin_arg, elf, bin] |
borlanic | 0:02dd72d1d465 | 254 | |
borlanic | 0:02dd72d1d465 | 255 | # Call cmdline hook |
borlanic | 0:02dd72d1d465 | 256 | cmd = self.hook.get_cmdline_binary(cmd) |
borlanic | 0:02dd72d1d465 | 257 | |
borlanic | 0:02dd72d1d465 | 258 | # Exec command |
borlanic | 0:02dd72d1d465 | 259 | self.cc_verbose("FromELF: %s" % ' '.join(cmd)) |
borlanic | 0:02dd72d1d465 | 260 | self.default_cmd(cmd) |
borlanic | 0:02dd72d1d465 | 261 | |
borlanic | 0:02dd72d1d465 | 262 | @staticmethod |
borlanic | 0:02dd72d1d465 | 263 | def name_mangle(name): |
borlanic | 0:02dd72d1d465 | 264 | return "_Z%i%sv" % (len(name), name) |
borlanic | 0:02dd72d1d465 | 265 | |
borlanic | 0:02dd72d1d465 | 266 | @staticmethod |
borlanic | 0:02dd72d1d465 | 267 | def make_ld_define(name, value): |
borlanic | 0:02dd72d1d465 | 268 | return "-D%s=0x%x" % (name, value) |
borlanic | 0:02dd72d1d465 | 269 | |
borlanic | 0:02dd72d1d465 | 270 | @staticmethod |
borlanic | 0:02dd72d1d465 | 271 | def redirect_symbol(source, sync, build_dir): |
borlanic | 0:02dd72d1d465 | 272 | return "-Wl,--defsym=%s=%s" % (source, sync) |
borlanic | 0:02dd72d1d465 | 273 | |
borlanic | 0:02dd72d1d465 | 274 | @staticmethod |
borlanic | 0:02dd72d1d465 | 275 | def check_executable(): |
borlanic | 0:02dd72d1d465 | 276 | """Returns True if the executable (arm-none-eabi-gcc) location |
borlanic | 0:02dd72d1d465 | 277 | specified by the user exists OR the executable can be found on the PATH. |
borlanic | 0:02dd72d1d465 | 278 | Returns False otherwise.""" |
borlanic | 0:02dd72d1d465 | 279 | if not TOOLCHAIN_PATHS['GCC_ARM'] or not exists(TOOLCHAIN_PATHS['GCC_ARM']): |
borlanic | 0:02dd72d1d465 | 280 | if find_executable('arm-none-eabi-gcc'): |
borlanic | 0:02dd72d1d465 | 281 | TOOLCHAIN_PATHS['GCC_ARM'] = '' |
borlanic | 0:02dd72d1d465 | 282 | return True |
borlanic | 0:02dd72d1d465 | 283 | else: |
borlanic | 0:02dd72d1d465 | 284 | return False |
borlanic | 0:02dd72d1d465 | 285 | else: |
borlanic | 0:02dd72d1d465 | 286 | exec_name = join(TOOLCHAIN_PATHS['GCC_ARM'], 'arm-none-eabi-gcc') |
borlanic | 0:02dd72d1d465 | 287 | return exists(exec_name) or exists(exec_name + '.exe') |
borlanic | 0:02dd72d1d465 | 288 | |
borlanic | 0:02dd72d1d465 | 289 | class GCC_ARM(GCC): |
borlanic | 0:02dd72d1d465 | 290 | pass |