Clone of official tools

Committer:
screamer
Date:
Sat Jul 16 00:34:03 2016 +0100
Revision:
22:9e85236d8716
Parent:
21:4fdf0dd04f6f
Child:
24:25bff2709c20
Sync with the mbedmicro/mbed tools

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
screamer 0:66f3b5499f7f 18 from os.path import join, basename, splitext, dirname, exists
screamer 0:66f3b5499f7f 19
screamer 20:835f6355470d 20 from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
screamer 0:66f3b5499f7f 21 from tools.hooks import hook_tool
screamer 0:66f3b5499f7f 22
screamer 0:66f3b5499f7f 23 class GCC(mbedToolchain):
screamer 0:66f3b5499f7f 24 LINKER_EXT = '.ld'
screamer 0:66f3b5499f7f 25 LIBRARY_EXT = '.a'
screamer 0:66f3b5499f7f 26
screamer 0:66f3b5499f7f 27 STD_LIB_NAME = "lib%s.a"
screamer 13:ab47a20b66f0 28 DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
screamer 21:4fdf0dd04f6f 29 INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
screamer 0:66f3b5499f7f 30
screamer 13:ab47a20b66f0 31 DEFAULT_FLAGS = {
screamer 13:ab47a20b66f0 32 'common': ["-c", "-Wall", "-Wextra",
screamer 13:ab47a20b66f0 33 "-Wno-unused-parameter", "-Wno-missing-field-initializers",
screamer 13:ab47a20b66f0 34 "-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
screamer 13:ab47a20b66f0 35 "-ffunction-sections", "-fdata-sections", "-funsigned-char",
screamer 13:ab47a20b66f0 36 "-MMD", "-fno-delete-null-pointer-checks", "-fomit-frame-pointer"
screamer 13:ab47a20b66f0 37 ],
screamer 13:ab47a20b66f0 38 'asm': ["-x", "assembler-with-cpp"],
screamer 13:ab47a20b66f0 39 'c': ["-std=gnu99"],
screamer 13:ab47a20b66f0 40 'cxx': ["-std=gnu++98", "-fno-rtti", "-Wvla"],
screamer 13:ab47a20b66f0 41 'ld': ["-Wl,--gc-sections", "-Wl,--wrap,main",
screamer 13:ab47a20b66f0 42 "-Wl,--wrap,_malloc_r", "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r"],
screamer 13:ab47a20b66f0 43 }
screamer 13:ab47a20b66f0 44
screamer 13:ab47a20b66f0 45 def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path="", extra_verbose=False):
screamer 13:ab47a20b66f0 46 mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 47
screamer 0:66f3b5499f7f 48 if target.core == "Cortex-M0+":
screamer 0:66f3b5499f7f 49 cpu = "cortex-m0plus"
screamer 0:66f3b5499f7f 50 elif target.core == "Cortex-M4F":
screamer 0:66f3b5499f7f 51 cpu = "cortex-m4"
screamer 0:66f3b5499f7f 52 elif target.core == "Cortex-M7F":
screamer 0:66f3b5499f7f 53 cpu = "cortex-m7"
screamer 13:ab47a20b66f0 54 elif target.core == "Cortex-M7FD":
screamer 13:ab47a20b66f0 55 cpu = "cortex-m7"
screamer 0:66f3b5499f7f 56 else:
screamer 0:66f3b5499f7f 57 cpu = target.core.lower()
screamer 0:66f3b5499f7f 58
screamer 0:66f3b5499f7f 59 self.cpu = ["-mcpu=%s" % cpu]
screamer 0:66f3b5499f7f 60 if target.core.startswith("Cortex"):
screamer 0:66f3b5499f7f 61 self.cpu.append("-mthumb")
screamer 0:66f3b5499f7f 62
screamer 13:ab47a20b66f0 63 # FPU handling, M7 possibly to have double FPU
screamer 0:66f3b5499f7f 64 if target.core == "Cortex-M4F":
screamer 0:66f3b5499f7f 65 self.cpu.append("-mfpu=fpv4-sp-d16")
screamer 0:66f3b5499f7f 66 self.cpu.append("-mfloat-abi=softfp")
screamer 0:66f3b5499f7f 67 elif target.core == "Cortex-M7F":
screamer 13:ab47a20b66f0 68 self.cpu.append("-mfpu=fpv5-sp-d16")
screamer 13:ab47a20b66f0 69 self.cpu.append("-mfloat-abi=softfp")
screamer 13:ab47a20b66f0 70 elif target.core == "Cortex-M7FD":
screamer 0:66f3b5499f7f 71 self.cpu.append("-mfpu=fpv5-d16")
screamer 0:66f3b5499f7f 72 self.cpu.append("-mfloat-abi=softfp")
screamer 0:66f3b5499f7f 73
screamer 13:ab47a20b66f0 74
screamer 13:ab47a20b66f0 75
screamer 0:66f3b5499f7f 76 if target.core == "Cortex-A9":
screamer 0:66f3b5499f7f 77 self.cpu.append("-mthumb-interwork")
screamer 0:66f3b5499f7f 78 self.cpu.append("-marm")
screamer 0:66f3b5499f7f 79 self.cpu.append("-march=armv7-a")
screamer 0:66f3b5499f7f 80 self.cpu.append("-mfpu=vfpv3")
screamer 0:66f3b5499f7f 81 self.cpu.append("-mfloat-abi=hard")
screamer 0:66f3b5499f7f 82 self.cpu.append("-mno-unaligned-access")
screamer 0:66f3b5499f7f 83
screamer 13:ab47a20b66f0 84
screamer 0:66f3b5499f7f 85 # Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
screamer 0:66f3b5499f7f 86 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
screamer 13:ab47a20b66f0 87 self.flags["common"] += self.cpu
screamer 0:66f3b5499f7f 88
screamer 0:66f3b5499f7f 89 if "save-asm" in self.options:
screamer 13:ab47a20b66f0 90 self.flags["common"].append("-save-temps")
screamer 13:ab47a20b66f0 91
screamer 0:66f3b5499f7f 92 if "debug-info" in self.options:
screamer 13:ab47a20b66f0 93 self.flags["common"].append("-g")
screamer 13:ab47a20b66f0 94 self.flags["common"].append("-O0")
screamer 13:ab47a20b66f0 95 else:
screamer 13:ab47a20b66f0 96 self.flags["common"].append("-O2")
screamer 2:07730b0f452c 97
screamer 13:ab47a20b66f0 98 main_cc = join(tool_path, "arm-none-eabi-gcc")
screamer 13:ab47a20b66f0 99 main_cppc = join(tool_path, "arm-none-eabi-g++")
screamer 13:ab47a20b66f0 100 self.asm = [main_cc] + self.flags['asm'] + self.flags["common"]
screamer 21:4fdf0dd04f6f 101 self.cc = [main_cc]
screamer 21:4fdf0dd04f6f 102 self.cppc =[main_cppc]
screamer 13:ab47a20b66f0 103 self.cc += self.flags['c'] + self.flags['common']
screamer 13:ab47a20b66f0 104 self.cppc += self.flags['cxx'] + self.flags['common']
screamer 0:66f3b5499f7f 105
screamer 13:ab47a20b66f0 106 self.flags['ld'] += self.cpu
screamer 13:ab47a20b66f0 107 self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.flags['ld']
screamer 0:66f3b5499f7f 108 self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"]
screamer 0:66f3b5499f7f 109
screamer 0:66f3b5499f7f 110 self.ar = join(tool_path, "arm-none-eabi-ar")
screamer 0:66f3b5499f7f 111 self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
screamer 0:66f3b5499f7f 112
screamer 0:66f3b5499f7f 113 def parse_dependencies(self, dep_path):
screamer 0:66f3b5499f7f 114 dependencies = []
screamer 0:66f3b5499f7f 115 buff = open(dep_path).readlines()
screamer 0:66f3b5499f7f 116 buff[0] = re.sub('^(.*?)\: ', '', buff[0])
screamer 0:66f3b5499f7f 117 for line in buff:
screamer 0:66f3b5499f7f 118 file = line.replace('\\\n', '').strip()
screamer 0:66f3b5499f7f 119 if file:
screamer 0:66f3b5499f7f 120 # GCC might list more than one dependency on a single line, in this case
screamer 0:66f3b5499f7f 121 # the dependencies are separated by a space. However, a space might also
screamer 0:66f3b5499f7f 122 # indicate an actual space character in a dependency path, but in this case
screamer 0:66f3b5499f7f 123 # the space character is prefixed by a backslash.
screamer 0:66f3b5499f7f 124 # Temporary replace all '\ ' with a special char that is not used (\a in this
screamer 0:66f3b5499f7f 125 # case) to keep them from being interpreted by 'split' (they will be converted
screamer 0:66f3b5499f7f 126 # back later to a space char)
screamer 0:66f3b5499f7f 127 file = file.replace('\\ ', '\a')
screamer 0:66f3b5499f7f 128 if file.find(" ") == -1:
screamer 21:4fdf0dd04f6f 129 dependencies.append((self.CHROOT if self.CHROOT else '') + file.replace('\a', ' '))
screamer 0:66f3b5499f7f 130 else:
screamer 21:4fdf0dd04f6f 131 dependencies = dependencies + [(self.CHROOT if self.CHROOT else '') + f.replace('\a', ' ') for f in file.split(" ")]
screamer 0:66f3b5499f7f 132 return dependencies
screamer 0:66f3b5499f7f 133
screamer 0:66f3b5499f7f 134 def is_not_supported_error(self, output):
screamer 0:66f3b5499f7f 135 return "error: #error [NOT_SUPPORTED]" in output
screamer 0:66f3b5499f7f 136
screamer 0:66f3b5499f7f 137 def parse_output(self, output):
screamer 0:66f3b5499f7f 138 # The warning/error notification is multiline
screamer 21:4fdf0dd04f6f 139 msg = None
screamer 0:66f3b5499f7f 140 for line in output.splitlines():
screamer 13:ab47a20b66f0 141 match = GCC.DIAGNOSTIC_PATTERN.match(line)
screamer 13:ab47a20b66f0 142 if match is not None:
screamer 21:4fdf0dd04f6f 143 if msg is not None:
screamer 21:4fdf0dd04f6f 144 self.cc_info(msg)
screamer 21:4fdf0dd04f6f 145 msg = {
screamer 21:4fdf0dd04f6f 146 'severity': match.group('severity').lower(),
screamer 21:4fdf0dd04f6f 147 'file': match.group('file'),
screamer 21:4fdf0dd04f6f 148 'line': match.group('line'),
screamer 21:4fdf0dd04f6f 149 'col': 0,
screamer 21:4fdf0dd04f6f 150 'message': match.group('message'),
screamer 21:4fdf0dd04f6f 151 'text': '',
screamer 21:4fdf0dd04f6f 152 'target_name': self.target.name,
screamer 21:4fdf0dd04f6f 153 'toolchain_name': self.name
screamer 21:4fdf0dd04f6f 154 }
screamer 21:4fdf0dd04f6f 155 elif msg is not None:
screamer 21:4fdf0dd04f6f 156 match = GCC.INDEX_PATTERN.match(line)
screamer 21:4fdf0dd04f6f 157 if match is not None:
screamer 21:4fdf0dd04f6f 158 msg['col'] = len(match.group('col'))
screamer 21:4fdf0dd04f6f 159 self.cc_info(msg)
screamer 21:4fdf0dd04f6f 160 msg = None
screamer 21:4fdf0dd04f6f 161 else:
screamer 21:4fdf0dd04f6f 162 msg['text'] += line+"\n"
screamer 0:66f3b5499f7f 163
screamer 0:66f3b5499f7f 164 def get_dep_option(self, object):
screamer 0:66f3b5499f7f 165 base, _ = splitext(object)
screamer 0:66f3b5499f7f 166 dep_path = base + '.d'
screamer 0:66f3b5499f7f 167 return ["-MD", "-MF", dep_path]
screamer 0:66f3b5499f7f 168
screamer 13:ab47a20b66f0 169 def get_config_option(self, config_header):
screamer 13:ab47a20b66f0 170 return ['-include', config_header]
screamer 13:ab47a20b66f0 171
screamer 0:66f3b5499f7f 172 def get_compile_options(self, defines, includes):
screamer 21:4fdf0dd04f6f 173 opts = ['-D%s' % d for d in defines]
screamer 21:4fdf0dd04f6f 174 if self.RESPONSE_FILES:
screamer 21:4fdf0dd04f6f 175 opts += ['@%s' % self.get_inc_file(includes)]
screamer 21:4fdf0dd04f6f 176 else:
screamer 21:4fdf0dd04f6f 177 opts += ["-I%s" % i for i in includes]
screamer 21:4fdf0dd04f6f 178
screamer 13:ab47a20b66f0 179 config_header = self.get_config_header()
screamer 13:ab47a20b66f0 180 if config_header is not None:
screamer 13:ab47a20b66f0 181 opts = opts + self.get_config_option(config_header)
screamer 13:ab47a20b66f0 182 return opts
screamer 0:66f3b5499f7f 183
screamer 0:66f3b5499f7f 184 @hook_tool
screamer 0:66f3b5499f7f 185 def assemble(self, source, object, includes):
screamer 0:66f3b5499f7f 186 # Build assemble command
screamer 0:66f3b5499f7f 187 cmd = self.asm + self.get_compile_options(self.get_symbols(), includes) + ["-o", object, source]
screamer 0:66f3b5499f7f 188
screamer 0:66f3b5499f7f 189 # Call cmdline hook
screamer 0:66f3b5499f7f 190 cmd = self.hook.get_cmdline_assembler(cmd)
screamer 0:66f3b5499f7f 191
screamer 0:66f3b5499f7f 192 # Return command array, don't execute
screamer 0:66f3b5499f7f 193 return [cmd]
screamer 0:66f3b5499f7f 194
screamer 0:66f3b5499f7f 195 @hook_tool
screamer 0:66f3b5499f7f 196 def compile(self, cc, source, object, includes):
screamer 0:66f3b5499f7f 197 # Build compile command
screamer 0:66f3b5499f7f 198 cmd = cc + self.get_compile_options(self.get_symbols(), includes)
screamer 0:66f3b5499f7f 199
screamer 0:66f3b5499f7f 200 cmd.extend(self.get_dep_option(object))
screamer 0:66f3b5499f7f 201
screamer 0:66f3b5499f7f 202 cmd.extend(["-o", object, source])
screamer 13:ab47a20b66f0 203
screamer 0:66f3b5499f7f 204 # Call cmdline hook
screamer 0:66f3b5499f7f 205 cmd = self.hook.get_cmdline_compiler(cmd)
screamer 0:66f3b5499f7f 206
screamer 0:66f3b5499f7f 207 return [cmd]
screamer 0:66f3b5499f7f 208
screamer 0:66f3b5499f7f 209 def compile_c(self, source, object, includes):
screamer 0:66f3b5499f7f 210 return self.compile(self.cc, source, object, includes)
screamer 0:66f3b5499f7f 211
screamer 0:66f3b5499f7f 212 def compile_cpp(self, source, object, includes):
screamer 0:66f3b5499f7f 213 return self.compile(self.cppc, source, object, includes)
screamer 0:66f3b5499f7f 214
screamer 0:66f3b5499f7f 215 @hook_tool
screamer 0:66f3b5499f7f 216 def link(self, output, objects, libraries, lib_dirs, mem_map):
screamer 0:66f3b5499f7f 217 libs = []
screamer 0:66f3b5499f7f 218 for l in libraries:
screamer 0:66f3b5499f7f 219 name, _ = splitext(basename(l))
screamer 0:66f3b5499f7f 220 libs.append("-l%s" % name[3:])
screamer 0:66f3b5499f7f 221 libs.extend(["-l%s" % l for l in self.sys_libs])
screamer 0:66f3b5499f7f 222
screamer 0:66f3b5499f7f 223 # Build linker command
screamer 7:5af61d55adbe 224 map_file = splitext(output)[0] + ".map"
screamer 13:ab47a20b66f0 225 cmd = self.ld + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"]
screamer 0:66f3b5499f7f 226 if mem_map:
screamer 0:66f3b5499f7f 227 cmd.extend(['-T', mem_map])
screamer 13:ab47a20b66f0 228
screamer 0:66f3b5499f7f 229 for L in lib_dirs:
screamer 0:66f3b5499f7f 230 cmd.extend(['-L', L])
screamer 0:66f3b5499f7f 231 cmd.extend(libs)
screamer 0:66f3b5499f7f 232
screamer 0:66f3b5499f7f 233 # Call cmdline hook
screamer 0:66f3b5499f7f 234 cmd = self.hook.get_cmdline_linker(cmd)
screamer 0:66f3b5499f7f 235
screamer 21:4fdf0dd04f6f 236 if self.RESPONSE_FILES:
screamer 21:4fdf0dd04f6f 237 # Split link command to linker executable + response file
screamer 21:4fdf0dd04f6f 238 cmd_linker = cmd[0]
screamer 21:4fdf0dd04f6f 239 link_files = self.get_link_file(cmd[1:])
screamer 21:4fdf0dd04f6f 240 cmd = [cmd_linker, "@%s" % link_files]
screamer 0:66f3b5499f7f 241
screamer 0:66f3b5499f7f 242 # Exec command
screamer 21:4fdf0dd04f6f 243 self.cc_verbose("Link: %s" % ' '.join(cmd))
screamer 21:4fdf0dd04f6f 244 self.default_cmd(cmd)
screamer 0:66f3b5499f7f 245
screamer 0:66f3b5499f7f 246 @hook_tool
screamer 0:66f3b5499f7f 247 def archive(self, objects, lib_path):
screamer 21:4fdf0dd04f6f 248 if self.RESPONSE_FILES:
screamer 22:9e85236d8716 249 param = ["@%s" % self.get_arch_file(objects)]
screamer 21:4fdf0dd04f6f 250 else:
screamer 21:4fdf0dd04f6f 251 param = objects
screamer 0:66f3b5499f7f 252
screamer 0:66f3b5499f7f 253 # Exec command
screamer 21:4fdf0dd04f6f 254 self.default_cmd([self.ar, 'rcs', lib_path] + param)
screamer 0:66f3b5499f7f 255
screamer 0:66f3b5499f7f 256 @hook_tool
screamer 0:66f3b5499f7f 257 def binary(self, resources, elf, bin):
screamer 0:66f3b5499f7f 258 # Build binary command
screamer 0:66f3b5499f7f 259 cmd = [self.elf2bin, "-O", "binary", elf, bin]
screamer 0:66f3b5499f7f 260
screamer 0:66f3b5499f7f 261 # Call cmdline hook
screamer 0:66f3b5499f7f 262 cmd = self.hook.get_cmdline_binary(cmd)
screamer 0:66f3b5499f7f 263
screamer 0:66f3b5499f7f 264 # Exec command
screamer 21:4fdf0dd04f6f 265 self.cc_verbose("FromELF: %s" % ' '.join(cmd))
screamer 0:66f3b5499f7f 266 self.default_cmd(cmd)
screamer 0:66f3b5499f7f 267
screamer 0:66f3b5499f7f 268
screamer 0:66f3b5499f7f 269 class GCC_ARM(GCC):
screamer 13:ab47a20b66f0 270 def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
screamer 20:835f6355470d 271 GCC.__init__(self, target, options, notify, macros, silent, TOOLCHAIN_PATHS['GCC_ARM'], extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 272
screamer 0:66f3b5499f7f 273 # Use latest gcc nanolib
screamer 13:ab47a20b66f0 274 if "big-build" in self.options:
screamer 13:ab47a20b66f0 275 use_nano = False
screamer 13:ab47a20b66f0 276 elif "small-build" in self.options:
screamer 13:ab47a20b66f0 277 use_nano = True
screamer 13:ab47a20b66f0 278 elif target.default_build == "standard":
screamer 13:ab47a20b66f0 279 use_nano = False
screamer 13:ab47a20b66f0 280 elif target.default_build == "small":
screamer 13:ab47a20b66f0 281 use_nano = True
screamer 13:ab47a20b66f0 282 else:
screamer 13:ab47a20b66f0 283 use_nano = False
screamer 13:ab47a20b66f0 284
screamer 13:ab47a20b66f0 285 if use_nano:
screamer 13:ab47a20b66f0 286 self.ld.append("--specs=nano.specs")
screamer 13:ab47a20b66f0 287 self.flags['ld'].append("--specs=nano.specs")
screamer 13:ab47a20b66f0 288 self.cc += ["-DMBED_RTOS_SINGLE_THREAD"]
screamer 13:ab47a20b66f0 289 self.cppc += ["-DMBED_RTOS_SINGLE_THREAD"]
screamer 13:ab47a20b66f0 290 self.macros.extend(["MBED_RTOS_SINGLE_THREAD"])
screamer 13:ab47a20b66f0 291
screamer 13:ab47a20b66f0 292 if target.name in ["LPC1768", "LPC4088", "LPC4088_DM", "LPC4330", "UBLOX_C027", "LPC2368", "ARM_BEETLE_SOC"]:
screamer 0:66f3b5499f7f 293 self.ld.extend(["-u _printf_float", "-u _scanf_float"])
screamer 13:ab47a20b66f0 294 self.flags['ld'].extend(["-u _printf_float", "-u _scanf_float"])
screamer 13:ab47a20b66f0 295 elif target.name in ["RZ_A1H", "VK_RZ_A1H", "ARCH_MAX", "DISCO_F407VG", "DISCO_F429ZI", "DISCO_F469NI", "NUCLEO_F401RE", "NUCLEO_F410RB", "NUCLEO_F411RE", "NUCLEO_F429ZI", "NUCLEO_F446RE", "NUCLEO_F446ZE", "ELMO_F411RE", "MTS_MDOT_F411RE", "MTS_DRAGONFLY_F411RE", "DISCO_F746NG"]:
screamer 0:66f3b5499f7f 296 self.ld.extend(["-u_printf_float", "-u_scanf_float"])
screamer 13:ab47a20b66f0 297 self.flags['ld'].extend(["-u_printf_float", "-u_scanf_float"])
screamer 0:66f3b5499f7f 298
screamer 0:66f3b5499f7f 299 self.sys_libs.append("nosys")
screamer 0:66f3b5499f7f 300
screamer 0:66f3b5499f7f 301
screamer 0:66f3b5499f7f 302 class GCC_CR(GCC):
screamer 13:ab47a20b66f0 303 def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
screamer 20:835f6355470d 304 GCC.__init__(self, target, options, notify, macros, silent, TOOLCHAIN_PATHS['GCC_CR'], extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 305
screamer 0:66f3b5499f7f 306 additional_compiler_flags = [
screamer 0:66f3b5499f7f 307 "-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
screamer 0:66f3b5499f7f 308 ]
screamer 0:66f3b5499f7f 309 self.cc += additional_compiler_flags
screamer 0:66f3b5499f7f 310 self.cppc += additional_compiler_flags
screamer 0:66f3b5499f7f 311
screamer 0:66f3b5499f7f 312 # Use latest gcc nanolib
screamer 0:66f3b5499f7f 313 self.ld.append("--specs=nano.specs")
screamer 0:66f3b5499f7f 314 if target.name in ["LPC1768", "LPC4088", "LPC4088_DM", "LPC4330", "UBLOX_C027", "LPC2368"]:
screamer 0:66f3b5499f7f 315 self.ld.extend(["-u _printf_float", "-u _scanf_float"])
screamer 0:66f3b5499f7f 316 self.ld += ["-nostdlib"]