Development mbed library for MAX32630FTHR
Dependents: blinky_max32630fthr
tools/toolchains/gcc.py@3:1198227e6421, 2016-12-16 (annotated)
- Committer:
- switches
- Date:
- Fri Dec 16 16:27:57 2016 +0000
- Revision:
- 3:1198227e6421
- Parent:
- 0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:5c4d7b2438d3 | 1 | """ |
switches | 0:5c4d7b2438d3 | 2 | mbed SDK |
switches | 0:5c4d7b2438d3 | 3 | Copyright (c) 2011-2013 ARM Limited |
switches | 0:5c4d7b2438d3 | 4 | |
switches | 0:5c4d7b2438d3 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
switches | 0:5c4d7b2438d3 | 6 | you may not use this file except in compliance with the License. |
switches | 0:5c4d7b2438d3 | 7 | You may obtain a copy of the License at |
switches | 0:5c4d7b2438d3 | 8 | |
switches | 0:5c4d7b2438d3 | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
switches | 0:5c4d7b2438d3 | 10 | |
switches | 0:5c4d7b2438d3 | 11 | Unless required by applicable law or agreed to in writing, software |
switches | 0:5c4d7b2438d3 | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
switches | 0:5c4d7b2438d3 | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
switches | 0:5c4d7b2438d3 | 14 | See the License for the specific language governing permissions and |
switches | 0:5c4d7b2438d3 | 15 | limitations under the License. |
switches | 0:5c4d7b2438d3 | 16 | """ |
switches | 0:5c4d7b2438d3 | 17 | import re |
switches | 0:5c4d7b2438d3 | 18 | from os.path import join, basename, splitext |
switches | 0:5c4d7b2438d3 | 19 | |
switches | 0:5c4d7b2438d3 | 20 | from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS |
switches | 0:5c4d7b2438d3 | 21 | from tools.hooks import hook_tool |
switches | 0:5c4d7b2438d3 | 22 | |
switches | 0:5c4d7b2438d3 | 23 | class GCC(mbedToolchain): |
switches | 0:5c4d7b2438d3 | 24 | LINKER_EXT = '.ld' |
switches | 0:5c4d7b2438d3 | 25 | LIBRARY_EXT = '.a' |
switches | 0:5c4d7b2438d3 | 26 | |
switches | 0:5c4d7b2438d3 | 27 | STD_LIB_NAME = "lib%s.a" |
switches | 0:5c4d7b2438d3 | 28 | DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)') |
switches | 0:5c4d7b2438d3 | 29 | INDEX_PATTERN = re.compile('(?P<col>\s*)\^') |
switches | 0:5c4d7b2438d3 | 30 | |
switches | 0:5c4d7b2438d3 | 31 | def __init__(self, target, notify=None, macros=None, |
switches | 0:5c4d7b2438d3 | 32 | silent=False, tool_path="", extra_verbose=False, |
switches | 0:5c4d7b2438d3 | 33 | build_profile=None): |
switches | 0:5c4d7b2438d3 | 34 | mbedToolchain.__init__(self, target, notify, macros, silent, |
switches | 0:5c4d7b2438d3 | 35 | extra_verbose=extra_verbose, |
switches | 0:5c4d7b2438d3 | 36 | build_profile=build_profile) |
switches | 0:5c4d7b2438d3 | 37 | |
switches | 0:5c4d7b2438d3 | 38 | # Add flags for current size setting |
switches | 0:5c4d7b2438d3 | 39 | default_lib = "std" |
switches | 0:5c4d7b2438d3 | 40 | if hasattr(target, "default_lib"): |
switches | 0:5c4d7b2438d3 | 41 | default_lib = target.default_lib |
switches | 0:5c4d7b2438d3 | 42 | elif hasattr(target, "default_build"): # Legacy |
switches | 0:5c4d7b2438d3 | 43 | default_lib = target.default_build |
switches | 0:5c4d7b2438d3 | 44 | |
switches | 0:5c4d7b2438d3 | 45 | if default_lib == "small": |
switches | 0:5c4d7b2438d3 | 46 | self.flags["common"].append("-DMBED_RTOS_SINGLE_THREAD") |
switches | 0:5c4d7b2438d3 | 47 | self.flags["ld"].append("--specs=nano.specs") |
switches | 0:5c4d7b2438d3 | 48 | |
switches | 0:5c4d7b2438d3 | 49 | if target.core == "Cortex-M0+": |
switches | 0:5c4d7b2438d3 | 50 | cpu = "cortex-m0plus" |
switches | 0:5c4d7b2438d3 | 51 | elif target.core == "Cortex-M4F": |
switches | 0:5c4d7b2438d3 | 52 | cpu = "cortex-m4" |
switches | 0:5c4d7b2438d3 | 53 | elif target.core == "Cortex-M7F": |
switches | 0:5c4d7b2438d3 | 54 | cpu = "cortex-m7" |
switches | 0:5c4d7b2438d3 | 55 | elif target.core == "Cortex-M7FD": |
switches | 0:5c4d7b2438d3 | 56 | cpu = "cortex-m7" |
switches | 0:5c4d7b2438d3 | 57 | else: |
switches | 0:5c4d7b2438d3 | 58 | cpu = target.core.lower() |
switches | 0:5c4d7b2438d3 | 59 | |
switches | 0:5c4d7b2438d3 | 60 | self.cpu = ["-mcpu=%s" % cpu] |
switches | 0:5c4d7b2438d3 | 61 | if target.core.startswith("Cortex"): |
switches | 0:5c4d7b2438d3 | 62 | self.cpu.append("-mthumb") |
switches | 0:5c4d7b2438d3 | 63 | |
switches | 0:5c4d7b2438d3 | 64 | # FPU handling, M7 possibly to have double FPU |
switches | 0:5c4d7b2438d3 | 65 | if target.core == "Cortex-M4F": |
switches | 0:5c4d7b2438d3 | 66 | self.cpu.append("-mfpu=fpv4-sp-d16") |
switches | 0:5c4d7b2438d3 | 67 | self.cpu.append("-mfloat-abi=softfp") |
switches | 0:5c4d7b2438d3 | 68 | elif target.core == "Cortex-M7F": |
switches | 0:5c4d7b2438d3 | 69 | self.cpu.append("-mfpu=fpv5-sp-d16") |
switches | 0:5c4d7b2438d3 | 70 | self.cpu.append("-mfloat-abi=softfp") |
switches | 0:5c4d7b2438d3 | 71 | elif target.core == "Cortex-M7FD": |
switches | 0:5c4d7b2438d3 | 72 | self.cpu.append("-mfpu=fpv5-d16") |
switches | 0:5c4d7b2438d3 | 73 | self.cpu.append("-mfloat-abi=softfp") |
switches | 0:5c4d7b2438d3 | 74 | |
switches | 0:5c4d7b2438d3 | 75 | if target.core == "Cortex-A9": |
switches | 0:5c4d7b2438d3 | 76 | self.cpu.append("-mthumb-interwork") |
switches | 0:5c4d7b2438d3 | 77 | self.cpu.append("-marm") |
switches | 0:5c4d7b2438d3 | 78 | self.cpu.append("-march=armv7-a") |
switches | 0:5c4d7b2438d3 | 79 | self.cpu.append("-mfpu=vfpv3") |
switches | 0:5c4d7b2438d3 | 80 | self.cpu.append("-mfloat-abi=hard") |
switches | 0:5c4d7b2438d3 | 81 | self.cpu.append("-mno-unaligned-access") |
switches | 0:5c4d7b2438d3 | 82 | |
switches | 0:5c4d7b2438d3 | 83 | self.flags["common"] += self.cpu |
switches | 0:5c4d7b2438d3 | 84 | |
switches | 0:5c4d7b2438d3 | 85 | main_cc = join(tool_path, "arm-none-eabi-gcc") |
switches | 0:5c4d7b2438d3 | 86 | main_cppc = join(tool_path, "arm-none-eabi-g++") |
switches | 0:5c4d7b2438d3 | 87 | self.asm = [main_cc] + self.flags['asm'] + self.flags["common"] |
switches | 0:5c4d7b2438d3 | 88 | self.cc = [main_cc] |
switches | 0:5c4d7b2438d3 | 89 | self.cppc =[main_cppc] |
switches | 0:5c4d7b2438d3 | 90 | self.cc += self.flags['c'] + self.flags['common'] |
switches | 0:5c4d7b2438d3 | 91 | self.cppc += self.flags['cxx'] + self.flags['common'] |
switches | 0:5c4d7b2438d3 | 92 | |
switches | 0:5c4d7b2438d3 | 93 | self.flags['ld'] += self.cpu |
switches | 0:5c4d7b2438d3 | 94 | self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.flags['ld'] |
switches | 0:5c4d7b2438d3 | 95 | self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"] |
switches | 0:5c4d7b2438d3 | 96 | |
switches | 0:5c4d7b2438d3 | 97 | self.ar = join(tool_path, "arm-none-eabi-ar") |
switches | 0:5c4d7b2438d3 | 98 | self.elf2bin = join(tool_path, "arm-none-eabi-objcopy") |
switches | 0:5c4d7b2438d3 | 99 | |
switches | 0:5c4d7b2438d3 | 100 | def parse_dependencies(self, dep_path): |
switches | 0:5c4d7b2438d3 | 101 | dependencies = [] |
switches | 0:5c4d7b2438d3 | 102 | buff = open(dep_path).readlines() |
switches | 0:5c4d7b2438d3 | 103 | buff[0] = re.sub('^(.*?)\: ', '', buff[0]) |
switches | 0:5c4d7b2438d3 | 104 | for line in buff: |
switches | 0:5c4d7b2438d3 | 105 | file = line.replace('\\\n', '').strip() |
switches | 0:5c4d7b2438d3 | 106 | if file: |
switches | 0:5c4d7b2438d3 | 107 | # GCC might list more than one dependency on a single line, in this case |
switches | 0:5c4d7b2438d3 | 108 | # the dependencies are separated by a space. However, a space might also |
switches | 0:5c4d7b2438d3 | 109 | # indicate an actual space character in a dependency path, but in this case |
switches | 0:5c4d7b2438d3 | 110 | # the space character is prefixed by a backslash. |
switches | 0:5c4d7b2438d3 | 111 | # Temporary replace all '\ ' with a special char that is not used (\a in this |
switches | 0:5c4d7b2438d3 | 112 | # case) to keep them from being interpreted by 'split' (they will be converted |
switches | 0:5c4d7b2438d3 | 113 | # back later to a space char) |
switches | 0:5c4d7b2438d3 | 114 | file = file.replace('\\ ', '\a') |
switches | 0:5c4d7b2438d3 | 115 | if file.find(" ") == -1: |
switches | 0:5c4d7b2438d3 | 116 | dependencies.append((self.CHROOT if self.CHROOT else '') + file.replace('\a', ' ')) |
switches | 0:5c4d7b2438d3 | 117 | else: |
switches | 0:5c4d7b2438d3 | 118 | dependencies = dependencies + [(self.CHROOT if self.CHROOT else '') + f.replace('\a', ' ') for f in file.split(" ")] |
switches | 0:5c4d7b2438d3 | 119 | return dependencies |
switches | 0:5c4d7b2438d3 | 120 | |
switches | 0:5c4d7b2438d3 | 121 | def is_not_supported_error(self, output): |
switches | 0:5c4d7b2438d3 | 122 | return "error: #error [NOT_SUPPORTED]" in output |
switches | 0:5c4d7b2438d3 | 123 | |
switches | 0:5c4d7b2438d3 | 124 | def parse_output(self, output): |
switches | 0:5c4d7b2438d3 | 125 | # The warning/error notification is multiline |
switches | 0:5c4d7b2438d3 | 126 | msg = None |
switches | 0:5c4d7b2438d3 | 127 | for line in output.splitlines(): |
switches | 0:5c4d7b2438d3 | 128 | match = GCC.DIAGNOSTIC_PATTERN.search(line) |
switches | 0:5c4d7b2438d3 | 129 | if match is not None: |
switches | 0:5c4d7b2438d3 | 130 | if msg is not None: |
switches | 0:5c4d7b2438d3 | 131 | self.cc_info(msg) |
switches | 0:5c4d7b2438d3 | 132 | msg = None |
switches | 0:5c4d7b2438d3 | 133 | msg = { |
switches | 0:5c4d7b2438d3 | 134 | 'severity': match.group('severity').lower(), |
switches | 0:5c4d7b2438d3 | 135 | 'file': match.group('file'), |
switches | 0:5c4d7b2438d3 | 136 | 'line': match.group('line'), |
switches | 0:5c4d7b2438d3 | 137 | 'col': 0, |
switches | 0:5c4d7b2438d3 | 138 | 'message': match.group('message'), |
switches | 0:5c4d7b2438d3 | 139 | 'text': '', |
switches | 0:5c4d7b2438d3 | 140 | 'target_name': self.target.name, |
switches | 0:5c4d7b2438d3 | 141 | 'toolchain_name': self.name |
switches | 0:5c4d7b2438d3 | 142 | } |
switches | 0:5c4d7b2438d3 | 143 | elif msg is not None: |
switches | 0:5c4d7b2438d3 | 144 | # Determine the warning/error column by calculating the ^ position |
switches | 0:5c4d7b2438d3 | 145 | match = GCC.INDEX_PATTERN.match(line) |
switches | 0:5c4d7b2438d3 | 146 | if match is not None: |
switches | 0:5c4d7b2438d3 | 147 | msg['col'] = len(match.group('col')) |
switches | 0:5c4d7b2438d3 | 148 | self.cc_info(msg) |
switches | 0:5c4d7b2438d3 | 149 | msg = None |
switches | 0:5c4d7b2438d3 | 150 | else: |
switches | 0:5c4d7b2438d3 | 151 | msg['text'] += line+"\n" |
switches | 0:5c4d7b2438d3 | 152 | |
switches | 0:5c4d7b2438d3 | 153 | if msg is not None: |
switches | 0:5c4d7b2438d3 | 154 | self.cc_info(msg) |
switches | 0:5c4d7b2438d3 | 155 | |
switches | 0:5c4d7b2438d3 | 156 | def get_dep_option(self, object): |
switches | 0:5c4d7b2438d3 | 157 | base, _ = splitext(object) |
switches | 0:5c4d7b2438d3 | 158 | dep_path = base + '.d' |
switches | 0:5c4d7b2438d3 | 159 | return ["-MD", "-MF", dep_path] |
switches | 0:5c4d7b2438d3 | 160 | |
switches | 0:5c4d7b2438d3 | 161 | def get_config_option(self, config_header): |
switches | 0:5c4d7b2438d3 | 162 | return ['-include', config_header] |
switches | 0:5c4d7b2438d3 | 163 | |
switches | 0:5c4d7b2438d3 | 164 | def get_compile_options(self, defines, includes, for_asm=False): |
switches | 0:5c4d7b2438d3 | 165 | opts = ['-D%s' % d for d in defines] |
switches | 0:5c4d7b2438d3 | 166 | if self.RESPONSE_FILES: |
switches | 0:5c4d7b2438d3 | 167 | opts += ['@%s' % self.get_inc_file(includes)] |
switches | 0:5c4d7b2438d3 | 168 | else: |
switches | 0:5c4d7b2438d3 | 169 | opts += ["-I%s" % i for i in includes] |
switches | 0:5c4d7b2438d3 | 170 | |
switches | 0:5c4d7b2438d3 | 171 | if not for_asm: |
switches | 0:5c4d7b2438d3 | 172 | config_header = self.get_config_header() |
switches | 0:5c4d7b2438d3 | 173 | if config_header is not None: |
switches | 0:5c4d7b2438d3 | 174 | opts = opts + self.get_config_option(config_header) |
switches | 0:5c4d7b2438d3 | 175 | return opts |
switches | 0:5c4d7b2438d3 | 176 | |
switches | 0:5c4d7b2438d3 | 177 | @hook_tool |
switches | 0:5c4d7b2438d3 | 178 | def assemble(self, source, object, includes): |
switches | 0:5c4d7b2438d3 | 179 | # Build assemble command |
switches | 0:5c4d7b2438d3 | 180 | cmd = self.asm + self.get_compile_options(self.get_symbols(True), includes) + ["-o", object, source] |
switches | 0:5c4d7b2438d3 | 181 | |
switches | 0:5c4d7b2438d3 | 182 | # Call cmdline hook |
switches | 0:5c4d7b2438d3 | 183 | cmd = self.hook.get_cmdline_assembler(cmd) |
switches | 0:5c4d7b2438d3 | 184 | |
switches | 0:5c4d7b2438d3 | 185 | # Return command array, don't execute |
switches | 0:5c4d7b2438d3 | 186 | return [cmd] |
switches | 0:5c4d7b2438d3 | 187 | |
switches | 0:5c4d7b2438d3 | 188 | @hook_tool |
switches | 0:5c4d7b2438d3 | 189 | def compile(self, cc, source, object, includes): |
switches | 0:5c4d7b2438d3 | 190 | # Build compile command |
switches | 0:5c4d7b2438d3 | 191 | cmd = cc + self.get_compile_options(self.get_symbols(), includes) |
switches | 0:5c4d7b2438d3 | 192 | |
switches | 0:5c4d7b2438d3 | 193 | cmd.extend(self.get_dep_option(object)) |
switches | 0:5c4d7b2438d3 | 194 | |
switches | 0:5c4d7b2438d3 | 195 | cmd.extend(["-o", object, source]) |
switches | 0:5c4d7b2438d3 | 196 | |
switches | 0:5c4d7b2438d3 | 197 | # Call cmdline hook |
switches | 0:5c4d7b2438d3 | 198 | cmd = self.hook.get_cmdline_compiler(cmd) |
switches | 0:5c4d7b2438d3 | 199 | |
switches | 0:5c4d7b2438d3 | 200 | return [cmd] |
switches | 0:5c4d7b2438d3 | 201 | |
switches | 0:5c4d7b2438d3 | 202 | def compile_c(self, source, object, includes): |
switches | 0:5c4d7b2438d3 | 203 | return self.compile(self.cc, source, object, includes) |
switches | 0:5c4d7b2438d3 | 204 | |
switches | 0:5c4d7b2438d3 | 205 | def compile_cpp(self, source, object, includes): |
switches | 0:5c4d7b2438d3 | 206 | return self.compile(self.cppc, source, object, includes) |
switches | 0:5c4d7b2438d3 | 207 | |
switches | 0:5c4d7b2438d3 | 208 | @hook_tool |
switches | 0:5c4d7b2438d3 | 209 | def link(self, output, objects, libraries, lib_dirs, mem_map): |
switches | 0:5c4d7b2438d3 | 210 | libs = [] |
switches | 0:5c4d7b2438d3 | 211 | for l in libraries: |
switches | 0:5c4d7b2438d3 | 212 | name, _ = splitext(basename(l)) |
switches | 0:5c4d7b2438d3 | 213 | libs.append("-l%s" % name[3:]) |
switches | 0:5c4d7b2438d3 | 214 | libs.extend(["-l%s" % l for l in self.sys_libs]) |
switches | 0:5c4d7b2438d3 | 215 | |
switches | 0:5c4d7b2438d3 | 216 | # Build linker command |
switches | 0:5c4d7b2438d3 | 217 | map_file = splitext(output)[0] + ".map" |
switches | 0:5c4d7b2438d3 | 218 | cmd = self.ld + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"] |
switches | 0:5c4d7b2438d3 | 219 | if mem_map: |
switches | 0:5c4d7b2438d3 | 220 | cmd.extend(['-T', mem_map]) |
switches | 0:5c4d7b2438d3 | 221 | |
switches | 0:5c4d7b2438d3 | 222 | for L in lib_dirs: |
switches | 0:5c4d7b2438d3 | 223 | cmd.extend(['-L', L]) |
switches | 0:5c4d7b2438d3 | 224 | cmd.extend(libs) |
switches | 0:5c4d7b2438d3 | 225 | |
switches | 0:5c4d7b2438d3 | 226 | # Call cmdline hook |
switches | 0:5c4d7b2438d3 | 227 | cmd = self.hook.get_cmdline_linker(cmd) |
switches | 0:5c4d7b2438d3 | 228 | |
switches | 0:5c4d7b2438d3 | 229 | if self.RESPONSE_FILES: |
switches | 0:5c4d7b2438d3 | 230 | # Split link command to linker executable + response file |
switches | 0:5c4d7b2438d3 | 231 | cmd_linker = cmd[0] |
switches | 0:5c4d7b2438d3 | 232 | link_files = self.get_link_file(cmd[1:]) |
switches | 0:5c4d7b2438d3 | 233 | cmd = [cmd_linker, "@%s" % link_files] |
switches | 0:5c4d7b2438d3 | 234 | |
switches | 0:5c4d7b2438d3 | 235 | # Exec command |
switches | 0:5c4d7b2438d3 | 236 | self.cc_verbose("Link: %s" % ' '.join(cmd)) |
switches | 0:5c4d7b2438d3 | 237 | self.default_cmd(cmd) |
switches | 0:5c4d7b2438d3 | 238 | |
switches | 0:5c4d7b2438d3 | 239 | @hook_tool |
switches | 0:5c4d7b2438d3 | 240 | def archive(self, objects, lib_path): |
switches | 0:5c4d7b2438d3 | 241 | if self.RESPONSE_FILES: |
switches | 0:5c4d7b2438d3 | 242 | param = ["@%s" % self.get_arch_file(objects)] |
switches | 0:5c4d7b2438d3 | 243 | else: |
switches | 0:5c4d7b2438d3 | 244 | param = objects |
switches | 0:5c4d7b2438d3 | 245 | |
switches | 0:5c4d7b2438d3 | 246 | # Exec command |
switches | 0:5c4d7b2438d3 | 247 | self.default_cmd([self.ar, 'rcs', lib_path] + param) |
switches | 0:5c4d7b2438d3 | 248 | |
switches | 0:5c4d7b2438d3 | 249 | @hook_tool |
switches | 0:5c4d7b2438d3 | 250 | def binary(self, resources, elf, bin): |
switches | 0:5c4d7b2438d3 | 251 | # Build binary command |
switches | 0:5c4d7b2438d3 | 252 | cmd = [self.elf2bin, "-O", "binary", elf, bin] |
switches | 0:5c4d7b2438d3 | 253 | |
switches | 0:5c4d7b2438d3 | 254 | # Call cmdline hook |
switches | 0:5c4d7b2438d3 | 255 | cmd = self.hook.get_cmdline_binary(cmd) |
switches | 0:5c4d7b2438d3 | 256 | |
switches | 0:5c4d7b2438d3 | 257 | # Exec command |
switches | 0:5c4d7b2438d3 | 258 | self.cc_verbose("FromELF: %s" % ' '.join(cmd)) |
switches | 0:5c4d7b2438d3 | 259 | self.default_cmd(cmd) |
switches | 0:5c4d7b2438d3 | 260 | |
switches | 0:5c4d7b2438d3 | 261 | |
switches | 0:5c4d7b2438d3 | 262 | class GCC_ARM(GCC): |
switches | 0:5c4d7b2438d3 | 263 | @staticmethod |
switches | 0:5c4d7b2438d3 | 264 | def check_executable(): |
switches | 0:5c4d7b2438d3 | 265 | """Returns True if the executable (arm-none-eabi-gcc) location |
switches | 0:5c4d7b2438d3 | 266 | specified by the user exists OR the executable can be found on the PATH. |
switches | 0:5c4d7b2438d3 | 267 | Returns False otherwise.""" |
switches | 0:5c4d7b2438d3 | 268 | return mbedToolchain.generic_check_executable("GCC_ARM", 'arm-none-eabi-gcc', 1) |
switches | 0:5c4d7b2438d3 | 269 | |
switches | 0:5c4d7b2438d3 | 270 | def __init__(self, target, notify=None, macros=None, |
switches | 0:5c4d7b2438d3 | 271 | silent=False, extra_verbose=False, build_profile=None): |
switches | 0:5c4d7b2438d3 | 272 | GCC.__init__(self, target, notify, macros, silent, |
switches | 0:5c4d7b2438d3 | 273 | TOOLCHAIN_PATHS['GCC_ARM'], extra_verbose=extra_verbose, |
switches | 0:5c4d7b2438d3 | 274 | build_profile=build_profile) |
switches | 0:5c4d7b2438d3 | 275 | |
switches | 0:5c4d7b2438d3 | 276 | self.sys_libs.append("nosys") |
switches | 0:5c4d7b2438d3 | 277 | |
switches | 0:5c4d7b2438d3 | 278 | |
switches | 0:5c4d7b2438d3 | 279 | class GCC_CR(GCC): |
switches | 0:5c4d7b2438d3 | 280 | @staticmethod |
switches | 0:5c4d7b2438d3 | 281 | def check_executable(): |
switches | 0:5c4d7b2438d3 | 282 | """Returns True if the executable (arm-none-eabi-gcc) location |
switches | 0:5c4d7b2438d3 | 283 | specified by the user exists OR the executable can be found on the PATH. |
switches | 0:5c4d7b2438d3 | 284 | Returns False otherwise.""" |
switches | 0:5c4d7b2438d3 | 285 | return mbedToolchain.generic_check_executable("GCC_CR", 'arm-none-eabi-gcc', 1) |
switches | 0:5c4d7b2438d3 | 286 | |
switches | 0:5c4d7b2438d3 | 287 | def __init__(self, target, notify=None, macros=None, |
switches | 0:5c4d7b2438d3 | 288 | silent=False, extra_verbose=False, build_profile=None): |
switches | 0:5c4d7b2438d3 | 289 | GCC.__init__(self, target, notify, macros, silent, |
switches | 0:5c4d7b2438d3 | 290 | TOOLCHAIN_PATHS['GCC_CR'], extra_verbose=extra_verbose, |
switches | 0:5c4d7b2438d3 | 291 | build_profile=build_profile) |
switches | 0:5c4d7b2438d3 | 292 | |
switches | 0:5c4d7b2438d3 | 293 | additional_compiler_flags = [ |
switches | 0:5c4d7b2438d3 | 294 | "-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP", |
switches | 0:5c4d7b2438d3 | 295 | ] |
switches | 0:5c4d7b2438d3 | 296 | self.cc += additional_compiler_flags |
switches | 0:5c4d7b2438d3 | 297 | self.cppc += additional_compiler_flags |
switches | 0:5c4d7b2438d3 | 298 | |
switches | 0:5c4d7b2438d3 | 299 | # Use latest gcc nanolib |
switches | 0:5c4d7b2438d3 | 300 | self.ld.append("--specs=nano.specs") |
switches | 0:5c4d7b2438d3 | 301 | if target.name in ["LPC1768", "LPC4088", "LPC4088_DM", "LPC4330", "UBLOX_C027", "LPC2368"]: |
switches | 0:5c4d7b2438d3 | 302 | self.ld.extend(["-u _printf_float", "-u _scanf_float"]) |
switches | 0:5c4d7b2438d3 | 303 | self.ld += ["-nostdlib"] |