Clone of official tools

Committer:
Anders Blomdell
Date:
Thu Feb 04 17:17:13 2021 +0100
Revision:
47:21ae3e5a7128
Parent:
43:2a7da56ebd24
Add a few normpath calls

Who changed what in which revision?

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