Clone of official tools
toolchains/gcc.py@36:96847d42f010, 2017-06-22 (annotated)
- Committer:
- The Other Jimmy
- Date:
- Thu Jun 22 11:12:28 2017 -0500
- Revision:
- 36:96847d42f010
- Parent:
- 35:da9c89f8be7d
- Child:
- 40:7d3fa6b99b2b
Tools release 5.5.1
Who changed what in which revision?
User | Revision | Line number | New 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 |
The Other Jimmy |
36:96847d42f010 | 19 | from distutils.spawn import find_executable |
screamer | 0:66f3b5499f7f | 20 | |
screamer | 20:835f6355470d | 21 | from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS |
screamer | 0:66f3b5499f7f | 22 | from tools.hooks import hook_tool |
screamer | 0:66f3b5499f7f | 23 | |
screamer | 0:66f3b5499f7f | 24 | class GCC(mbedToolchain): |
screamer | 0:66f3b5499f7f | 25 | LINKER_EXT = '.ld' |
screamer | 0:66f3b5499f7f | 26 | LIBRARY_EXT = '.a' |
screamer | 0:66f3b5499f7f | 27 | |
screamer | 0:66f3b5499f7f | 28 | STD_LIB_NAME = "lib%s.a" |
The Other Jimmy |
35:da9c89f8be7d | 29 | DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(\d+:)? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)') |
screamer | 21:4fdf0dd04f6f | 30 | INDEX_PATTERN = re.compile('(?P<col>\s*)\^') |
screamer | 0:66f3b5499f7f | 31 | |
The Other Jimmy |
31:8ea194f6145b | 32 | def __init__(self, target, notify=None, macros=None, |
The Other Jimmy |
36:96847d42f010 | 33 | silent=False, extra_verbose=False, build_profile=None, |
The Other Jimmy |
36:96847d42f010 | 34 | build_dir=None): |
The Other Jimmy |
31:8ea194f6145b | 35 | mbedToolchain.__init__(self, target, notify, macros, silent, |
The Other Jimmy |
31:8ea194f6145b | 36 | extra_verbose=extra_verbose, |
The Other Jimmy |
36:96847d42f010 | 37 | build_profile=build_profile, build_dir=build_dir) |
screamer | 13:ab47a20b66f0 | 38 | |
The Other Jimmy |
36:96847d42f010 | 39 | tool_path=TOOLCHAIN_PATHS['GCC_ARM'] |
The Other Jimmy |
31:8ea194f6145b | 40 | # Add flags for current size setting |
The Other Jimmy |
31:8ea194f6145b | 41 | default_lib = "std" |
The Other Jimmy |
31:8ea194f6145b | 42 | if hasattr(target, "default_lib"): |
The Other Jimmy |
31:8ea194f6145b | 43 | default_lib = target.default_lib |
The Other Jimmy |
31:8ea194f6145b | 44 | elif hasattr(target, "default_build"): # Legacy |
The Other Jimmy |
31:8ea194f6145b | 45 | default_lib = target.default_build |
The Other Jimmy |
31:8ea194f6145b | 46 | |
The Other Jimmy |
31:8ea194f6145b | 47 | if default_lib == "small": |
The Other Jimmy |
31:8ea194f6145b | 48 | self.flags["common"].append("-DMBED_RTOS_SINGLE_THREAD") |
The Other Jimmy |
31:8ea194f6145b | 49 | self.flags["ld"].append("--specs=nano.specs") |
screamer | 0:66f3b5499f7f | 50 | |
screamer | 0:66f3b5499f7f | 51 | if target.core == "Cortex-M0+": |
screamer | 0:66f3b5499f7f | 52 | cpu = "cortex-m0plus" |
screamer | 0:66f3b5499f7f | 53 | elif target.core == "Cortex-M4F": |
screamer | 0:66f3b5499f7f | 54 | cpu = "cortex-m4" |
screamer | 0:66f3b5499f7f | 55 | elif target.core == "Cortex-M7F": |
screamer | 0:66f3b5499f7f | 56 | cpu = "cortex-m7" |
screamer | 13:ab47a20b66f0 | 57 | elif target.core == "Cortex-M7FD": |
screamer | 13:ab47a20b66f0 | 58 | cpu = "cortex-m7" |
screamer | 0:66f3b5499f7f | 59 | else: |
screamer | 0:66f3b5499f7f | 60 | cpu = target.core.lower() |
screamer | 0:66f3b5499f7f | 61 | |
screamer | 0:66f3b5499f7f | 62 | self.cpu = ["-mcpu=%s" % cpu] |
The Other Jimmy |
36:96847d42f010 | 63 | if target.core.startswith("Cortex-M"): |
screamer | 0:66f3b5499f7f | 64 | self.cpu.append("-mthumb") |
screamer | 0:66f3b5499f7f | 65 | |
screamer | 13:ab47a20b66f0 | 66 | # FPU handling, M7 possibly to have double FPU |
screamer | 0:66f3b5499f7f | 67 | if target.core == "Cortex-M4F": |
screamer | 0:66f3b5499f7f | 68 | self.cpu.append("-mfpu=fpv4-sp-d16") |
screamer | 0:66f3b5499f7f | 69 | self.cpu.append("-mfloat-abi=softfp") |
screamer | 0:66f3b5499f7f | 70 | elif target.core == "Cortex-M7F": |
screamer | 13:ab47a20b66f0 | 71 | self.cpu.append("-mfpu=fpv5-sp-d16") |
screamer | 13:ab47a20b66f0 | 72 | self.cpu.append("-mfloat-abi=softfp") |
screamer | 13:ab47a20b66f0 | 73 | elif target.core == "Cortex-M7FD": |
screamer | 0:66f3b5499f7f | 74 | self.cpu.append("-mfpu=fpv5-d16") |
screamer | 0:66f3b5499f7f | 75 | self.cpu.append("-mfloat-abi=softfp") |
screamer | 0:66f3b5499f7f | 76 | |
screamer | 0:66f3b5499f7f | 77 | if target.core == "Cortex-A9": |
screamer | 0:66f3b5499f7f | 78 | self.cpu.append("-mthumb-interwork") |
screamer | 0:66f3b5499f7f | 79 | self.cpu.append("-marm") |
screamer | 0:66f3b5499f7f | 80 | self.cpu.append("-march=armv7-a") |
screamer | 0:66f3b5499f7f | 81 | self.cpu.append("-mfpu=vfpv3") |
screamer | 0:66f3b5499f7f | 82 | self.cpu.append("-mfloat-abi=hard") |
screamer | 0:66f3b5499f7f | 83 | self.cpu.append("-mno-unaligned-access") |
screamer | 0:66f3b5499f7f | 84 | |
screamer | 13:ab47a20b66f0 | 85 | self.flags["common"] += self.cpu |
screamer | 0:66f3b5499f7f | 86 | |
screamer | 13:ab47a20b66f0 | 87 | main_cc = join(tool_path, "arm-none-eabi-gcc") |
screamer | 13:ab47a20b66f0 | 88 | main_cppc = join(tool_path, "arm-none-eabi-g++") |
screamer | 13:ab47a20b66f0 | 89 | self.asm = [main_cc] + self.flags['asm'] + self.flags["common"] |
screamer | 21:4fdf0dd04f6f | 90 | self.cc = [main_cc] |
screamer | 21:4fdf0dd04f6f | 91 | self.cppc =[main_cppc] |
screamer | 13:ab47a20b66f0 | 92 | self.cc += self.flags['c'] + self.flags['common'] |
screamer | 13:ab47a20b66f0 | 93 | self.cppc += self.flags['cxx'] + self.flags['common'] |
screamer | 0:66f3b5499f7f | 94 | |
screamer | 13:ab47a20b66f0 | 95 | self.flags['ld'] += self.cpu |
screamer | 13:ab47a20b66f0 | 96 | self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.flags['ld'] |
The Other Jimmy |
36:96847d42f010 | 97 | self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc", "nosys"] |
The Other Jimmy |
36:96847d42f010 | 98 | self.preproc = [join(tool_path, "arm-none-eabi-cpp"), "-E", "-P"] |
screamer | 0:66f3b5499f7f | 99 | |
screamer | 0:66f3b5499f7f | 100 | self.ar = join(tool_path, "arm-none-eabi-ar") |
screamer | 0:66f3b5499f7f | 101 | self.elf2bin = join(tool_path, "arm-none-eabi-objcopy") |
screamer | 0:66f3b5499f7f | 102 | |
screamer | 0:66f3b5499f7f | 103 | def parse_dependencies(self, dep_path): |
screamer | 0:66f3b5499f7f | 104 | dependencies = [] |
screamer | 0:66f3b5499f7f | 105 | buff = open(dep_path).readlines() |
screamer | 0:66f3b5499f7f | 106 | buff[0] = re.sub('^(.*?)\: ', '', buff[0]) |
screamer | 0:66f3b5499f7f | 107 | for line in buff: |
screamer | 0:66f3b5499f7f | 108 | file = line.replace('\\\n', '').strip() |
screamer | 0:66f3b5499f7f | 109 | if file: |
screamer | 0:66f3b5499f7f | 110 | # GCC might list more than one dependency on a single line, in this case |
screamer | 0:66f3b5499f7f | 111 | # the dependencies are separated by a space. However, a space might also |
screamer | 0:66f3b5499f7f | 112 | # indicate an actual space character in a dependency path, but in this case |
screamer | 0:66f3b5499f7f | 113 | # the space character is prefixed by a backslash. |
screamer | 0:66f3b5499f7f | 114 | # Temporary replace all '\ ' with a special char that is not used (\a in this |
screamer | 0:66f3b5499f7f | 115 | # case) to keep them from being interpreted by 'split' (they will be converted |
screamer | 0:66f3b5499f7f | 116 | # back later to a space char) |
screamer | 0:66f3b5499f7f | 117 | file = file.replace('\\ ', '\a') |
screamer | 0:66f3b5499f7f | 118 | if file.find(" ") == -1: |
screamer | 21:4fdf0dd04f6f | 119 | dependencies.append((self.CHROOT if self.CHROOT else '') + file.replace('\a', ' ')) |
screamer | 0:66f3b5499f7f | 120 | else: |
screamer | 21:4fdf0dd04f6f | 121 | dependencies = dependencies + [(self.CHROOT if self.CHROOT else '') + f.replace('\a', ' ') for f in file.split(" ")] |
screamer | 0:66f3b5499f7f | 122 | return dependencies |
screamer | 0:66f3b5499f7f | 123 | |
screamer | 0:66f3b5499f7f | 124 | def is_not_supported_error(self, output): |
screamer | 0:66f3b5499f7f | 125 | return "error: #error [NOT_SUPPORTED]" in output |
screamer | 0:66f3b5499f7f | 126 | |
screamer | 0:66f3b5499f7f | 127 | def parse_output(self, output): |
screamer | 0:66f3b5499f7f | 128 | # The warning/error notification is multiline |
screamer | 21:4fdf0dd04f6f | 129 | msg = None |
screamer | 0:66f3b5499f7f | 130 | for line in output.splitlines(): |
The Other Jimmy |
36:96847d42f010 | 131 | match = self.DIAGNOSTIC_PATTERN.search(line) |
screamer | 13:ab47a20b66f0 | 132 | if match is not None: |
screamer | 21:4fdf0dd04f6f | 133 | if msg is not None: |
screamer | 21:4fdf0dd04f6f | 134 | self.cc_info(msg) |
The Other Jimmy |
31:8ea194f6145b | 135 | msg = None |
screamer | 21:4fdf0dd04f6f | 136 | msg = { |
screamer | 21:4fdf0dd04f6f | 137 | 'severity': match.group('severity').lower(), |
screamer | 21:4fdf0dd04f6f | 138 | 'file': match.group('file'), |
screamer | 21:4fdf0dd04f6f | 139 | 'line': match.group('line'), |
screamer | 21:4fdf0dd04f6f | 140 | 'col': 0, |
screamer | 21:4fdf0dd04f6f | 141 | 'message': match.group('message'), |
screamer | 21:4fdf0dd04f6f | 142 | 'text': '', |
screamer | 21:4fdf0dd04f6f | 143 | 'target_name': self.target.name, |
screamer | 21:4fdf0dd04f6f | 144 | 'toolchain_name': self.name |
screamer | 21:4fdf0dd04f6f | 145 | } |
screamer | 21:4fdf0dd04f6f | 146 | elif msg is not None: |
screamer | 24:25bff2709c20 | 147 | # Determine the warning/error column by calculating the ^ position |
The Other Jimmy |
36:96847d42f010 | 148 | match = self.INDEX_PATTERN.match(line) |
screamer | 21:4fdf0dd04f6f | 149 | if match is not None: |
screamer | 21:4fdf0dd04f6f | 150 | msg['col'] = len(match.group('col')) |
screamer | 21:4fdf0dd04f6f | 151 | self.cc_info(msg) |
screamer | 21:4fdf0dd04f6f | 152 | msg = None |
screamer | 21:4fdf0dd04f6f | 153 | else: |
screamer | 21:4fdf0dd04f6f | 154 | msg['text'] += line+"\n" |
screamer | 0:66f3b5499f7f | 155 | |
The Other Jimmy |
31:8ea194f6145b | 156 | if msg is not None: |
The Other Jimmy |
31:8ea194f6145b | 157 | self.cc_info(msg) |
The Other Jimmy |
31:8ea194f6145b | 158 | |
screamer | 0:66f3b5499f7f | 159 | def get_dep_option(self, object): |
screamer | 0:66f3b5499f7f | 160 | base, _ = splitext(object) |
screamer | 0:66f3b5499f7f | 161 | dep_path = base + '.d' |
screamer | 0:66f3b5499f7f | 162 | return ["-MD", "-MF", dep_path] |
screamer | 0:66f3b5499f7f | 163 | |
screamer | 13:ab47a20b66f0 | 164 | def get_config_option(self, config_header): |
screamer | 13:ab47a20b66f0 | 165 | return ['-include', config_header] |
screamer | 13:ab47a20b66f0 | 166 | |
screamer | 29:1210849dba19 | 167 | def get_compile_options(self, defines, includes, for_asm=False): |
screamer | 21:4fdf0dd04f6f | 168 | opts = ['-D%s' % d for d in defines] |
screamer | 21:4fdf0dd04f6f | 169 | if self.RESPONSE_FILES: |
screamer | 21:4fdf0dd04f6f | 170 | opts += ['@%s' % self.get_inc_file(includes)] |
screamer | 21:4fdf0dd04f6f | 171 | else: |
screamer | 21:4fdf0dd04f6f | 172 | opts += ["-I%s" % i for i in includes] |
screamer | 21:4fdf0dd04f6f | 173 | |
screamer | 29:1210849dba19 | 174 | if not for_asm: |
screamer | 29:1210849dba19 | 175 | config_header = self.get_config_header() |
screamer | 29:1210849dba19 | 176 | if config_header is not None: |
screamer | 29:1210849dba19 | 177 | opts = opts + self.get_config_option(config_header) |
screamer | 13:ab47a20b66f0 | 178 | return opts |
screamer | 0:66f3b5499f7f | 179 | |
screamer | 0:66f3b5499f7f | 180 | @hook_tool |
screamer | 0:66f3b5499f7f | 181 | def assemble(self, source, object, includes): |
screamer | 0:66f3b5499f7f | 182 | # Build assemble command |
screamer | 29:1210849dba19 | 183 | cmd = self.asm + self.get_compile_options(self.get_symbols(True), includes) + ["-o", object, source] |
screamer | 0:66f3b5499f7f | 184 | |
screamer | 0:66f3b5499f7f | 185 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 186 | cmd = self.hook.get_cmdline_assembler(cmd) |
screamer | 0:66f3b5499f7f | 187 | |
screamer | 0:66f3b5499f7f | 188 | # Return command array, don't execute |
screamer | 0:66f3b5499f7f | 189 | return [cmd] |
screamer | 0:66f3b5499f7f | 190 | |
screamer | 0:66f3b5499f7f | 191 | @hook_tool |
screamer | 0:66f3b5499f7f | 192 | def compile(self, cc, source, object, includes): |
screamer | 0:66f3b5499f7f | 193 | # Build compile command |
screamer | 0:66f3b5499f7f | 194 | cmd = cc + self.get_compile_options(self.get_symbols(), includes) |
screamer | 0:66f3b5499f7f | 195 | |
screamer | 0:66f3b5499f7f | 196 | cmd.extend(self.get_dep_option(object)) |
screamer | 0:66f3b5499f7f | 197 | |
screamer | 0:66f3b5499f7f | 198 | cmd.extend(["-o", object, source]) |
screamer | 13:ab47a20b66f0 | 199 | |
screamer | 0:66f3b5499f7f | 200 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 201 | cmd = self.hook.get_cmdline_compiler(cmd) |
screamer | 0:66f3b5499f7f | 202 | |
screamer | 0:66f3b5499f7f | 203 | return [cmd] |
screamer | 0:66f3b5499f7f | 204 | |
screamer | 0:66f3b5499f7f | 205 | def compile_c(self, source, object, includes): |
screamer | 0:66f3b5499f7f | 206 | return self.compile(self.cc, source, object, includes) |
screamer | 0:66f3b5499f7f | 207 | |
screamer | 0:66f3b5499f7f | 208 | def compile_cpp(self, source, object, includes): |
screamer | 0:66f3b5499f7f | 209 | return self.compile(self.cppc, source, object, includes) |
screamer | 0:66f3b5499f7f | 210 | |
screamer | 0:66f3b5499f7f | 211 | @hook_tool |
screamer | 0:66f3b5499f7f | 212 | def link(self, output, objects, libraries, lib_dirs, mem_map): |
screamer | 0:66f3b5499f7f | 213 | libs = [] |
screamer | 0:66f3b5499f7f | 214 | for l in libraries: |
screamer | 0:66f3b5499f7f | 215 | name, _ = splitext(basename(l)) |
screamer | 0:66f3b5499f7f | 216 | libs.append("-l%s" % name[3:]) |
screamer | 0:66f3b5499f7f | 217 | libs.extend(["-l%s" % l for l in self.sys_libs]) |
screamer | 0:66f3b5499f7f | 218 | |
The Other Jimmy |
36:96847d42f010 | 219 | # Preprocess |
The Other Jimmy |
36:96847d42f010 | 220 | if mem_map: |
The Other Jimmy |
36:96847d42f010 | 221 | preproc_output = join(dirname(output), ".link_script.ld") |
The Other Jimmy |
36:96847d42f010 | 222 | cmd = (self.preproc + [mem_map] + self.ld[1:] + |
The Other Jimmy |
36:96847d42f010 | 223 | [ "-o", preproc_output]) |
The Other Jimmy |
36:96847d42f010 | 224 | self.cc_verbose("Preproc: %s" % ' '.join(cmd)) |
The Other Jimmy |
36:96847d42f010 | 225 | self.default_cmd(cmd) |
The Other Jimmy |
36:96847d42f010 | 226 | mem_map = preproc_output |
The Other Jimmy |
36:96847d42f010 | 227 | |
screamer | 0:66f3b5499f7f | 228 | # Build linker command |
screamer | 7:5af61d55adbe | 229 | map_file = splitext(output)[0] + ".map" |
screamer | 13:ab47a20b66f0 | 230 | cmd = self.ld + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"] |
screamer | 0:66f3b5499f7f | 231 | if mem_map: |
screamer | 0:66f3b5499f7f | 232 | cmd.extend(['-T', mem_map]) |
screamer | 13:ab47a20b66f0 | 233 | |
screamer | 0:66f3b5499f7f | 234 | for L in lib_dirs: |
screamer | 0:66f3b5499f7f | 235 | cmd.extend(['-L', L]) |
screamer | 0:66f3b5499f7f | 236 | cmd.extend(libs) |
screamer | 0:66f3b5499f7f | 237 | |
screamer | 0:66f3b5499f7f | 238 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 239 | cmd = self.hook.get_cmdline_linker(cmd) |
screamer | 0:66f3b5499f7f | 240 | |
screamer | 21:4fdf0dd04f6f | 241 | if self.RESPONSE_FILES: |
screamer | 21:4fdf0dd04f6f | 242 | # Split link command to linker executable + response file |
screamer | 21:4fdf0dd04f6f | 243 | cmd_linker = cmd[0] |
screamer | 21:4fdf0dd04f6f | 244 | link_files = self.get_link_file(cmd[1:]) |
screamer | 21:4fdf0dd04f6f | 245 | cmd = [cmd_linker, "@%s" % link_files] |
screamer | 0:66f3b5499f7f | 246 | |
screamer | 0:66f3b5499f7f | 247 | # Exec command |
screamer | 21:4fdf0dd04f6f | 248 | self.cc_verbose("Link: %s" % ' '.join(cmd)) |
screamer | 21:4fdf0dd04f6f | 249 | self.default_cmd(cmd) |
screamer | 0:66f3b5499f7f | 250 | |
screamer | 0:66f3b5499f7f | 251 | @hook_tool |
screamer | 0:66f3b5499f7f | 252 | def archive(self, objects, lib_path): |
screamer | 21:4fdf0dd04f6f | 253 | if self.RESPONSE_FILES: |
screamer | 22:9e85236d8716 | 254 | param = ["@%s" % self.get_arch_file(objects)] |
screamer | 21:4fdf0dd04f6f | 255 | else: |
screamer | 21:4fdf0dd04f6f | 256 | param = objects |
screamer | 0:66f3b5499f7f | 257 | |
screamer | 0:66f3b5499f7f | 258 | # Exec command |
screamer | 21:4fdf0dd04f6f | 259 | self.default_cmd([self.ar, 'rcs', lib_path] + param) |
screamer | 0:66f3b5499f7f | 260 | |
screamer | 0:66f3b5499f7f | 261 | @hook_tool |
screamer | 0:66f3b5499f7f | 262 | def binary(self, resources, elf, bin): |
screamer | 0:66f3b5499f7f | 263 | # Build binary command |
The Other Jimmy |
36:96847d42f010 | 264 | _, fmt = splitext(bin) |
The Other Jimmy |
36:96847d42f010 | 265 | bin_arg = {'.bin': 'binary', '.hex': 'ihex'}[fmt] |
The Other Jimmy |
36:96847d42f010 | 266 | cmd = [self.elf2bin, "-O", bin_arg, elf, bin] |
screamer | 0:66f3b5499f7f | 267 | |
screamer | 0:66f3b5499f7f | 268 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 269 | cmd = self.hook.get_cmdline_binary(cmd) |
screamer | 0:66f3b5499f7f | 270 | |
screamer | 0:66f3b5499f7f | 271 | # Exec command |
screamer | 21:4fdf0dd04f6f | 272 | self.cc_verbose("FromELF: %s" % ' '.join(cmd)) |
screamer | 0:66f3b5499f7f | 273 | self.default_cmd(cmd) |
screamer | 0:66f3b5499f7f | 274 | |
The Other Jimmy |
36:96847d42f010 | 275 | @staticmethod |
The Other Jimmy |
36:96847d42f010 | 276 | def name_mangle(name): |
The Other Jimmy |
36:96847d42f010 | 277 | return "_Z%i%sv" % (len(name), name) |
screamer | 0:66f3b5499f7f | 278 | |
The Other Jimmy |
36:96847d42f010 | 279 | @staticmethod |
The Other Jimmy |
36:96847d42f010 | 280 | def make_ld_define(name, value): |
The Other Jimmy |
36:96847d42f010 | 281 | return "-D%s=0x%x" % (name, value) |
The Other Jimmy |
36:96847d42f010 | 282 | |
The Other Jimmy |
36:96847d42f010 | 283 | @staticmethod |
The Other Jimmy |
36:96847d42f010 | 284 | def redirect_symbol(source, sync, build_dir): |
The Other Jimmy |
36:96847d42f010 | 285 | return "-Wl,--defsym=%s=%s" % (source, sync) |
The Other Jimmy |
36:96847d42f010 | 286 | |
The Other Jimmy |
31:8ea194f6145b | 287 | @staticmethod |
The Other Jimmy |
31:8ea194f6145b | 288 | def check_executable(): |
The Other Jimmy |
31:8ea194f6145b | 289 | """Returns True if the executable (arm-none-eabi-gcc) location |
The Other Jimmy |
31:8ea194f6145b | 290 | specified by the user exists OR the executable can be found on the PATH. |
The Other Jimmy |
31:8ea194f6145b | 291 | Returns False otherwise.""" |
The Other Jimmy |
36:96847d42f010 | 292 | if not TOOLCHAIN_PATHS['GCC_ARM'] or not exists(TOOLCHAIN_PATHS['GCC_ARM']): |
The Other Jimmy |
36:96847d42f010 | 293 | if find_executable('arm-none-eabi-gcc'): |
The Other Jimmy |
36:96847d42f010 | 294 | TOOLCHAIN_PATHS['GCC_ARM'] = '' |
The Other Jimmy |
36:96847d42f010 | 295 | return True |
The Other Jimmy |
36:96847d42f010 | 296 | else: |
The Other Jimmy |
36:96847d42f010 | 297 | return False |
The Other Jimmy |
36:96847d42f010 | 298 | else: |
The Other Jimmy |
36:96847d42f010 | 299 | exec_name = join(TOOLCHAIN_PATHS['GCC_ARM'], 'arm-none-eabi-gcc') |
The Other Jimmy |
36:96847d42f010 | 300 | return exists(exec_name) or exists(exec_name + '.exe') |
screamer | 0:66f3b5499f7f | 301 | |
The Other Jimmy |
36:96847d42f010 | 302 | class GCC_ARM(GCC): |
The Other Jimmy |
36:96847d42f010 | 303 | pass |