Clone of official tools
toolchains/gcc.py@2:07730b0f452c, 2016-05-20 (annotated)
- Committer:
- screamer
- Date:
- Fri May 20 22:27:03 2016 +0100
- Revision:
- 2:07730b0f452c
- Parent:
- 0:66f3b5499f7f
- Child:
- 7:5af61d55adbe
Add profiling support for armcc, gcc and iar
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 |
screamer | 0:66f3b5499f7f | 18 | from os.path import join, basename, splitext, dirname, exists |
screamer | 0:66f3b5499f7f | 19 | |
screamer | 0:66f3b5499f7f | 20 | from tools.toolchains import mbedToolchain |
screamer | 0:66f3b5499f7f | 21 | from tools.settings import GCC_ARM_PATH, GCC_CR_PATH |
screamer | 0:66f3b5499f7f | 22 | from tools.settings import GOANNA_PATH |
screamer | 0:66f3b5499f7f | 23 | from tools.hooks import hook_tool |
screamer | 0:66f3b5499f7f | 24 | |
screamer | 0:66f3b5499f7f | 25 | class GCC(mbedToolchain): |
screamer | 2:07730b0f452c | 26 | PROFILE = {} |
screamer | 0:66f3b5499f7f | 27 | LINKER_EXT = '.ld' |
screamer | 0:66f3b5499f7f | 28 | LIBRARY_EXT = '.a' |
screamer | 0:66f3b5499f7f | 29 | |
screamer | 0:66f3b5499f7f | 30 | STD_LIB_NAME = "lib%s.a" |
screamer | 0:66f3b5499f7f | 31 | CIRCULAR_DEPENDENCIES = True |
screamer | 0:66f3b5499f7f | 32 | DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)') |
screamer | 0:66f3b5499f7f | 33 | |
screamer | 2:07730b0f452c | 34 | def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path="", extra_verbose=False, profile=None): |
screamer | 2:07730b0f452c | 35 | mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose, profile=profile) |
screamer | 0:66f3b5499f7f | 36 | |
screamer | 0:66f3b5499f7f | 37 | if target.core == "Cortex-M0+": |
screamer | 0:66f3b5499f7f | 38 | cpu = "cortex-m0plus" |
screamer | 0:66f3b5499f7f | 39 | elif target.core == "Cortex-M4F": |
screamer | 0:66f3b5499f7f | 40 | cpu = "cortex-m4" |
screamer | 0:66f3b5499f7f | 41 | elif target.core == "Cortex-M7F": |
screamer | 0:66f3b5499f7f | 42 | cpu = "cortex-m7" |
screamer | 0:66f3b5499f7f | 43 | else: |
screamer | 0:66f3b5499f7f | 44 | cpu = target.core.lower() |
screamer | 0:66f3b5499f7f | 45 | |
screamer | 0:66f3b5499f7f | 46 | self.cpu = ["-mcpu=%s" % cpu] |
screamer | 0:66f3b5499f7f | 47 | if target.core.startswith("Cortex"): |
screamer | 0:66f3b5499f7f | 48 | self.cpu.append("-mthumb") |
screamer | 0:66f3b5499f7f | 49 | |
screamer | 0:66f3b5499f7f | 50 | if target.core == "Cortex-M4F": |
screamer | 0:66f3b5499f7f | 51 | self.cpu.append("-mfpu=fpv4-sp-d16") |
screamer | 0:66f3b5499f7f | 52 | self.cpu.append("-mfloat-abi=softfp") |
screamer | 0:66f3b5499f7f | 53 | elif target.core == "Cortex-M7F": |
screamer | 0:66f3b5499f7f | 54 | self.cpu.append("-mfpu=fpv5-d16") |
screamer | 0:66f3b5499f7f | 55 | self.cpu.append("-mfloat-abi=softfp") |
screamer | 0:66f3b5499f7f | 56 | |
screamer | 0:66f3b5499f7f | 57 | if target.core == "Cortex-A9": |
screamer | 0:66f3b5499f7f | 58 | self.cpu.append("-mthumb-interwork") |
screamer | 0:66f3b5499f7f | 59 | self.cpu.append("-marm") |
screamer | 0:66f3b5499f7f | 60 | self.cpu.append("-march=armv7-a") |
screamer | 0:66f3b5499f7f | 61 | self.cpu.append("-mfpu=vfpv3") |
screamer | 0:66f3b5499f7f | 62 | self.cpu.append("-mfloat-abi=hard") |
screamer | 0:66f3b5499f7f | 63 | self.cpu.append("-mno-unaligned-access") |
screamer | 0:66f3b5499f7f | 64 | |
screamer | 0:66f3b5499f7f | 65 | # Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug: |
screamer | 0:66f3b5499f7f | 66 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762 |
screamer | 2:07730b0f452c | 67 | common_flags = self.PROFILE.get('COMMON_FLAGS', ["-c", "-O2", |
screamer | 2:07730b0f452c | 68 | "-Wall", "-Wextra", "-Wno-unused-parameter", "-Wno-missing-field-initializers", |
screamer | 0:66f3b5499f7f | 69 | "-fmessage-length=0", "-fno-exceptions", "-fno-builtin", |
screamer | 0:66f3b5499f7f | 70 | "-ffunction-sections", "-fdata-sections", |
screamer | 0:66f3b5499f7f | 71 | "-fno-delete-null-pointer-checks", "-fomit-frame-pointer" |
screamer | 2:07730b0f452c | 72 | ]) + self.cpu |
screamer | 0:66f3b5499f7f | 73 | |
screamer | 0:66f3b5499f7f | 74 | if "save-asm" in self.options: |
screamer | 0:66f3b5499f7f | 75 | common_flags.append("-save-temps") |
screamer | 0:66f3b5499f7f | 76 | if "debug-info" in self.options: |
screamer | 2:07730b0f452c | 77 | common_flags.remove("-O3") |
screamer | 2:07730b0f452c | 78 | common_flags.remove("-O2") |
screamer | 2:07730b0f452c | 79 | common_flags.remove("-O1") |
screamer | 0:66f3b5499f7f | 80 | common_flags.append("-O0") |
screamer | 2:07730b0f452c | 81 | |
screamer | 0:66f3b5499f7f | 82 | # add debug symbols for all builds |
screamer | 0:66f3b5499f7f | 83 | common_flags.append("-g") |
screamer | 0:66f3b5499f7f | 84 | |
screamer | 2:07730b0f452c | 85 | self.asm = [join(tool_path, "arm-none-eabi-gcc")] + self.PROFILE.get('COMMON_ASM_FLAGS', ["-x", "assembler-with-cpp"]) + common_flags |
screamer | 2:07730b0f452c | 86 | self.cc = [join(tool_path, "arm-none-eabi-gcc")] + self.PROFILE.get('COMMON_CC_FLAGS', ["-std=gnu99"]) + common_flags |
screamer | 2:07730b0f452c | 87 | self.cppc =[join(tool_path, "arm-none-eabi-g++")] + self.PROFILE.get('COMMON_CPP_FLAGS', ["-std=gnu++98", "-fno-rtti"]) + common_flags |
screamer | 2:07730b0f452c | 88 | self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.PROFILE.get('COMMON_LD_FLAGS', ["-Wl,--gc-sections", "-Wl,--wrap,main"]) + self.cpu |
screamer | 0:66f3b5499f7f | 89 | |
screamer | 0:66f3b5499f7f | 90 | self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"] |
screamer | 0:66f3b5499f7f | 91 | |
screamer | 0:66f3b5499f7f | 92 | self.ar = join(tool_path, "arm-none-eabi-ar") |
screamer | 0:66f3b5499f7f | 93 | self.elf2bin = join(tool_path, "arm-none-eabi-objcopy") |
screamer | 0:66f3b5499f7f | 94 | |
screamer | 0:66f3b5499f7f | 95 | def parse_dependencies(self, dep_path): |
screamer | 0:66f3b5499f7f | 96 | dependencies = [] |
screamer | 0:66f3b5499f7f | 97 | buff = open(dep_path).readlines() |
screamer | 0:66f3b5499f7f | 98 | buff[0] = re.sub('^(.*?)\: ', '', buff[0]) |
screamer | 0:66f3b5499f7f | 99 | for line in buff: |
screamer | 0:66f3b5499f7f | 100 | file = line.replace('\\\n', '').strip() |
screamer | 0:66f3b5499f7f | 101 | if file: |
screamer | 0:66f3b5499f7f | 102 | # GCC might list more than one dependency on a single line, in this case |
screamer | 0:66f3b5499f7f | 103 | # the dependencies are separated by a space. However, a space might also |
screamer | 0:66f3b5499f7f | 104 | # indicate an actual space character in a dependency path, but in this case |
screamer | 0:66f3b5499f7f | 105 | # the space character is prefixed by a backslash. |
screamer | 0:66f3b5499f7f | 106 | # Temporary replace all '\ ' with a special char that is not used (\a in this |
screamer | 0:66f3b5499f7f | 107 | # case) to keep them from being interpreted by 'split' (they will be converted |
screamer | 0:66f3b5499f7f | 108 | # back later to a space char) |
screamer | 0:66f3b5499f7f | 109 | file = file.replace('\\ ', '\a') |
screamer | 0:66f3b5499f7f | 110 | if file.find(" ") == -1: |
screamer | 0:66f3b5499f7f | 111 | dependencies.append(file.replace('\a', ' ')) |
screamer | 0:66f3b5499f7f | 112 | else: |
screamer | 0:66f3b5499f7f | 113 | dependencies = dependencies + [f.replace('\a', ' ') for f in file.split(" ")] |
screamer | 0:66f3b5499f7f | 114 | return dependencies |
screamer | 0:66f3b5499f7f | 115 | |
screamer | 0:66f3b5499f7f | 116 | def is_not_supported_error(self, output): |
screamer | 0:66f3b5499f7f | 117 | return "error: #error [NOT_SUPPORTED]" in output |
screamer | 0:66f3b5499f7f | 118 | |
screamer | 0:66f3b5499f7f | 119 | def parse_output(self, output): |
screamer | 0:66f3b5499f7f | 120 | # The warning/error notification is multiline |
screamer | 0:66f3b5499f7f | 121 | WHERE, WHAT = 0, 1 |
screamer | 0:66f3b5499f7f | 122 | state, file, message = WHERE, None, None |
screamer | 0:66f3b5499f7f | 123 | for line in output.splitlines(): |
screamer | 0:66f3b5499f7f | 124 | match = self.goanna_parse_line(line) |
screamer | 0:66f3b5499f7f | 125 | if match is not None: |
screamer | 0:66f3b5499f7f | 126 | self.cc_info( |
screamer | 0:66f3b5499f7f | 127 | match.group('severity').lower(), |
screamer | 0:66f3b5499f7f | 128 | match.group('file'), |
screamer | 0:66f3b5499f7f | 129 | match.group('line'), |
screamer | 0:66f3b5499f7f | 130 | match.group('message'), |
screamer | 0:66f3b5499f7f | 131 | target_name=self.target.name, |
screamer | 0:66f3b5499f7f | 132 | toolchain_name=self.name |
screamer | 0:66f3b5499f7f | 133 | ) |
screamer | 0:66f3b5499f7f | 134 | continue |
screamer | 0:66f3b5499f7f | 135 | |
screamer | 0:66f3b5499f7f | 136 | # Each line should start with the file information: "filepath: ..." |
screamer | 0:66f3b5499f7f | 137 | # i should point past the file path ^ |
screamer | 0:66f3b5499f7f | 138 | # avoid the first column in Windows (C:\) |
screamer | 0:66f3b5499f7f | 139 | i = line.find(':', 2) |
screamer | 0:66f3b5499f7f | 140 | if i == -1: continue |
screamer | 0:66f3b5499f7f | 141 | |
screamer | 0:66f3b5499f7f | 142 | if state == WHERE: |
screamer | 0:66f3b5499f7f | 143 | file = line[:i] |
screamer | 0:66f3b5499f7f | 144 | message = line[i+1:].strip() + ' ' |
screamer | 0:66f3b5499f7f | 145 | state = WHAT |
screamer | 0:66f3b5499f7f | 146 | |
screamer | 0:66f3b5499f7f | 147 | elif state == WHAT: |
screamer | 0:66f3b5499f7f | 148 | match = GCC.DIAGNOSTIC_PATTERN.match(line[i+1:]) |
screamer | 0:66f3b5499f7f | 149 | if match is None: |
screamer | 0:66f3b5499f7f | 150 | state = WHERE |
screamer | 0:66f3b5499f7f | 151 | continue |
screamer | 0:66f3b5499f7f | 152 | |
screamer | 0:66f3b5499f7f | 153 | self.cc_info( |
screamer | 0:66f3b5499f7f | 154 | match.group('severity'), |
screamer | 0:66f3b5499f7f | 155 | file, match.group('line'), |
screamer | 0:66f3b5499f7f | 156 | message + match.group('message') |
screamer | 0:66f3b5499f7f | 157 | ) |
screamer | 0:66f3b5499f7f | 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 | 0:66f3b5499f7f | 164 | def get_compile_options(self, defines, includes): |
screamer | 0:66f3b5499f7f | 165 | return ['-D%s' % d for d in defines] + ['@%s' % self.get_inc_file(includes)] |
screamer | 0:66f3b5499f7f | 166 | |
screamer | 0:66f3b5499f7f | 167 | @hook_tool |
screamer | 0:66f3b5499f7f | 168 | def assemble(self, source, object, includes): |
screamer | 0:66f3b5499f7f | 169 | # Build assemble command |
screamer | 0:66f3b5499f7f | 170 | cmd = self.asm + self.get_compile_options(self.get_symbols(), includes) + ["-o", object, source] |
screamer | 0:66f3b5499f7f | 171 | |
screamer | 0:66f3b5499f7f | 172 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 173 | cmd = self.hook.get_cmdline_assembler(cmd) |
screamer | 0:66f3b5499f7f | 174 | |
screamer | 0:66f3b5499f7f | 175 | # Return command array, don't execute |
screamer | 0:66f3b5499f7f | 176 | return [cmd] |
screamer | 0:66f3b5499f7f | 177 | |
screamer | 0:66f3b5499f7f | 178 | @hook_tool |
screamer | 0:66f3b5499f7f | 179 | def compile(self, cc, source, object, includes): |
screamer | 0:66f3b5499f7f | 180 | # Build compile command |
screamer | 0:66f3b5499f7f | 181 | cmd = cc + self.get_compile_options(self.get_symbols(), includes) |
screamer | 0:66f3b5499f7f | 182 | |
screamer | 0:66f3b5499f7f | 183 | cmd.extend(self.get_dep_option(object)) |
screamer | 0:66f3b5499f7f | 184 | |
screamer | 0:66f3b5499f7f | 185 | cmd.extend(["-o", object, source]) |
screamer | 0:66f3b5499f7f | 186 | |
screamer | 0:66f3b5499f7f | 187 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 188 | cmd = self.hook.get_cmdline_compiler(cmd) |
screamer | 0:66f3b5499f7f | 189 | |
screamer | 0:66f3b5499f7f | 190 | return [cmd] |
screamer | 0:66f3b5499f7f | 191 | |
screamer | 0:66f3b5499f7f | 192 | def compile_c(self, source, object, includes): |
screamer | 0:66f3b5499f7f | 193 | return self.compile(self.cc, source, object, includes) |
screamer | 0:66f3b5499f7f | 194 | |
screamer | 0:66f3b5499f7f | 195 | def compile_cpp(self, source, object, includes): |
screamer | 0:66f3b5499f7f | 196 | return self.compile(self.cppc, source, object, includes) |
screamer | 0:66f3b5499f7f | 197 | |
screamer | 0:66f3b5499f7f | 198 | @hook_tool |
screamer | 0:66f3b5499f7f | 199 | def link(self, output, objects, libraries, lib_dirs, mem_map): |
screamer | 0:66f3b5499f7f | 200 | libs = [] |
screamer | 0:66f3b5499f7f | 201 | for l in libraries: |
screamer | 0:66f3b5499f7f | 202 | name, _ = splitext(basename(l)) |
screamer | 0:66f3b5499f7f | 203 | libs.append("-l%s" % name[3:]) |
screamer | 0:66f3b5499f7f | 204 | libs.extend(["-l%s" % l for l in self.sys_libs]) |
screamer | 0:66f3b5499f7f | 205 | |
screamer | 0:66f3b5499f7f | 206 | # NOTE: There is a circular dependency between the mbed library and the clib |
screamer | 0:66f3b5499f7f | 207 | # We could define a set of week symbols to satisfy the clib dependencies in "sys.o", |
screamer | 0:66f3b5499f7f | 208 | # but if an application uses only clib symbols and not mbed symbols, then the final |
screamer | 0:66f3b5499f7f | 209 | # image is not correctly retargeted |
screamer | 0:66f3b5499f7f | 210 | if self.CIRCULAR_DEPENDENCIES: |
screamer | 0:66f3b5499f7f | 211 | libs.extend(libs) |
screamer | 0:66f3b5499f7f | 212 | |
screamer | 0:66f3b5499f7f | 213 | # Build linker command |
screamer | 0:66f3b5499f7f | 214 | cmd = self.ld + ["-o", output] + objects |
screamer | 0:66f3b5499f7f | 215 | |
screamer | 0:66f3b5499f7f | 216 | if mem_map: |
screamer | 0:66f3b5499f7f | 217 | cmd.extend(['-T', mem_map]) |
screamer | 0:66f3b5499f7f | 218 | |
screamer | 0:66f3b5499f7f | 219 | for L in lib_dirs: |
screamer | 0:66f3b5499f7f | 220 | cmd.extend(['-L', L]) |
screamer | 0:66f3b5499f7f | 221 | cmd.extend(libs) |
screamer | 0:66f3b5499f7f | 222 | |
screamer | 0:66f3b5499f7f | 223 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 224 | cmd = self.hook.get_cmdline_linker(cmd) |
screamer | 0:66f3b5499f7f | 225 | |
screamer | 0:66f3b5499f7f | 226 | # Split link command to linker executable + response file |
screamer | 0:66f3b5499f7f | 227 | link_files = join(dirname(output), ".link_files.txt") |
screamer | 0:66f3b5499f7f | 228 | with open(link_files, "wb") as f: |
screamer | 0:66f3b5499f7f | 229 | cmd_linker = cmd[0] |
screamer | 0:66f3b5499f7f | 230 | cmd_list = [] |
screamer | 0:66f3b5499f7f | 231 | for c in cmd[1:]: |
screamer | 0:66f3b5499f7f | 232 | if c: |
screamer | 0:66f3b5499f7f | 233 | cmd_list.append(('"%s"' % c) if not c.startswith('-') else c) |
screamer | 0:66f3b5499f7f | 234 | string = " ".join(cmd_list).replace("\\", "/") |
screamer | 0:66f3b5499f7f | 235 | f.write(string) |
screamer | 0:66f3b5499f7f | 236 | |
screamer | 0:66f3b5499f7f | 237 | # Exec command |
screamer | 0:66f3b5499f7f | 238 | self.default_cmd([cmd_linker, "@%s" % link_files]) |
screamer | 0:66f3b5499f7f | 239 | |
screamer | 0:66f3b5499f7f | 240 | @hook_tool |
screamer | 0:66f3b5499f7f | 241 | def archive(self, objects, lib_path): |
screamer | 0:66f3b5499f7f | 242 | archive_files = join(dirname(lib_path), ".archive_files.txt") |
screamer | 0:66f3b5499f7f | 243 | with open(archive_files, "wb") as f: |
screamer | 0:66f3b5499f7f | 244 | o_list = [] |
screamer | 0:66f3b5499f7f | 245 | for o in objects: |
screamer | 0:66f3b5499f7f | 246 | o_list.append('"%s"' % o) |
screamer | 0:66f3b5499f7f | 247 | string = " ".join(o_list).replace("\\", "/") |
screamer | 0:66f3b5499f7f | 248 | f.write(string) |
screamer | 0:66f3b5499f7f | 249 | |
screamer | 0:66f3b5499f7f | 250 | # Exec command |
screamer | 0:66f3b5499f7f | 251 | self.default_cmd([self.ar, 'rcs', lib_path, "@%s" % archive_files]) |
screamer | 0:66f3b5499f7f | 252 | |
screamer | 0:66f3b5499f7f | 253 | @hook_tool |
screamer | 0:66f3b5499f7f | 254 | def binary(self, resources, elf, bin): |
screamer | 0:66f3b5499f7f | 255 | # Build binary command |
screamer | 0:66f3b5499f7f | 256 | cmd = [self.elf2bin, "-O", "binary", elf, bin] |
screamer | 0:66f3b5499f7f | 257 | |
screamer | 0:66f3b5499f7f | 258 | # Call cmdline hook |
screamer | 0:66f3b5499f7f | 259 | cmd = self.hook.get_cmdline_binary(cmd) |
screamer | 0:66f3b5499f7f | 260 | |
screamer | 0:66f3b5499f7f | 261 | # Exec command |
screamer | 0:66f3b5499f7f | 262 | self.default_cmd(cmd) |
screamer | 0:66f3b5499f7f | 263 | |
screamer | 0:66f3b5499f7f | 264 | |
screamer | 0:66f3b5499f7f | 265 | class GCC_ARM(GCC): |
screamer | 2:07730b0f452c | 266 | def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False, profile=None): |
screamer | 2:07730b0f452c | 267 | GCC.__init__(self, target, options, notify, macros, silent, GCC_ARM_PATH, extra_verbose=extra_verbose, profile=profile) |
screamer | 0:66f3b5499f7f | 268 | |
screamer | 0:66f3b5499f7f | 269 | # Use latest gcc nanolib |
screamer | 0:66f3b5499f7f | 270 | self.ld.append("--specs=nano.specs") |
screamer | 0:66f3b5499f7f | 271 | if target.name in ["LPC1768", "LPC4088", "LPC4088_DM", "LPC4330", "UBLOX_C027", "LPC2368"]: |
screamer | 0:66f3b5499f7f | 272 | self.ld.extend(["-u _printf_float", "-u _scanf_float"]) |
screamer | 0:66f3b5499f7f | 273 | elif target.name in ["RZ_A1H", "ARCH_MAX", "DISCO_F407VG", "DISCO_F429ZI", "DISCO_F469NI", "NUCLEO_F401RE", "NUCLEO_F410RB", "NUCLEO_F411RE", "NUCLEO_F446RE", "ELMO_F411RE", "MTS_MDOT_F411RE", "MTS_DRAGONFLY_F411RE", "DISCO_F746NG"]: |
screamer | 0:66f3b5499f7f | 274 | self.ld.extend(["-u_printf_float", "-u_scanf_float"]) |
screamer | 0:66f3b5499f7f | 275 | |
screamer | 0:66f3b5499f7f | 276 | self.sys_libs.append("nosys") |
screamer | 0:66f3b5499f7f | 277 | |
screamer | 0:66f3b5499f7f | 278 | |
screamer | 0:66f3b5499f7f | 279 | class GCC_CR(GCC): |
screamer | 2:07730b0f452c | 280 | def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False, profile=None): |
screamer | 2:07730b0f452c | 281 | GCC.__init__(self, target, options, notify, macros, silent, GCC_CR_PATH, extra_verbose=extra_verbose, profile=profile) |
screamer | 0:66f3b5499f7f | 282 | |
screamer | 0:66f3b5499f7f | 283 | additional_compiler_flags = [ |
screamer | 0:66f3b5499f7f | 284 | "-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP", |
screamer | 0:66f3b5499f7f | 285 | ] |
screamer | 0:66f3b5499f7f | 286 | self.cc += additional_compiler_flags |
screamer | 0:66f3b5499f7f | 287 | self.cppc += additional_compiler_flags |
screamer | 0:66f3b5499f7f | 288 | |
screamer | 0:66f3b5499f7f | 289 | # Use latest gcc nanolib |
screamer | 0:66f3b5499f7f | 290 | self.ld.append("--specs=nano.specs") |
screamer | 0:66f3b5499f7f | 291 | if target.name in ["LPC1768", "LPC4088", "LPC4088_DM", "LPC4330", "UBLOX_C027", "LPC2368"]: |
screamer | 0:66f3b5499f7f | 292 | self.ld.extend(["-u _printf_float", "-u _scanf_float"]) |
screamer | 0:66f3b5499f7f | 293 | self.ld += ["-nostdlib"] |
screamer | 0:66f3b5499f7f | 294 |