Clone of official tools
toolchains/__init__.py@1:a99c8e460c5c, 2016-05-20 (annotated)
- Committer:
- screamer
- Date:
- Fri May 20 20:16:44 2016 +0100
- Revision:
- 1:a99c8e460c5c
- Parent:
- 0:66f3b5499f7f
- Child:
- 2:07730b0f452c
Import backward compatibility profiles from online build system
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 | |
screamer | 0:66f3b5499f7f | 18 | import re |
screamer | 0:66f3b5499f7f | 19 | import sys |
screamer | 0:66f3b5499f7f | 20 | from os import stat, walk, getcwd |
screamer | 0:66f3b5499f7f | 21 | from copy import copy |
screamer | 0:66f3b5499f7f | 22 | from time import time, sleep |
screamer | 0:66f3b5499f7f | 23 | from types import ListType |
screamer | 0:66f3b5499f7f | 24 | from shutil import copyfile |
screamer | 0:66f3b5499f7f | 25 | from os.path import join, splitext, exists, relpath, dirname, basename, split |
screamer | 0:66f3b5499f7f | 26 | from inspect import getmro |
screamer | 0:66f3b5499f7f | 27 | |
screamer | 0:66f3b5499f7f | 28 | from multiprocessing import Pool, cpu_count |
screamer | 0:66f3b5499f7f | 29 | from tools.utils import run_cmd, mkdir, rel_path, ToolException, NotSupportedException, split_path |
screamer | 0:66f3b5499f7f | 30 | from tools.settings import BUILD_OPTIONS, MBED_ORG_USER |
screamer | 0:66f3b5499f7f | 31 | import tools.hooks as hooks |
screamer | 0:66f3b5499f7f | 32 | from hashlib import md5 |
screamer | 0:66f3b5499f7f | 33 | |
screamer | 0:66f3b5499f7f | 34 | |
screamer | 0:66f3b5499f7f | 35 | #Disables multiprocessing if set to higher number than the host machine CPUs |
screamer | 0:66f3b5499f7f | 36 | CPU_COUNT_MIN = 1 |
screamer | 0:66f3b5499f7f | 37 | |
screamer | 0:66f3b5499f7f | 38 | def compile_worker(job): |
screamer | 0:66f3b5499f7f | 39 | results = [] |
screamer | 0:66f3b5499f7f | 40 | for command in job['commands']: |
screamer | 0:66f3b5499f7f | 41 | _, _stderr, _rc = run_cmd(command, job['work_dir']) |
screamer | 0:66f3b5499f7f | 42 | results.append({ |
screamer | 0:66f3b5499f7f | 43 | 'code': _rc, |
screamer | 0:66f3b5499f7f | 44 | 'output': _stderr, |
screamer | 0:66f3b5499f7f | 45 | 'command': command |
screamer | 0:66f3b5499f7f | 46 | }) |
screamer | 0:66f3b5499f7f | 47 | |
screamer | 0:66f3b5499f7f | 48 | return { |
screamer | 0:66f3b5499f7f | 49 | 'source': job['source'], |
screamer | 0:66f3b5499f7f | 50 | 'object': job['object'], |
screamer | 0:66f3b5499f7f | 51 | 'commands': job['commands'], |
screamer | 0:66f3b5499f7f | 52 | 'results': results |
screamer | 0:66f3b5499f7f | 53 | } |
screamer | 0:66f3b5499f7f | 54 | |
screamer | 0:66f3b5499f7f | 55 | class Resources: |
screamer | 0:66f3b5499f7f | 56 | def __init__(self, base_path=None): |
screamer | 0:66f3b5499f7f | 57 | self.base_path = base_path |
screamer | 0:66f3b5499f7f | 58 | |
screamer | 0:66f3b5499f7f | 59 | self.inc_dirs = [] |
screamer | 0:66f3b5499f7f | 60 | self.headers = [] |
screamer | 0:66f3b5499f7f | 61 | |
screamer | 0:66f3b5499f7f | 62 | self.s_sources = [] |
screamer | 0:66f3b5499f7f | 63 | self.c_sources = [] |
screamer | 0:66f3b5499f7f | 64 | self.cpp_sources = [] |
screamer | 0:66f3b5499f7f | 65 | |
screamer | 0:66f3b5499f7f | 66 | self.lib_dirs = set([]) |
screamer | 0:66f3b5499f7f | 67 | self.objects = [] |
screamer | 0:66f3b5499f7f | 68 | self.libraries = [] |
screamer | 0:66f3b5499f7f | 69 | |
screamer | 0:66f3b5499f7f | 70 | # mbed special files |
screamer | 0:66f3b5499f7f | 71 | self.lib_builds = [] |
screamer | 0:66f3b5499f7f | 72 | self.lib_refs = [] |
screamer | 0:66f3b5499f7f | 73 | |
screamer | 0:66f3b5499f7f | 74 | self.repo_dirs = [] |
screamer | 0:66f3b5499f7f | 75 | self.repo_files = [] |
screamer | 0:66f3b5499f7f | 76 | |
screamer | 0:66f3b5499f7f | 77 | self.linker_script = None |
screamer | 0:66f3b5499f7f | 78 | |
screamer | 0:66f3b5499f7f | 79 | # Other files |
screamer | 0:66f3b5499f7f | 80 | self.hex_files = [] |
screamer | 0:66f3b5499f7f | 81 | self.bin_files = [] |
screamer | 0:66f3b5499f7f | 82 | |
screamer | 0:66f3b5499f7f | 83 | def add(self, resources): |
screamer | 0:66f3b5499f7f | 84 | self.inc_dirs += resources.inc_dirs |
screamer | 0:66f3b5499f7f | 85 | self.headers += resources.headers |
screamer | 0:66f3b5499f7f | 86 | |
screamer | 0:66f3b5499f7f | 87 | self.s_sources += resources.s_sources |
screamer | 0:66f3b5499f7f | 88 | self.c_sources += resources.c_sources |
screamer | 0:66f3b5499f7f | 89 | self.cpp_sources += resources.cpp_sources |
screamer | 0:66f3b5499f7f | 90 | |
screamer | 0:66f3b5499f7f | 91 | self.lib_dirs |= resources.lib_dirs |
screamer | 0:66f3b5499f7f | 92 | self.objects += resources.objects |
screamer | 0:66f3b5499f7f | 93 | self.libraries += resources.libraries |
screamer | 0:66f3b5499f7f | 94 | |
screamer | 0:66f3b5499f7f | 95 | self.lib_builds += resources.lib_builds |
screamer | 0:66f3b5499f7f | 96 | self.lib_refs += resources.lib_refs |
screamer | 0:66f3b5499f7f | 97 | |
screamer | 0:66f3b5499f7f | 98 | self.repo_dirs += resources.repo_dirs |
screamer | 0:66f3b5499f7f | 99 | self.repo_files += resources.repo_files |
screamer | 0:66f3b5499f7f | 100 | |
screamer | 0:66f3b5499f7f | 101 | if resources.linker_script is not None: |
screamer | 0:66f3b5499f7f | 102 | self.linker_script = resources.linker_script |
screamer | 0:66f3b5499f7f | 103 | |
screamer | 0:66f3b5499f7f | 104 | self.hex_files += resources.hex_files |
screamer | 0:66f3b5499f7f | 105 | self.bin_files += resources.bin_files |
screamer | 0:66f3b5499f7f | 106 | |
screamer | 0:66f3b5499f7f | 107 | def relative_to(self, base, dot=False): |
screamer | 0:66f3b5499f7f | 108 | for field in ['inc_dirs', 'headers', 's_sources', 'c_sources', |
screamer | 0:66f3b5499f7f | 109 | 'cpp_sources', 'lib_dirs', 'objects', 'libraries', |
screamer | 0:66f3b5499f7f | 110 | 'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files', 'hex_files', 'bin_files']: |
screamer | 0:66f3b5499f7f | 111 | v = [rel_path(f, base, dot) for f in getattr(self, field)] |
screamer | 0:66f3b5499f7f | 112 | setattr(self, field, v) |
screamer | 0:66f3b5499f7f | 113 | if self.linker_script is not None: |
screamer | 0:66f3b5499f7f | 114 | self.linker_script = rel_path(self.linker_script, base, dot) |
screamer | 0:66f3b5499f7f | 115 | |
screamer | 0:66f3b5499f7f | 116 | def win_to_unix(self): |
screamer | 0:66f3b5499f7f | 117 | for field in ['inc_dirs', 'headers', 's_sources', 'c_sources', |
screamer | 0:66f3b5499f7f | 118 | 'cpp_sources', 'lib_dirs', 'objects', 'libraries', |
screamer | 0:66f3b5499f7f | 119 | 'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files', 'hex_files', 'bin_files']: |
screamer | 0:66f3b5499f7f | 120 | v = [f.replace('\\', '/') for f in getattr(self, field)] |
screamer | 0:66f3b5499f7f | 121 | setattr(self, field, v) |
screamer | 0:66f3b5499f7f | 122 | if self.linker_script is not None: |
screamer | 0:66f3b5499f7f | 123 | self.linker_script = self.linker_script.replace('\\', '/') |
screamer | 0:66f3b5499f7f | 124 | |
screamer | 0:66f3b5499f7f | 125 | def __str__(self): |
screamer | 0:66f3b5499f7f | 126 | s = [] |
screamer | 0:66f3b5499f7f | 127 | |
screamer | 0:66f3b5499f7f | 128 | for (label, resources) in ( |
screamer | 0:66f3b5499f7f | 129 | ('Include Directories', self.inc_dirs), |
screamer | 0:66f3b5499f7f | 130 | ('Headers', self.headers), |
screamer | 0:66f3b5499f7f | 131 | |
screamer | 0:66f3b5499f7f | 132 | ('Assembly sources', self.s_sources), |
screamer | 0:66f3b5499f7f | 133 | ('C sources', self.c_sources), |
screamer | 0:66f3b5499f7f | 134 | ('C++ sources', self.cpp_sources), |
screamer | 0:66f3b5499f7f | 135 | |
screamer | 0:66f3b5499f7f | 136 | ('Library directories', self.lib_dirs), |
screamer | 0:66f3b5499f7f | 137 | ('Objects', self.objects), |
screamer | 0:66f3b5499f7f | 138 | ('Libraries', self.libraries), |
screamer | 0:66f3b5499f7f | 139 | |
screamer | 0:66f3b5499f7f | 140 | ('Hex files', self.hex_files), |
screamer | 0:66f3b5499f7f | 141 | ('Bin files', self.bin_files), |
screamer | 0:66f3b5499f7f | 142 | ): |
screamer | 0:66f3b5499f7f | 143 | if resources: |
screamer | 0:66f3b5499f7f | 144 | s.append('%s:\n ' % label + '\n '.join(resources)) |
screamer | 0:66f3b5499f7f | 145 | |
screamer | 0:66f3b5499f7f | 146 | if self.linker_script: |
screamer | 0:66f3b5499f7f | 147 | s.append('Linker Script: ' + self.linker_script) |
screamer | 0:66f3b5499f7f | 148 | |
screamer | 0:66f3b5499f7f | 149 | return '\n'.join(s) |
screamer | 0:66f3b5499f7f | 150 | |
screamer | 0:66f3b5499f7f | 151 | |
screamer | 0:66f3b5499f7f | 152 | # Support legacy build conventions: the original mbed build system did not have |
screamer | 0:66f3b5499f7f | 153 | # standard labels for the "TARGET_" and "TOOLCHAIN_" specific directories, but |
screamer | 0:66f3b5499f7f | 154 | # had the knowledge of a list of these directories to be ignored. |
screamer | 0:66f3b5499f7f | 155 | LEGACY_IGNORE_DIRS = set([ |
screamer | 0:66f3b5499f7f | 156 | 'LPC11U24', 'LPC1768', 'LPC2368', 'LPC4088', 'LPC812', 'KL25Z', |
screamer | 1:a99c8e460c5c | 157 | 'ARM', 'uARM', 'IAR', |
screamer | 1:a99c8e460c5c | 158 | 'GCC_ARM', 'GCC_CS', 'GCC_CR', 'GCC_CW', 'GCC_CW_EWL', 'GCC_CW_NEWLIB', |
screamer | 0:66f3b5499f7f | 159 | ]) |
screamer | 0:66f3b5499f7f | 160 | LEGACY_TOOLCHAIN_NAMES = { |
screamer | 0:66f3b5499f7f | 161 | 'ARM_STD':'ARM', 'ARM_MICRO': 'uARM', |
screamer | 1:a99c8e460c5c | 162 | 'GCC_ARM': 'GCC_ARM', 'GCC_CR': 'GCC_CS', |
screamer | 0:66f3b5499f7f | 163 | 'IAR': 'IAR', |
screamer | 0:66f3b5499f7f | 164 | } |
screamer | 0:66f3b5499f7f | 165 | |
screamer | 0:66f3b5499f7f | 166 | |
screamer | 0:66f3b5499f7f | 167 | class mbedToolchain: |
screamer | 1:a99c8e460c5c | 168 | PROFILE = None |
screamer | 0:66f3b5499f7f | 169 | VERBOSE = True |
screamer | 0:66f3b5499f7f | 170 | |
screamer | 0:66f3b5499f7f | 171 | CORTEX_SYMBOLS = { |
screamer | 0:66f3b5499f7f | 172 | "Cortex-M0" : ["__CORTEX_M0", "ARM_MATH_CM0", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], |
screamer | 0:66f3b5499f7f | 173 | "Cortex-M0+": ["__CORTEX_M0PLUS", "ARM_MATH_CM0PLUS", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], |
screamer | 0:66f3b5499f7f | 174 | "Cortex-M1" : ["__CORTEX_M3", "ARM_MATH_CM1"], |
screamer | 0:66f3b5499f7f | 175 | "Cortex-M3" : ["__CORTEX_M3", "ARM_MATH_CM3", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], |
screamer | 0:66f3b5499f7f | 176 | "Cortex-M4" : ["__CORTEX_M4", "ARM_MATH_CM4", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], |
screamer | 0:66f3b5499f7f | 177 | "Cortex-M4F" : ["__CORTEX_M4", "ARM_MATH_CM4", "__FPU_PRESENT=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], |
screamer | 0:66f3b5499f7f | 178 | "Cortex-M7" : ["__CORTEX_M7", "ARM_MATH_CM7", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], |
screamer | 0:66f3b5499f7f | 179 | "Cortex-M7F" : ["__CORTEX_M7", "ARM_MATH_CM7", "__FPU_PRESENT=1", "__CMSIS_RTOS", "__MBED_CMSIS_RTOS_CM"], |
screamer | 0:66f3b5499f7f | 180 | "Cortex-A9" : ["__CORTEX_A9", "ARM_MATH_CA9", "__FPU_PRESENT", "__CMSIS_RTOS", "__EVAL", "__MBED_CMSIS_RTOS_CA9"], |
screamer | 0:66f3b5499f7f | 181 | } |
screamer | 0:66f3b5499f7f | 182 | |
screamer | 0:66f3b5499f7f | 183 | GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%" |
screamer | 0:66f3b5499f7f | 184 | GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"') |
screamer | 0:66f3b5499f7f | 185 | |
screamer | 0:66f3b5499f7f | 186 | def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False): |
screamer | 0:66f3b5499f7f | 187 | self.target = target |
screamer | 0:66f3b5499f7f | 188 | self.name = self.__class__.__name__ |
screamer | 0:66f3b5499f7f | 189 | self.hook = hooks.Hook(target, self) |
screamer | 0:66f3b5499f7f | 190 | self.silent = silent |
screamer | 0:66f3b5499f7f | 191 | self.output = "" |
screamer | 0:66f3b5499f7f | 192 | |
screamer | 0:66f3b5499f7f | 193 | self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]]) |
screamer | 0:66f3b5499f7f | 194 | |
screamer | 0:66f3b5499f7f | 195 | if notify: |
screamer | 0:66f3b5499f7f | 196 | self.notify_fun = notify |
screamer | 0:66f3b5499f7f | 197 | elif extra_verbose: |
screamer | 0:66f3b5499f7f | 198 | self.notify_fun = self.print_notify_verbose |
screamer | 0:66f3b5499f7f | 199 | else: |
screamer | 0:66f3b5499f7f | 200 | self.notify_fun = self.print_notify |
screamer | 0:66f3b5499f7f | 201 | |
screamer | 0:66f3b5499f7f | 202 | self.options = options if options is not None else [] |
screamer | 0:66f3b5499f7f | 203 | |
screamer | 0:66f3b5499f7f | 204 | self.macros = macros or [] |
screamer | 0:66f3b5499f7f | 205 | self.options.extend(BUILD_OPTIONS) |
screamer | 0:66f3b5499f7f | 206 | if self.options: |
screamer | 0:66f3b5499f7f | 207 | self.info("Build Options: %s" % (', '.join(self.options))) |
screamer | 0:66f3b5499f7f | 208 | |
screamer | 0:66f3b5499f7f | 209 | self.obj_path = join("TARGET_"+target.name, "TOOLCHAIN_"+self.name) |
screamer | 0:66f3b5499f7f | 210 | |
screamer | 0:66f3b5499f7f | 211 | self.symbols = None |
screamer | 0:66f3b5499f7f | 212 | self.labels = None |
screamer | 0:66f3b5499f7f | 213 | self.has_config = False |
screamer | 0:66f3b5499f7f | 214 | |
screamer | 0:66f3b5499f7f | 215 | self.build_all = False |
screamer | 0:66f3b5499f7f | 216 | self.build_dir = None |
screamer | 0:66f3b5499f7f | 217 | self.timestamp = time() |
screamer | 0:66f3b5499f7f | 218 | self.jobs = 1 |
screamer | 0:66f3b5499f7f | 219 | |
screamer | 0:66f3b5499f7f | 220 | self.CHROOT = None |
screamer | 0:66f3b5499f7f | 221 | |
screamer | 0:66f3b5499f7f | 222 | self.mp_pool = None |
screamer | 0:66f3b5499f7f | 223 | |
screamer | 0:66f3b5499f7f | 224 | if 'UVISOR_PRESENT=1' in self.macros: |
screamer | 0:66f3b5499f7f | 225 | self.target.core = re.sub(r"F$", '', self.target.core) |
screamer | 0:66f3b5499f7f | 226 | |
screamer | 0:66f3b5499f7f | 227 | def get_output(self): |
screamer | 0:66f3b5499f7f | 228 | return self.output |
screamer | 0:66f3b5499f7f | 229 | |
screamer | 0:66f3b5499f7f | 230 | def print_notify(self, event, silent=False): |
screamer | 0:66f3b5499f7f | 231 | """ Default command line notification |
screamer | 0:66f3b5499f7f | 232 | """ |
screamer | 0:66f3b5499f7f | 233 | msg = None |
screamer | 0:66f3b5499f7f | 234 | |
screamer | 0:66f3b5499f7f | 235 | if event['type'] in ['info', 'debug']: |
screamer | 0:66f3b5499f7f | 236 | msg = event['message'] |
screamer | 0:66f3b5499f7f | 237 | |
screamer | 0:66f3b5499f7f | 238 | elif event['type'] == 'cc': |
screamer | 0:66f3b5499f7f | 239 | event['severity'] = event['severity'].title() |
screamer | 0:66f3b5499f7f | 240 | event['file'] = basename(event['file']) |
screamer | 0:66f3b5499f7f | 241 | msg = '[%(severity)s] %(file)s@%(line)s: %(message)s' % event |
screamer | 0:66f3b5499f7f | 242 | |
screamer | 0:66f3b5499f7f | 243 | elif event['type'] == 'progress': |
screamer | 0:66f3b5499f7f | 244 | if not silent: |
screamer | 0:66f3b5499f7f | 245 | msg = '%s: %s' % (event['action'].title(), basename(event['file'])) |
screamer | 0:66f3b5499f7f | 246 | |
screamer | 0:66f3b5499f7f | 247 | if msg: |
screamer | 0:66f3b5499f7f | 248 | print msg |
screamer | 0:66f3b5499f7f | 249 | self.output += msg + "\n" |
screamer | 0:66f3b5499f7f | 250 | |
screamer | 0:66f3b5499f7f | 251 | def print_notify_verbose(self, event, silent=False): |
screamer | 0:66f3b5499f7f | 252 | """ Default command line notification with more verbose mode |
screamer | 0:66f3b5499f7f | 253 | """ |
screamer | 0:66f3b5499f7f | 254 | if event['type'] in ['info', 'debug']: |
screamer | 0:66f3b5499f7f | 255 | self.print_notify(event) # standard handle |
screamer | 0:66f3b5499f7f | 256 | |
screamer | 0:66f3b5499f7f | 257 | elif event['type'] == 'cc': |
screamer | 0:66f3b5499f7f | 258 | event['severity'] = event['severity'].title() |
screamer | 0:66f3b5499f7f | 259 | event['file'] = basename(event['file']) |
screamer | 0:66f3b5499f7f | 260 | event['mcu_name'] = "None" |
screamer | 0:66f3b5499f7f | 261 | event['toolchain'] = "None" |
screamer | 0:66f3b5499f7f | 262 | event['target_name'] = event['target_name'].upper() if event['target_name'] else "Unknown" |
screamer | 0:66f3b5499f7f | 263 | event['toolchain_name'] = event['toolchain_name'].upper() if event['toolchain_name'] else "Unknown" |
screamer | 0:66f3b5499f7f | 264 | msg = '[%(severity)s] %(target_name)s::%(toolchain_name)s::%(file)s@%(line)s: %(message)s' % event |
screamer | 0:66f3b5499f7f | 265 | print msg |
screamer | 0:66f3b5499f7f | 266 | self.output += msg + "\n" |
screamer | 0:66f3b5499f7f | 267 | |
screamer | 0:66f3b5499f7f | 268 | elif event['type'] == 'progress': |
screamer | 0:66f3b5499f7f | 269 | self.print_notify(event) # standard handle |
screamer | 0:66f3b5499f7f | 270 | |
screamer | 0:66f3b5499f7f | 271 | def notify(self, event): |
screamer | 0:66f3b5499f7f | 272 | """ Little closure for notify functions |
screamer | 0:66f3b5499f7f | 273 | """ |
screamer | 0:66f3b5499f7f | 274 | return self.notify_fun(event, self.silent) |
screamer | 0:66f3b5499f7f | 275 | |
screamer | 0:66f3b5499f7f | 276 | def __exit__(self): |
screamer | 0:66f3b5499f7f | 277 | if self.mp_pool is not None: |
screamer | 0:66f3b5499f7f | 278 | self.mp_pool.terminate() |
screamer | 0:66f3b5499f7f | 279 | |
screamer | 0:66f3b5499f7f | 280 | def goanna_parse_line(self, line): |
screamer | 0:66f3b5499f7f | 281 | if "analyze" in self.options: |
screamer | 0:66f3b5499f7f | 282 | return self.GOANNA_DIAGNOSTIC_PATTERN.match(line) |
screamer | 0:66f3b5499f7f | 283 | else: |
screamer | 0:66f3b5499f7f | 284 | return None |
screamer | 0:66f3b5499f7f | 285 | |
screamer | 0:66f3b5499f7f | 286 | def get_symbols(self): |
screamer | 0:66f3b5499f7f | 287 | if self.symbols is None: |
screamer | 0:66f3b5499f7f | 288 | # Target and Toolchain symbols |
screamer | 0:66f3b5499f7f | 289 | labels = self.get_labels() |
screamer | 0:66f3b5499f7f | 290 | self.symbols = ["TARGET_%s" % t for t in labels['TARGET']] |
screamer | 0:66f3b5499f7f | 291 | self.symbols.extend(["TOOLCHAIN_%s" % t for t in labels['TOOLCHAIN']]) |
screamer | 0:66f3b5499f7f | 292 | |
screamer | 0:66f3b5499f7f | 293 | # Config support |
screamer | 0:66f3b5499f7f | 294 | if self.has_config: |
screamer | 0:66f3b5499f7f | 295 | self.symbols.append('HAVE_MBED_CONFIG_H') |
screamer | 0:66f3b5499f7f | 296 | |
screamer | 0:66f3b5499f7f | 297 | # Cortex CPU symbols |
screamer | 0:66f3b5499f7f | 298 | if self.target.core in mbedToolchain.CORTEX_SYMBOLS: |
screamer | 0:66f3b5499f7f | 299 | self.symbols.extend(mbedToolchain.CORTEX_SYMBOLS[self.target.core]) |
screamer | 0:66f3b5499f7f | 300 | |
screamer | 0:66f3b5499f7f | 301 | # Symbols defined by the on-line build.system |
screamer | 0:66f3b5499f7f | 302 | self.symbols.extend(['MBED_BUILD_TIMESTAMP=%s' % self.timestamp, 'TARGET_LIKE_MBED', '__MBED__=1']) |
screamer | 0:66f3b5499f7f | 303 | if MBED_ORG_USER: |
screamer | 0:66f3b5499f7f | 304 | self.symbols.append('MBED_USERNAME=' + MBED_ORG_USER) |
screamer | 0:66f3b5499f7f | 305 | |
screamer | 0:66f3b5499f7f | 306 | # Add target's symbols |
screamer | 0:66f3b5499f7f | 307 | self.symbols += self.target.macros |
screamer | 0:66f3b5499f7f | 308 | # Add extra symbols passed via 'macros' parameter |
screamer | 0:66f3b5499f7f | 309 | self.symbols += self.macros |
screamer | 0:66f3b5499f7f | 310 | |
screamer | 0:66f3b5499f7f | 311 | # Form factor variables |
screamer | 0:66f3b5499f7f | 312 | if hasattr(self.target, 'supported_form_factors'): |
screamer | 0:66f3b5499f7f | 313 | self.symbols.extend(["TARGET_FF_%s" % t for t in self.target.supported_form_factors]) |
screamer | 0:66f3b5499f7f | 314 | |
screamer | 0:66f3b5499f7f | 315 | return list(set(self.symbols)) # Return only unique symbols |
screamer | 0:66f3b5499f7f | 316 | |
screamer | 0:66f3b5499f7f | 317 | def get_labels(self): |
screamer | 0:66f3b5499f7f | 318 | if self.labels is None: |
screamer | 0:66f3b5499f7f | 319 | toolchain_labels = [c.__name__ for c in getmro(self.__class__)] |
screamer | 0:66f3b5499f7f | 320 | toolchain_labels.remove('mbedToolchain') |
screamer | 0:66f3b5499f7f | 321 | self.labels = { |
screamer | 0:66f3b5499f7f | 322 | 'TARGET': self.target.get_labels() + ["DEBUG" if "debug-info" in self.options else "RELEASE"], |
screamer | 0:66f3b5499f7f | 323 | 'TOOLCHAIN': toolchain_labels |
screamer | 0:66f3b5499f7f | 324 | } |
screamer | 0:66f3b5499f7f | 325 | return self.labels |
screamer | 0:66f3b5499f7f | 326 | |
screamer | 0:66f3b5499f7f | 327 | def need_update(self, target, dependencies): |
screamer | 0:66f3b5499f7f | 328 | if self.build_all: |
screamer | 0:66f3b5499f7f | 329 | return True |
screamer | 0:66f3b5499f7f | 330 | |
screamer | 0:66f3b5499f7f | 331 | if not exists(target): |
screamer | 0:66f3b5499f7f | 332 | return True |
screamer | 0:66f3b5499f7f | 333 | |
screamer | 0:66f3b5499f7f | 334 | target_mod_time = stat(target).st_mtime |
screamer | 0:66f3b5499f7f | 335 | |
screamer | 0:66f3b5499f7f | 336 | for d in dependencies: |
screamer | 0:66f3b5499f7f | 337 | |
screamer | 0:66f3b5499f7f | 338 | # Some objects are not provided with full path and here we do not have |
screamer | 0:66f3b5499f7f | 339 | # information about the library paths. Safe option: assume an update |
screamer | 0:66f3b5499f7f | 340 | if not d or not exists(d): |
screamer | 0:66f3b5499f7f | 341 | return True |
screamer | 0:66f3b5499f7f | 342 | |
screamer | 0:66f3b5499f7f | 343 | if stat(d).st_mtime >= target_mod_time: |
screamer | 0:66f3b5499f7f | 344 | return True |
screamer | 0:66f3b5499f7f | 345 | |
screamer | 0:66f3b5499f7f | 346 | return False |
screamer | 0:66f3b5499f7f | 347 | |
screamer | 0:66f3b5499f7f | 348 | def scan_resources(self, path, exclude_paths=None): |
screamer | 0:66f3b5499f7f | 349 | labels = self.get_labels() |
screamer | 0:66f3b5499f7f | 350 | resources = Resources(path) |
screamer | 0:66f3b5499f7f | 351 | self.has_config = False |
screamer | 0:66f3b5499f7f | 352 | |
screamer | 0:66f3b5499f7f | 353 | """ os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]]) |
screamer | 0:66f3b5499f7f | 354 | When topdown is True, the caller can modify the dirnames list in-place |
screamer | 0:66f3b5499f7f | 355 | (perhaps using del or slice assignment), and walk() will only recurse into |
screamer | 0:66f3b5499f7f | 356 | the subdirectories whose names remain in dirnames; this can be used to prune |
screamer | 0:66f3b5499f7f | 357 | the search, impose a specific order of visiting, or even to inform walk() |
screamer | 0:66f3b5499f7f | 358 | about directories the caller creates or renames before it resumes walk() |
screamer | 0:66f3b5499f7f | 359 | again. Modifying dirnames when topdown is False is ineffective, because in |
screamer | 0:66f3b5499f7f | 360 | bottom-up mode the directories in dirnames are generated before dirpath |
screamer | 0:66f3b5499f7f | 361 | itself is generated. |
screamer | 0:66f3b5499f7f | 362 | """ |
screamer | 0:66f3b5499f7f | 363 | for root, dirs, files in walk(path, followlinks=True): |
screamer | 0:66f3b5499f7f | 364 | # Remove ignored directories |
screamer | 0:66f3b5499f7f | 365 | for d in copy(dirs): |
screamer | 0:66f3b5499f7f | 366 | dir_path = join(root, d) |
screamer | 0:66f3b5499f7f | 367 | |
screamer | 0:66f3b5499f7f | 368 | if d == '.hg': |
screamer | 0:66f3b5499f7f | 369 | resources.repo_dirs.append(dir_path) |
screamer | 0:66f3b5499f7f | 370 | resources.repo_files.extend(self.scan_repository(dir_path)) |
screamer | 0:66f3b5499f7f | 371 | |
screamer | 0:66f3b5499f7f | 372 | if ((d.startswith('.') or d in self.legacy_ignore_dirs) or |
screamer | 0:66f3b5499f7f | 373 | ((d.upper().startswith('TARGET_') or d.upper().startswith('TARGET-')) and d[7:] not in labels['TARGET']) or |
screamer | 0:66f3b5499f7f | 374 | ((d.upper().startswith('TOOLCHAIN_') or d.upper().startswith('TOOLCHAIN-')) and d[10:] not in labels['TOOLCHAIN']) or |
screamer | 0:66f3b5499f7f | 375 | (d.upper() == 'TESTS') or |
screamer | 0:66f3b5499f7f | 376 | exists(join(dir_path, '.mbedignore'))): |
screamer | 0:66f3b5499f7f | 377 | dirs.remove(d) |
screamer | 0:66f3b5499f7f | 378 | |
screamer | 0:66f3b5499f7f | 379 | if exclude_paths: |
screamer | 0:66f3b5499f7f | 380 | for exclude_path in exclude_paths: |
screamer | 0:66f3b5499f7f | 381 | rel_path = relpath(dir_path, exclude_path) |
screamer | 0:66f3b5499f7f | 382 | if not (rel_path.startswith('..')): |
screamer | 0:66f3b5499f7f | 383 | dirs.remove(d) |
screamer | 0:66f3b5499f7f | 384 | break |
screamer | 0:66f3b5499f7f | 385 | |
screamer | 0:66f3b5499f7f | 386 | # Add root to include paths |
screamer | 0:66f3b5499f7f | 387 | resources.inc_dirs.append(root) |
screamer | 0:66f3b5499f7f | 388 | |
screamer | 0:66f3b5499f7f | 389 | for file in files: |
screamer | 0:66f3b5499f7f | 390 | file_path = join(root, file) |
screamer | 0:66f3b5499f7f | 391 | _, ext = splitext(file) |
screamer | 0:66f3b5499f7f | 392 | ext = ext.lower() |
screamer | 0:66f3b5499f7f | 393 | |
screamer | 0:66f3b5499f7f | 394 | if ext == '.s': |
screamer | 0:66f3b5499f7f | 395 | resources.s_sources.append(file_path) |
screamer | 0:66f3b5499f7f | 396 | |
screamer | 0:66f3b5499f7f | 397 | elif ext == '.c': |
screamer | 0:66f3b5499f7f | 398 | resources.c_sources.append(file_path) |
screamer | 0:66f3b5499f7f | 399 | |
screamer | 0:66f3b5499f7f | 400 | elif ext == '.cpp': |
screamer | 0:66f3b5499f7f | 401 | resources.cpp_sources.append(file_path) |
screamer | 0:66f3b5499f7f | 402 | |
screamer | 0:66f3b5499f7f | 403 | elif ext == '.h' or ext == '.hpp': |
screamer | 0:66f3b5499f7f | 404 | if basename(file_path) == "mbed_config.h": |
screamer | 0:66f3b5499f7f | 405 | self.has_config = True |
screamer | 0:66f3b5499f7f | 406 | resources.headers.append(file_path) |
screamer | 0:66f3b5499f7f | 407 | |
screamer | 0:66f3b5499f7f | 408 | elif ext == '.o': |
screamer | 0:66f3b5499f7f | 409 | resources.objects.append(file_path) |
screamer | 0:66f3b5499f7f | 410 | |
screamer | 0:66f3b5499f7f | 411 | elif ext == self.LIBRARY_EXT: |
screamer | 0:66f3b5499f7f | 412 | resources.libraries.append(file_path) |
screamer | 0:66f3b5499f7f | 413 | resources.lib_dirs.add(root) |
screamer | 0:66f3b5499f7f | 414 | |
screamer | 0:66f3b5499f7f | 415 | elif ext == self.LINKER_EXT: |
screamer | 0:66f3b5499f7f | 416 | if resources.linker_script is not None: |
screamer | 0:66f3b5499f7f | 417 | self.info("Warning: Multiple linker scripts detected: %s -> %s" % (resources.linker_script, file_path)) |
screamer | 0:66f3b5499f7f | 418 | resources.linker_script = file_path |
screamer | 0:66f3b5499f7f | 419 | |
screamer | 0:66f3b5499f7f | 420 | elif ext == '.lib': |
screamer | 0:66f3b5499f7f | 421 | resources.lib_refs.append(file_path) |
screamer | 0:66f3b5499f7f | 422 | |
screamer | 0:66f3b5499f7f | 423 | elif ext == '.bld': |
screamer | 0:66f3b5499f7f | 424 | resources.lib_builds.append(file_path) |
screamer | 0:66f3b5499f7f | 425 | |
screamer | 0:66f3b5499f7f | 426 | elif file == '.hgignore': |
screamer | 0:66f3b5499f7f | 427 | resources.repo_files.append(file_path) |
screamer | 0:66f3b5499f7f | 428 | |
screamer | 0:66f3b5499f7f | 429 | elif ext == '.hex': |
screamer | 0:66f3b5499f7f | 430 | resources.hex_files.append(file_path) |
screamer | 0:66f3b5499f7f | 431 | |
screamer | 0:66f3b5499f7f | 432 | elif ext == '.bin': |
screamer | 0:66f3b5499f7f | 433 | resources.bin_files.append(file_path) |
screamer | 0:66f3b5499f7f | 434 | |
screamer | 0:66f3b5499f7f | 435 | return resources |
screamer | 0:66f3b5499f7f | 436 | |
screamer | 0:66f3b5499f7f | 437 | def scan_repository(self, path): |
screamer | 0:66f3b5499f7f | 438 | resources = [] |
screamer | 0:66f3b5499f7f | 439 | |
screamer | 0:66f3b5499f7f | 440 | for root, dirs, files in walk(path): |
screamer | 0:66f3b5499f7f | 441 | # Remove ignored directories |
screamer | 0:66f3b5499f7f | 442 | for d in copy(dirs): |
screamer | 0:66f3b5499f7f | 443 | if d == '.' or d == '..': |
screamer | 0:66f3b5499f7f | 444 | dirs.remove(d) |
screamer | 0:66f3b5499f7f | 445 | |
screamer | 0:66f3b5499f7f | 446 | for file in files: |
screamer | 0:66f3b5499f7f | 447 | file_path = join(root, file) |
screamer | 0:66f3b5499f7f | 448 | resources.append(file_path) |
screamer | 0:66f3b5499f7f | 449 | |
screamer | 0:66f3b5499f7f | 450 | return resources |
screamer | 0:66f3b5499f7f | 451 | |
screamer | 0:66f3b5499f7f | 452 | def copy_files(self, files_paths, trg_path, rel_path=None): |
screamer | 0:66f3b5499f7f | 453 | |
screamer | 0:66f3b5499f7f | 454 | # Handle a single file |
screamer | 0:66f3b5499f7f | 455 | if type(files_paths) != ListType: files_paths = [files_paths] |
screamer | 0:66f3b5499f7f | 456 | |
screamer | 0:66f3b5499f7f | 457 | for source in files_paths: |
screamer | 0:66f3b5499f7f | 458 | if source is None: |
screamer | 0:66f3b5499f7f | 459 | files_paths.remove(source) |
screamer | 0:66f3b5499f7f | 460 | |
screamer | 0:66f3b5499f7f | 461 | for source in files_paths: |
screamer | 0:66f3b5499f7f | 462 | if rel_path is not None: |
screamer | 0:66f3b5499f7f | 463 | relative_path = relpath(source, rel_path) |
screamer | 0:66f3b5499f7f | 464 | else: |
screamer | 0:66f3b5499f7f | 465 | _, relative_path = split(source) |
screamer | 0:66f3b5499f7f | 466 | |
screamer | 0:66f3b5499f7f | 467 | target = join(trg_path, relative_path) |
screamer | 0:66f3b5499f7f | 468 | |
screamer | 0:66f3b5499f7f | 469 | if (target != source) and (self.need_update(target, [source])): |
screamer | 0:66f3b5499f7f | 470 | self.progress("copy", relative_path) |
screamer | 0:66f3b5499f7f | 471 | mkdir(dirname(target)) |
screamer | 0:66f3b5499f7f | 472 | copyfile(source, target) |
screamer | 0:66f3b5499f7f | 473 | |
screamer | 0:66f3b5499f7f | 474 | def relative_object_path(self, build_path, base_dir, source): |
screamer | 0:66f3b5499f7f | 475 | source_dir, name, _ = split_path(source) |
screamer | 0:66f3b5499f7f | 476 | |
screamer | 0:66f3b5499f7f | 477 | obj_dir = join(build_path, relpath(source_dir, base_dir)) |
screamer | 0:66f3b5499f7f | 478 | mkdir(obj_dir) |
screamer | 0:66f3b5499f7f | 479 | return join(obj_dir, name + '.o') |
screamer | 0:66f3b5499f7f | 480 | |
screamer | 0:66f3b5499f7f | 481 | def get_inc_file(self, includes): |
screamer | 0:66f3b5499f7f | 482 | include_file = join(self.build_dir, ".includes_%s.txt" % self.inc_md5) |
screamer | 0:66f3b5499f7f | 483 | if not exists(include_file): |
screamer | 0:66f3b5499f7f | 484 | with open(include_file, "wb") as f: |
screamer | 0:66f3b5499f7f | 485 | cmd_list = [] |
screamer | 0:66f3b5499f7f | 486 | for c in includes: |
screamer | 0:66f3b5499f7f | 487 | if c: |
screamer | 0:66f3b5499f7f | 488 | cmd_list.append(('-I%s' % c).replace("\\", "/")) |
screamer | 0:66f3b5499f7f | 489 | string = " ".join(cmd_list) |
screamer | 0:66f3b5499f7f | 490 | f.write(string) |
screamer | 0:66f3b5499f7f | 491 | return include_file |
screamer | 0:66f3b5499f7f | 492 | |
screamer | 0:66f3b5499f7f | 493 | def compile_sources(self, resources, build_path, inc_dirs=None): |
screamer | 0:66f3b5499f7f | 494 | # Web IDE progress bar for project build |
screamer | 0:66f3b5499f7f | 495 | files_to_compile = resources.s_sources + resources.c_sources + resources.cpp_sources |
screamer | 0:66f3b5499f7f | 496 | self.to_be_compiled = len(files_to_compile) |
screamer | 0:66f3b5499f7f | 497 | self.compiled = 0 |
screamer | 0:66f3b5499f7f | 498 | |
screamer | 0:66f3b5499f7f | 499 | inc_paths = resources.inc_dirs |
screamer | 0:66f3b5499f7f | 500 | if inc_dirs is not None: |
screamer | 0:66f3b5499f7f | 501 | inc_paths.extend(inc_dirs) |
screamer | 0:66f3b5499f7f | 502 | # De-duplicate include paths |
screamer | 0:66f3b5499f7f | 503 | inc_paths = set(inc_paths) |
screamer | 0:66f3b5499f7f | 504 | # Sort include paths for consistency |
screamer | 0:66f3b5499f7f | 505 | inc_paths = sorted(set(inc_paths)) |
screamer | 0:66f3b5499f7f | 506 | # Unique id of all include paths |
screamer | 0:66f3b5499f7f | 507 | self.inc_md5 = md5(' '.join(inc_paths)).hexdigest() |
screamer | 0:66f3b5499f7f | 508 | # Where to store response files |
screamer | 0:66f3b5499f7f | 509 | self.build_dir = build_path |
screamer | 0:66f3b5499f7f | 510 | |
screamer | 0:66f3b5499f7f | 511 | objects = [] |
screamer | 0:66f3b5499f7f | 512 | queue = [] |
screamer | 0:66f3b5499f7f | 513 | prev_dir = None |
screamer | 0:66f3b5499f7f | 514 | |
screamer | 0:66f3b5499f7f | 515 | # The dependency checking for C/C++ is delegated to the compiler |
screamer | 0:66f3b5499f7f | 516 | base_path = resources.base_path |
screamer | 0:66f3b5499f7f | 517 | # Sort compile queue for consistency |
screamer | 0:66f3b5499f7f | 518 | files_to_compile.sort() |
screamer | 0:66f3b5499f7f | 519 | work_dir = getcwd() |
screamer | 0:66f3b5499f7f | 520 | |
screamer | 0:66f3b5499f7f | 521 | for source in files_to_compile: |
screamer | 0:66f3b5499f7f | 522 | _, name, _ = split_path(source) |
screamer | 0:66f3b5499f7f | 523 | object = self.relative_object_path(build_path, base_path, source) |
screamer | 0:66f3b5499f7f | 524 | |
screamer | 0:66f3b5499f7f | 525 | # Queue mode (multiprocessing) |
screamer | 0:66f3b5499f7f | 526 | commands = self.compile_command(source, object, inc_paths) |
screamer | 0:66f3b5499f7f | 527 | if commands is not None: |
screamer | 0:66f3b5499f7f | 528 | queue.append({ |
screamer | 0:66f3b5499f7f | 529 | 'source': source, |
screamer | 0:66f3b5499f7f | 530 | 'object': object, |
screamer | 0:66f3b5499f7f | 531 | 'commands': commands, |
screamer | 0:66f3b5499f7f | 532 | 'work_dir': work_dir, |
screamer | 0:66f3b5499f7f | 533 | 'chroot': self.CHROOT |
screamer | 0:66f3b5499f7f | 534 | }) |
screamer | 0:66f3b5499f7f | 535 | else: |
screamer | 0:66f3b5499f7f | 536 | objects.append(object) |
screamer | 0:66f3b5499f7f | 537 | |
screamer | 0:66f3b5499f7f | 538 | # Use queues/multiprocessing if cpu count is higher than setting |
screamer | 0:66f3b5499f7f | 539 | jobs = self.jobs if self.jobs else cpu_count() |
screamer | 0:66f3b5499f7f | 540 | if jobs > CPU_COUNT_MIN and len(queue) > jobs: |
screamer | 0:66f3b5499f7f | 541 | return self.compile_queue(queue, objects) |
screamer | 0:66f3b5499f7f | 542 | else: |
screamer | 0:66f3b5499f7f | 543 | return self.compile_seq(queue, objects) |
screamer | 0:66f3b5499f7f | 544 | |
screamer | 0:66f3b5499f7f | 545 | def compile_seq(self, queue, objects): |
screamer | 0:66f3b5499f7f | 546 | for item in queue: |
screamer | 0:66f3b5499f7f | 547 | result = compile_worker(item) |
screamer | 0:66f3b5499f7f | 548 | |
screamer | 0:66f3b5499f7f | 549 | self.compiled += 1 |
screamer | 0:66f3b5499f7f | 550 | self.progress("compile", item['source'], build_update=True) |
screamer | 0:66f3b5499f7f | 551 | for res in result['results']: |
screamer | 0:66f3b5499f7f | 552 | self.debug("Command: %s" % ' '.join(res['command'])) |
screamer | 0:66f3b5499f7f | 553 | self.compile_output([ |
screamer | 0:66f3b5499f7f | 554 | res['code'], |
screamer | 0:66f3b5499f7f | 555 | res['output'], |
screamer | 0:66f3b5499f7f | 556 | res['command'] |
screamer | 0:66f3b5499f7f | 557 | ]) |
screamer | 0:66f3b5499f7f | 558 | objects.append(result['object']) |
screamer | 0:66f3b5499f7f | 559 | return objects |
screamer | 0:66f3b5499f7f | 560 | |
screamer | 0:66f3b5499f7f | 561 | def compile_queue(self, queue, objects): |
screamer | 0:66f3b5499f7f | 562 | jobs_count = int(self.jobs if self.jobs else cpu_count()) |
screamer | 0:66f3b5499f7f | 563 | p = Pool(processes=jobs_count) |
screamer | 0:66f3b5499f7f | 564 | |
screamer | 0:66f3b5499f7f | 565 | results = [] |
screamer | 0:66f3b5499f7f | 566 | for i in range(len(queue)): |
screamer | 0:66f3b5499f7f | 567 | results.append(p.apply_async(compile_worker, [queue[i]])) |
screamer | 0:66f3b5499f7f | 568 | |
screamer | 0:66f3b5499f7f | 569 | itr = 0 |
screamer | 0:66f3b5499f7f | 570 | while True: |
screamer | 0:66f3b5499f7f | 571 | itr += 1 |
screamer | 0:66f3b5499f7f | 572 | if itr > 180000: |
screamer | 0:66f3b5499f7f | 573 | p.terminate() |
screamer | 0:66f3b5499f7f | 574 | p.join() |
screamer | 0:66f3b5499f7f | 575 | raise ToolException("Compile did not finish in 5 minutes") |
screamer | 0:66f3b5499f7f | 576 | |
screamer | 0:66f3b5499f7f | 577 | pending = 0 |
screamer | 0:66f3b5499f7f | 578 | for r in results: |
screamer | 0:66f3b5499f7f | 579 | if r._ready is True: |
screamer | 0:66f3b5499f7f | 580 | try: |
screamer | 0:66f3b5499f7f | 581 | result = r.get() |
screamer | 0:66f3b5499f7f | 582 | results.remove(r) |
screamer | 0:66f3b5499f7f | 583 | |
screamer | 0:66f3b5499f7f | 584 | self.compiled += 1 |
screamer | 0:66f3b5499f7f | 585 | self.progress("compile", result['source'], build_update=True) |
screamer | 0:66f3b5499f7f | 586 | for res in result['results']: |
screamer | 0:66f3b5499f7f | 587 | self.debug("Command: %s" % ' '.join(res['command'])) |
screamer | 0:66f3b5499f7f | 588 | self.compile_output([ |
screamer | 0:66f3b5499f7f | 589 | res['code'], |
screamer | 0:66f3b5499f7f | 590 | res['output'], |
screamer | 0:66f3b5499f7f | 591 | res['command'] |
screamer | 0:66f3b5499f7f | 592 | ]) |
screamer | 0:66f3b5499f7f | 593 | objects.append(result['object']) |
screamer | 0:66f3b5499f7f | 594 | except ToolException, err: |
screamer | 0:66f3b5499f7f | 595 | p.terminate() |
screamer | 0:66f3b5499f7f | 596 | p.join() |
screamer | 0:66f3b5499f7f | 597 | raise ToolException(err) |
screamer | 0:66f3b5499f7f | 598 | else: |
screamer | 0:66f3b5499f7f | 599 | pending += 1 |
screamer | 0:66f3b5499f7f | 600 | if pending > jobs_count: |
screamer | 0:66f3b5499f7f | 601 | break |
screamer | 0:66f3b5499f7f | 602 | |
screamer | 0:66f3b5499f7f | 603 | |
screamer | 0:66f3b5499f7f | 604 | if len(results) == 0: |
screamer | 0:66f3b5499f7f | 605 | break |
screamer | 0:66f3b5499f7f | 606 | |
screamer | 0:66f3b5499f7f | 607 | sleep(0.01) |
screamer | 0:66f3b5499f7f | 608 | |
screamer | 0:66f3b5499f7f | 609 | results = None |
screamer | 0:66f3b5499f7f | 610 | p.terminate() |
screamer | 0:66f3b5499f7f | 611 | p.join() |
screamer | 0:66f3b5499f7f | 612 | |
screamer | 0:66f3b5499f7f | 613 | return objects |
screamer | 0:66f3b5499f7f | 614 | |
screamer | 0:66f3b5499f7f | 615 | def compile_command(self, source, object, includes): |
screamer | 0:66f3b5499f7f | 616 | # Check dependencies |
screamer | 0:66f3b5499f7f | 617 | _, ext = splitext(source) |
screamer | 0:66f3b5499f7f | 618 | ext = ext.lower() |
screamer | 0:66f3b5499f7f | 619 | |
screamer | 0:66f3b5499f7f | 620 | if ext == '.c' or ext == '.cpp': |
screamer | 0:66f3b5499f7f | 621 | base, _ = splitext(object) |
screamer | 0:66f3b5499f7f | 622 | dep_path = base + '.d' |
screamer | 0:66f3b5499f7f | 623 | deps = self.parse_dependencies(dep_path) if (exists(dep_path)) else [] |
screamer | 0:66f3b5499f7f | 624 | if len(deps) == 0 or self.need_update(object, deps): |
screamer | 0:66f3b5499f7f | 625 | if ext == '.c': |
screamer | 0:66f3b5499f7f | 626 | return self.compile_c(source, object, includes) |
screamer | 0:66f3b5499f7f | 627 | else: |
screamer | 0:66f3b5499f7f | 628 | return self.compile_cpp(source, object, includes) |
screamer | 0:66f3b5499f7f | 629 | elif ext == '.s': |
screamer | 0:66f3b5499f7f | 630 | deps = [source] |
screamer | 0:66f3b5499f7f | 631 | if self.need_update(object, deps): |
screamer | 0:66f3b5499f7f | 632 | return self.assemble(source, object, includes) |
screamer | 0:66f3b5499f7f | 633 | else: |
screamer | 0:66f3b5499f7f | 634 | return False |
screamer | 0:66f3b5499f7f | 635 | |
screamer | 0:66f3b5499f7f | 636 | return None |
screamer | 0:66f3b5499f7f | 637 | |
screamer | 0:66f3b5499f7f | 638 | def is_not_supported_error(self, output): |
screamer | 0:66f3b5499f7f | 639 | return "#error directive: [NOT_SUPPORTED]" in output |
screamer | 0:66f3b5499f7f | 640 | |
screamer | 0:66f3b5499f7f | 641 | def compile_output(self, output=[]): |
screamer | 0:66f3b5499f7f | 642 | _rc = output[0] |
screamer | 0:66f3b5499f7f | 643 | _stderr = output[1] |
screamer | 0:66f3b5499f7f | 644 | command = output[2] |
screamer | 0:66f3b5499f7f | 645 | |
screamer | 0:66f3b5499f7f | 646 | # Parse output for Warnings and Errors |
screamer | 0:66f3b5499f7f | 647 | self.parse_output(_stderr) |
screamer | 0:66f3b5499f7f | 648 | self.debug("Return: %s"% _rc) |
screamer | 0:66f3b5499f7f | 649 | for error_line in _stderr.splitlines(): |
screamer | 0:66f3b5499f7f | 650 | self.debug("Output: %s"% error_line) |
screamer | 0:66f3b5499f7f | 651 | |
screamer | 0:66f3b5499f7f | 652 | |
screamer | 0:66f3b5499f7f | 653 | # Check return code |
screamer | 0:66f3b5499f7f | 654 | if _rc != 0: |
screamer | 0:66f3b5499f7f | 655 | for line in _stderr.splitlines(): |
screamer | 0:66f3b5499f7f | 656 | self.tool_error(line) |
screamer | 0:66f3b5499f7f | 657 | |
screamer | 0:66f3b5499f7f | 658 | if self.is_not_supported_error(_stderr): |
screamer | 0:66f3b5499f7f | 659 | raise NotSupportedException(_stderr) |
screamer | 0:66f3b5499f7f | 660 | else: |
screamer | 0:66f3b5499f7f | 661 | raise ToolException(_stderr) |
screamer | 0:66f3b5499f7f | 662 | |
screamer | 0:66f3b5499f7f | 663 | def build_library(self, objects, dir, name): |
screamer | 0:66f3b5499f7f | 664 | needed_update = False |
screamer | 0:66f3b5499f7f | 665 | lib = self.STD_LIB_NAME % name |
screamer | 0:66f3b5499f7f | 666 | fout = join(dir, lib) |
screamer | 0:66f3b5499f7f | 667 | if self.need_update(fout, objects): |
screamer | 0:66f3b5499f7f | 668 | self.info("Library: %s" % lib) |
screamer | 0:66f3b5499f7f | 669 | self.archive(objects, fout) |
screamer | 0:66f3b5499f7f | 670 | needed_update = True |
screamer | 0:66f3b5499f7f | 671 | |
screamer | 0:66f3b5499f7f | 672 | return needed_update |
screamer | 0:66f3b5499f7f | 673 | |
screamer | 0:66f3b5499f7f | 674 | def link_program(self, r, tmp_path, name): |
screamer | 0:66f3b5499f7f | 675 | needed_update = False |
screamer | 0:66f3b5499f7f | 676 | ext = 'bin' |
screamer | 0:66f3b5499f7f | 677 | if hasattr(self.target, 'OUTPUT_EXT'): |
screamer | 0:66f3b5499f7f | 678 | ext = self.target.OUTPUT_EXT |
screamer | 0:66f3b5499f7f | 679 | |
screamer | 0:66f3b5499f7f | 680 | if hasattr(self.target, 'OUTPUT_NAMING'): |
screamer | 0:66f3b5499f7f | 681 | self.var("binary_naming", self.target.OUTPUT_NAMING) |
screamer | 0:66f3b5499f7f | 682 | if self.target.OUTPUT_NAMING == "8.3": |
screamer | 0:66f3b5499f7f | 683 | name = name[0:8] |
screamer | 0:66f3b5499f7f | 684 | ext = ext[0:3] |
screamer | 0:66f3b5499f7f | 685 | |
screamer | 0:66f3b5499f7f | 686 | # Create destination directory |
screamer | 0:66f3b5499f7f | 687 | head, tail = split(name) |
screamer | 0:66f3b5499f7f | 688 | new_path = join(tmp_path, head) |
screamer | 0:66f3b5499f7f | 689 | mkdir(new_path) |
screamer | 0:66f3b5499f7f | 690 | |
screamer | 0:66f3b5499f7f | 691 | filename = name+'.'+ext |
screamer | 0:66f3b5499f7f | 692 | elf = join(tmp_path, name + '.elf') |
screamer | 0:66f3b5499f7f | 693 | bin = join(tmp_path, filename) |
screamer | 0:66f3b5499f7f | 694 | |
screamer | 0:66f3b5499f7f | 695 | if self.need_update(elf, r.objects + r.libraries + [r.linker_script]): |
screamer | 0:66f3b5499f7f | 696 | needed_update = True |
screamer | 0:66f3b5499f7f | 697 | self.progress("link", name) |
screamer | 0:66f3b5499f7f | 698 | self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script) |
screamer | 0:66f3b5499f7f | 699 | |
screamer | 0:66f3b5499f7f | 700 | if self.need_update(bin, [elf]): |
screamer | 0:66f3b5499f7f | 701 | needed_update = True |
screamer | 0:66f3b5499f7f | 702 | self.progress("elf2bin", name) |
screamer | 0:66f3b5499f7f | 703 | |
screamer | 0:66f3b5499f7f | 704 | self.binary(r, elf, bin) |
screamer | 0:66f3b5499f7f | 705 | |
screamer | 0:66f3b5499f7f | 706 | self.var("compile_succeded", True) |
screamer | 0:66f3b5499f7f | 707 | self.var("binary", filename) |
screamer | 0:66f3b5499f7f | 708 | |
screamer | 0:66f3b5499f7f | 709 | return bin, needed_update |
screamer | 0:66f3b5499f7f | 710 | |
screamer | 0:66f3b5499f7f | 711 | def default_cmd(self, command): |
screamer | 0:66f3b5499f7f | 712 | self.debug("Command: %s"% ' '.join(command)) |
screamer | 0:66f3b5499f7f | 713 | _stdout, _stderr, _rc = run_cmd(command) |
screamer | 0:66f3b5499f7f | 714 | # Print all warning / erros from stderr to console output |
screamer | 0:66f3b5499f7f | 715 | for error_line in _stderr.splitlines(): |
screamer | 0:66f3b5499f7f | 716 | print error_line |
screamer | 0:66f3b5499f7f | 717 | |
screamer | 0:66f3b5499f7f | 718 | self.debug("Return: %s"% _rc) |
screamer | 0:66f3b5499f7f | 719 | |
screamer | 0:66f3b5499f7f | 720 | for output_line in _stdout.splitlines(): |
screamer | 0:66f3b5499f7f | 721 | self.debug("Output: %s"% output_line) |
screamer | 0:66f3b5499f7f | 722 | for error_line in _stderr.splitlines(): |
screamer | 0:66f3b5499f7f | 723 | self.debug("Errors: %s"% error_line) |
screamer | 0:66f3b5499f7f | 724 | |
screamer | 0:66f3b5499f7f | 725 | if _rc != 0: |
screamer | 0:66f3b5499f7f | 726 | for line in _stderr.splitlines(): |
screamer | 0:66f3b5499f7f | 727 | self.tool_error(line) |
screamer | 0:66f3b5499f7f | 728 | raise ToolException(_stderr) |
screamer | 0:66f3b5499f7f | 729 | |
screamer | 0:66f3b5499f7f | 730 | ### NOTIFICATIONS ### |
screamer | 0:66f3b5499f7f | 731 | def info(self, message): |
screamer | 0:66f3b5499f7f | 732 | self.notify({'type': 'info', 'message': message}) |
screamer | 0:66f3b5499f7f | 733 | |
screamer | 0:66f3b5499f7f | 734 | def debug(self, message): |
screamer | 0:66f3b5499f7f | 735 | if self.VERBOSE: |
screamer | 0:66f3b5499f7f | 736 | if type(message) is ListType: |
screamer | 0:66f3b5499f7f | 737 | message = ' '.join(message) |
screamer | 0:66f3b5499f7f | 738 | message = "[DEBUG] " + message |
screamer | 0:66f3b5499f7f | 739 | self.notify({'type': 'debug', 'message': message}) |
screamer | 0:66f3b5499f7f | 740 | |
screamer | 0:66f3b5499f7f | 741 | def cc_info(self, severity, file, line, message, target_name=None, toolchain_name=None): |
screamer | 0:66f3b5499f7f | 742 | self.notify({'type': 'cc', |
screamer | 0:66f3b5499f7f | 743 | 'severity': severity, |
screamer | 0:66f3b5499f7f | 744 | 'file': file, |
screamer | 0:66f3b5499f7f | 745 | 'line': line, |
screamer | 0:66f3b5499f7f | 746 | 'message': message, |
screamer | 0:66f3b5499f7f | 747 | 'target_name': target_name, |
screamer | 0:66f3b5499f7f | 748 | 'toolchain_name': toolchain_name}) |
screamer | 0:66f3b5499f7f | 749 | |
screamer | 0:66f3b5499f7f | 750 | def progress(self, action, file, build_update=False): |
screamer | 0:66f3b5499f7f | 751 | msg = {'type': 'progress', 'action': action, 'file': file} |
screamer | 0:66f3b5499f7f | 752 | if build_update: |
screamer | 0:66f3b5499f7f | 753 | msg['percent'] = 100. * float(self.compiled) / float(self.to_be_compiled) |
screamer | 0:66f3b5499f7f | 754 | self.notify(msg) |
screamer | 0:66f3b5499f7f | 755 | |
screamer | 0:66f3b5499f7f | 756 | def tool_error(self, message): |
screamer | 0:66f3b5499f7f | 757 | self.notify({'type': 'tool_error', 'message': message}) |
screamer | 0:66f3b5499f7f | 758 | |
screamer | 0:66f3b5499f7f | 759 | def var(self, key, value): |
screamer | 0:66f3b5499f7f | 760 | self.notify({'type': 'var', 'key': key, 'val': value}) |
screamer | 0:66f3b5499f7f | 761 | |
screamer | 0:66f3b5499f7f | 762 | from tools.settings import ARM_BIN |
screamer | 0:66f3b5499f7f | 763 | from tools.settings import GCC_ARM_PATH, GCC_CR_PATH |
screamer | 0:66f3b5499f7f | 764 | from tools.settings import IAR_PATH |
screamer | 0:66f3b5499f7f | 765 | |
screamer | 0:66f3b5499f7f | 766 | TOOLCHAIN_BIN_PATH = { |
screamer | 0:66f3b5499f7f | 767 | 'ARM': ARM_BIN, |
screamer | 0:66f3b5499f7f | 768 | 'uARM': ARM_BIN, |
screamer | 0:66f3b5499f7f | 769 | 'GCC_ARM': GCC_ARM_PATH, |
screamer | 0:66f3b5499f7f | 770 | 'GCC_CR': GCC_CR_PATH, |
screamer | 0:66f3b5499f7f | 771 | 'IAR': IAR_PATH |
screamer | 0:66f3b5499f7f | 772 | } |
screamer | 0:66f3b5499f7f | 773 | |
screamer | 0:66f3b5499f7f | 774 | from tools.toolchains.arm import ARM_STD, ARM_MICRO |
screamer | 0:66f3b5499f7f | 775 | from tools.toolchains.gcc import GCC_ARM, GCC_CR |
screamer | 0:66f3b5499f7f | 776 | from tools.toolchains.iar import IAR |
screamer | 0:66f3b5499f7f | 777 | |
screamer | 0:66f3b5499f7f | 778 | TOOLCHAIN_CLASSES = { |
screamer | 0:66f3b5499f7f | 779 | 'ARM': ARM_STD, |
screamer | 0:66f3b5499f7f | 780 | 'uARM': ARM_MICRO, |
screamer | 0:66f3b5499f7f | 781 | 'GCC_ARM': GCC_ARM, |
screamer | 0:66f3b5499f7f | 782 | 'GCC_CR': GCC_CR, |
screamer | 0:66f3b5499f7f | 783 | 'IAR': IAR |
screamer | 0:66f3b5499f7f | 784 | } |
screamer | 0:66f3b5499f7f | 785 | |
screamer | 0:66f3b5499f7f | 786 | TOOLCHAINS = set(TOOLCHAIN_CLASSES.keys()) |
screamer | 1:a99c8e460c5c | 787 | |
screamer | 1:a99c8e460c5c | 788 | # Toolchain profiles for backward compatibility with old mbed SDK library releases |
screamer | 1:a99c8e460c5c | 789 | TOOLCHAIN_PROFILES = { |
screamer | 1:a99c8e460c5c | 790 | 'uARM' : { |
screamer | 1:a99c8e460c5c | 791 | 'v5': { |
screamer | 1:a99c8e460c5c | 792 | 'ARMCC_VERSION': '5.06', |
screamer | 1:a99c8e460c5c | 793 | 'COMMON_FLAGS':['-c', '--gnu', '-O3', '-Otime', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 794 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 795 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 796 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 797 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 798 | 'PATCHED_LIBRARY' : False, |
screamer | 1:a99c8e460c5c | 799 | }, |
screamer | 1:a99c8e460c5c | 800 | 'v4': { |
screamer | 1:a99c8e460c5c | 801 | 'ARMCC_VERSION': '5.03', |
screamer | 1:a99c8e460c5c | 802 | 'COMMON_FLAGS':['-c', '--gnu', '-O3', '-Otime', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 803 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 804 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 805 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 806 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 807 | 'PATCHED_LIBRARY' : False, |
screamer | 1:a99c8e460c5c | 808 | }, |
screamer | 1:a99c8e460c5c | 809 | |
screamer | 1:a99c8e460c5c | 810 | 'v3': { |
screamer | 1:a99c8e460c5c | 811 | 'ARMCC_VERSION': '5.01', |
screamer | 1:a99c8e460c5c | 812 | 'COMMON_FLAGS':['-c', '--gnu', '-Ospace', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 813 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 814 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 815 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 816 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 817 | 'PATCHED_LIBRARY' : False, |
screamer | 1:a99c8e460c5c | 818 | }, |
screamer | 1:a99c8e460c5c | 819 | |
screamer | 1:a99c8e460c5c | 820 | 'v2': { |
screamer | 1:a99c8e460c5c | 821 | 'ARMCC_VERSION': '4', |
screamer | 1:a99c8e460c5c | 822 | 'COMMON_FLAGS':['-c', '--gnu', '-Ospace', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 823 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 824 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 825 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 826 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 827 | 'PATCHED_LIBRARY' : True, |
screamer | 1:a99c8e460c5c | 828 | }, |
screamer | 1:a99c8e460c5c | 829 | |
screamer | 1:a99c8e460c5c | 830 | 'v1': { |
screamer | 1:a99c8e460c5c | 831 | 'ARMCC_VERSION': '4', |
screamer | 1:a99c8e460c5c | 832 | 'COMMON_FLAGS':['-c', '--gnu', '-Otime', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 833 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 834 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 835 | 'COMMON_CPP_FLAGS':['--cpp'], |
screamer | 1:a99c8e460c5c | 836 | 'COMPILE_C_AS_CPP': True, |
screamer | 1:a99c8e460c5c | 837 | 'PATCHED_LIBRARY' : True, |
screamer | 1:a99c8e460c5c | 838 | } |
screamer | 1:a99c8e460c5c | 839 | }, |
screamer | 1:a99c8e460c5c | 840 | 'ARM' : { |
screamer | 1:a99c8e460c5c | 841 | 'v5': { |
screamer | 1:a99c8e460c5c | 842 | 'ARMCC_VERSION': '5.06', |
screamer | 1:a99c8e460c5c | 843 | 'COMMON_FLAGS':['-c', '--gnu', '-O3', '-Otime', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 844 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 845 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 846 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 847 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 848 | }, |
screamer | 1:a99c8e460c5c | 849 | |
screamer | 1:a99c8e460c5c | 850 | 'v4': { |
screamer | 1:a99c8e460c5c | 851 | 'ARMCC_VERSION': '5.03', |
screamer | 1:a99c8e460c5c | 852 | 'COMMON_FLAGS':['-c', '--gnu', '-O3', '-Otime', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 853 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 854 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 855 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 856 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 857 | }, |
screamer | 1:a99c8e460c5c | 858 | |
screamer | 1:a99c8e460c5c | 859 | 'v3': { |
screamer | 1:a99c8e460c5c | 860 | 'ARMCC_VERSION': '5.01', |
screamer | 1:a99c8e460c5c | 861 | 'COMMON_FLAGS':['-c', '--gnu', '-Ospace', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 862 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 863 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 864 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 865 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 866 | }, |
screamer | 1:a99c8e460c5c | 867 | |
screamer | 1:a99c8e460c5c | 868 | 'v2': { |
screamer | 1:a99c8e460c5c | 869 | 'COMMON_FLAGS':['-c', '--gnu', '-Ospace', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 870 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 871 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 872 | 'COMMON_CPP_FLAGS':['--cpp', '--no_rtti'], |
screamer | 1:a99c8e460c5c | 873 | 'COMPILE_C_AS_CPP': False, |
screamer | 1:a99c8e460c5c | 874 | }, |
screamer | 1:a99c8e460c5c | 875 | |
screamer | 1:a99c8e460c5c | 876 | 'v1': { |
screamer | 1:a99c8e460c5c | 877 | 'ARMCC_VERSION': '4', |
screamer | 1:a99c8e460c5c | 878 | 'COMMON_FLAGS':['-c', '--gnu', '-Otime', '--split_sections', '--apcs=interwork'], |
screamer | 1:a99c8e460c5c | 879 | 'COMMON_C_FLAGS':['--no_depend_system_headers'], |
screamer | 1:a99c8e460c5c | 880 | 'COMMON_CC_FLAGS':['--c99'], |
screamer | 1:a99c8e460c5c | 881 | 'COMMON_CPP_FLAGS':['--cpp'], |
screamer | 1:a99c8e460c5c | 882 | 'COMPILE_C_AS_CPP': True, |
screamer | 1:a99c8e460c5c | 883 | } |
screamer | 1:a99c8e460c5c | 884 | } # end ARM |
screamer | 1:a99c8e460c5c | 885 | } |