Clone of official tools

Committer:
screamer
Date:
Tue Jun 07 11:21:44 2016 +0100
Revision:
7:5af61d55adbe
Parent:
2:07730b0f452c
Child:
8:a8ac6ed29081
Ported changes and config system from workspace 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
screamer 0:66f3b5499f7f 18 import re
screamer 0:66f3b5499f7f 19 import tempfile
screamer 0:66f3b5499f7f 20 import colorama
screamer 0:66f3b5499f7f 21
screamer 0:66f3b5499f7f 22
screamer 0:66f3b5499f7f 23 from types import ListType
screamer 0:66f3b5499f7f 24 from shutil import rmtree
screamer 7:5af61d55adbe 25 from os.path import join, exists, basename, abspath, normpath
screamer 7:5af61d55adbe 26 from os import getcwd
screamer 0:66f3b5499f7f 27 from time import time
screamer 0:66f3b5499f7f 28
screamer 7:5af61d55adbe 29 from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException, ToolException
screamer 0:66f3b5499f7f 30 from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON
screamer 0:66f3b5499f7f 31 from tools.targets import TARGET_NAMES, TARGET_MAP
screamer 0:66f3b5499f7f 32 from tools.libraries import Library
screamer 7:5af61d55adbe 33 from tools.toolchains import TOOLCHAIN_CLASSES
screamer 0:66f3b5499f7f 34 from jinja2 import FileSystemLoader
screamer 0:66f3b5499f7f 35 from jinja2.environment import Environment
screamer 7:5af61d55adbe 36 from tools.config import Config
screamer 0:66f3b5499f7f 37
screamer 0:66f3b5499f7f 38 def prep_report(report, target_name, toolchain_name, id_name):
screamer 0:66f3b5499f7f 39 # Setup report keys
screamer 0:66f3b5499f7f 40 if not target_name in report:
screamer 0:66f3b5499f7f 41 report[target_name] = {}
screamer 0:66f3b5499f7f 42
screamer 0:66f3b5499f7f 43 if not toolchain_name in report[target_name]:
screamer 0:66f3b5499f7f 44 report[target_name][toolchain_name] = {}
screamer 0:66f3b5499f7f 45
screamer 0:66f3b5499f7f 46 if not id_name in report[target_name][toolchain_name]:
screamer 0:66f3b5499f7f 47 report[target_name][toolchain_name][id_name] = []
screamer 0:66f3b5499f7f 48
screamer 0:66f3b5499f7f 49 def prep_properties(properties, target_name, toolchain_name, vendor_label):
screamer 0:66f3b5499f7f 50 # Setup test properties
screamer 0:66f3b5499f7f 51 if not target_name in properties:
screamer 0:66f3b5499f7f 52 properties[target_name] = {}
screamer 0:66f3b5499f7f 53
screamer 0:66f3b5499f7f 54 if not toolchain_name in properties[target_name]:
screamer 0:66f3b5499f7f 55 properties[target_name][toolchain_name] = {}
screamer 0:66f3b5499f7f 56
screamer 0:66f3b5499f7f 57 properties[target_name][toolchain_name]["target"] = target_name
screamer 0:66f3b5499f7f 58 properties[target_name][toolchain_name]["vendor"] = vendor_label
screamer 0:66f3b5499f7f 59 properties[target_name][toolchain_name]["toolchain"] = toolchain_name
screamer 0:66f3b5499f7f 60
screamer 0:66f3b5499f7f 61 def create_result(target_name, toolchain_name, id_name, description):
screamer 0:66f3b5499f7f 62 cur_result = {}
screamer 0:66f3b5499f7f 63 cur_result["target_name"] = target_name
screamer 0:66f3b5499f7f 64 cur_result["toolchain_name"] = toolchain_name
screamer 0:66f3b5499f7f 65 cur_result["id"] = id_name
screamer 0:66f3b5499f7f 66 cur_result["description"] = description
screamer 0:66f3b5499f7f 67 cur_result["elapsed_time"] = 0
screamer 0:66f3b5499f7f 68 cur_result["output"] = ""
screamer 0:66f3b5499f7f 69
screamer 0:66f3b5499f7f 70 return cur_result
screamer 0:66f3b5499f7f 71
screamer 0:66f3b5499f7f 72 def add_result_to_report(report, result):
screamer 0:66f3b5499f7f 73 target = result["target_name"]
screamer 0:66f3b5499f7f 74 toolchain = result["toolchain_name"]
screamer 0:66f3b5499f7f 75 id_name = result['id']
screamer 0:66f3b5499f7f 76 result_wrap = { 0: result }
screamer 0:66f3b5499f7f 77 report[target][toolchain][id_name].append(result_wrap)
screamer 0:66f3b5499f7f 78
screamer 7:5af61d55adbe 79 def get_config(src_path, target, toolchain_name):
screamer 7:5af61d55adbe 80 # Convert src_path to a list if needed
screamer 1:a99c8e460c5c 81 src_paths = [src_path] if type(src_path) != ListType else src_path
screamer 1:a99c8e460c5c 82 # We need to remove all paths which are repeated to avoid
screamer 1:a99c8e460c5c 83 # multiple compilations and linking with the same objects
screamer 1:a99c8e460c5c 84 src_paths = [src_paths[0]] + list(set(src_paths[1:]))
screamer 7:5af61d55adbe 85
screamer 7:5af61d55adbe 86 # Create configuration object
screamer 7:5af61d55adbe 87 config = Config(target, src_paths)
screamer 1:a99c8e460c5c 88
screamer 7:5af61d55adbe 89 # If the 'target' argument is a string, convert it to a target instance
screamer 7:5af61d55adbe 90 if isinstance(target, str):
screamer 7:5af61d55adbe 91 try:
screamer 7:5af61d55adbe 92 target = TARGET_MAP[target]
screamer 7:5af61d55adbe 93 except KeyError:
screamer 7:5af61d55adbe 94 raise KeyError("Target '%s' not found" % target)
screamer 2:07730b0f452c 95
screamer 0:66f3b5499f7f 96 # Toolchain instance
screamer 0:66f3b5499f7f 97 try:
screamer 7:5af61d55adbe 98 toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options=None, notify=None, macros=None, silent=True, extra_verbose=False)
screamer 7:5af61d55adbe 99 except KeyError as e:
screamer 7:5af61d55adbe 100 raise KeyError("Toolchain %s not supported" % toolchain_name)
screamer 7:5af61d55adbe 101
screamer 7:5af61d55adbe 102 # Scan src_path for config files
screamer 7:5af61d55adbe 103 resources = toolchain.scan_resources(src_paths[0])
screamer 7:5af61d55adbe 104 for path in src_paths[1:]:
screamer 7:5af61d55adbe 105 resources.add(toolchain.scan_resources(path))
screamer 7:5af61d55adbe 106
screamer 7:5af61d55adbe 107 config.add_config_files(resources.json_files)
screamer 7:5af61d55adbe 108 return config.get_config_data()
screamer 7:5af61d55adbe 109
screamer 7:5af61d55adbe 110 def build_project(src_path, build_path, target, toolchain_name,
screamer 7:5af61d55adbe 111 libraries_paths=None, options=None, linker_script=None,
screamer 7:5af61d55adbe 112 clean=False, notify=None, verbose=False, name=None, macros=None, inc_dirs=None,
screamer 7:5af61d55adbe 113 jobs=1, silent=False, report=None, properties=None, project_id=None, project_description=None,
screamer 7:5af61d55adbe 114 extra_verbose=False, config=None):
screamer 7:5af61d55adbe 115 """ This function builds project. Project can be for example one test / UT
screamer 7:5af61d55adbe 116 """
screamer 7:5af61d55adbe 117
screamer 7:5af61d55adbe 118 # Convert src_path to a list if needed
screamer 7:5af61d55adbe 119 src_paths = [src_path] if type(src_path) != ListType else src_path
screamer 7:5af61d55adbe 120
screamer 7:5af61d55adbe 121 # We need to remove all paths which are repeated to avoid
screamer 7:5af61d55adbe 122 # multiple compilations and linking with the same objects
screamer 7:5af61d55adbe 123 src_paths = [src_paths[0]] + list(set(src_paths[1:]))
screamer 7:5af61d55adbe 124 first_src_path = src_paths[0] if src_paths[0] != "." and src_paths[0] != "./" else getcwd()
screamer 7:5af61d55adbe 125 abs_path = abspath(first_src_path)
screamer 7:5af61d55adbe 126 project_name = basename(normpath(abs_path))
screamer 7:5af61d55adbe 127
screamer 7:5af61d55adbe 128 # If the configuration object was not yet created, create it now
screamer 7:5af61d55adbe 129 config = config or Config(target, src_paths)
screamer 7:5af61d55adbe 130
screamer 7:5af61d55adbe 131 # If the 'target' argument is a string, convert it to a target instance
screamer 7:5af61d55adbe 132 if isinstance(target, str):
screamer 7:5af61d55adbe 133 try:
screamer 7:5af61d55adbe 134 target = TARGET_MAP[target]
screamer 7:5af61d55adbe 135 except KeyError:
screamer 7:5af61d55adbe 136 raise KeyError("Target '%s' not found" % target)
screamer 7:5af61d55adbe 137
screamer 7:5af61d55adbe 138 # Toolchain instance
screamer 7:5af61d55adbe 139 try:
screamer 7:5af61d55adbe 140 toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros, silent, extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 141 except KeyError as e:
screamer 0:66f3b5499f7f 142 raise KeyError("Toolchain %s not supported" % toolchain_name)
screamer 0:66f3b5499f7f 143
screamer 0:66f3b5499f7f 144 toolchain.VERBOSE = verbose
screamer 0:66f3b5499f7f 145 toolchain.jobs = jobs
screamer 0:66f3b5499f7f 146 toolchain.build_all = clean
screamer 0:66f3b5499f7f 147
screamer 0:66f3b5499f7f 148 if name is None:
screamer 0:66f3b5499f7f 149 # We will use default project name based on project folder name
screamer 0:66f3b5499f7f 150 name = project_name
screamer 0:66f3b5499f7f 151 toolchain.info("Building project %s (%s, %s)" % (project_name, target.name, toolchain_name))
screamer 0:66f3b5499f7f 152 else:
screamer 0:66f3b5499f7f 153 # User used custom global project name to have the same name for the
screamer 0:66f3b5499f7f 154 toolchain.info("Building project %s to %s (%s, %s)" % (project_name, name, target.name, toolchain_name))
screamer 0:66f3b5499f7f 155
screamer 0:66f3b5499f7f 156
screamer 0:66f3b5499f7f 157 if report != None:
screamer 0:66f3b5499f7f 158 start = time()
screamer 7:5af61d55adbe 159
screamer 7:5af61d55adbe 160 # If project_id is specified, use that over the default name
screamer 7:5af61d55adbe 161 id_name = project_id.upper() if project_id else name.upper()
screamer 7:5af61d55adbe 162 description = project_description if project_description else name
screamer 0:66f3b5499f7f 163 vendor_label = target.extra_labels[0]
screamer 0:66f3b5499f7f 164 cur_result = None
screamer 0:66f3b5499f7f 165 prep_report(report, target.name, toolchain_name, id_name)
screamer 0:66f3b5499f7f 166 cur_result = create_result(target.name, toolchain_name, id_name, description)
screamer 0:66f3b5499f7f 167
screamer 0:66f3b5499f7f 168 if properties != None:
screamer 0:66f3b5499f7f 169 prep_properties(properties, target.name, toolchain_name, vendor_label)
screamer 0:66f3b5499f7f 170
screamer 0:66f3b5499f7f 171 try:
screamer 0:66f3b5499f7f 172 # Scan src_path and libraries_paths for resources
screamer 0:66f3b5499f7f 173 resources = toolchain.scan_resources(src_paths[0])
screamer 0:66f3b5499f7f 174 for path in src_paths[1:]:
screamer 0:66f3b5499f7f 175 resources.add(toolchain.scan_resources(path))
screamer 0:66f3b5499f7f 176 if libraries_paths is not None:
screamer 0:66f3b5499f7f 177 src_paths.extend(libraries_paths)
screamer 0:66f3b5499f7f 178 for path in libraries_paths:
screamer 0:66f3b5499f7f 179 resources.add(toolchain.scan_resources(path))
screamer 0:66f3b5499f7f 180
screamer 0:66f3b5499f7f 181 if linker_script is not None:
screamer 0:66f3b5499f7f 182 resources.linker_script = linker_script
screamer 0:66f3b5499f7f 183
screamer 0:66f3b5499f7f 184 # Build Directory
screamer 0:66f3b5499f7f 185 if clean:
screamer 0:66f3b5499f7f 186 if exists(build_path):
screamer 0:66f3b5499f7f 187 rmtree(build_path)
screamer 0:66f3b5499f7f 188 mkdir(build_path)
screamer 0:66f3b5499f7f 189
screamer 0:66f3b5499f7f 190 # We need to add if necessary additional include directories
screamer 0:66f3b5499f7f 191 if inc_dirs:
screamer 0:66f3b5499f7f 192 if type(inc_dirs) == ListType:
screamer 0:66f3b5499f7f 193 resources.inc_dirs.extend(inc_dirs)
screamer 0:66f3b5499f7f 194 else:
screamer 0:66f3b5499f7f 195 resources.inc_dirs.append(inc_dirs)
screamer 7:5af61d55adbe 196
screamer 7:5af61d55adbe 197 # Update the configuration with any .json files found while scanning
screamer 7:5af61d55adbe 198 config.add_config_files(resources.json_files)
screamer 7:5af61d55adbe 199 # And add the configuration macros to the toolchain
screamer 7:5af61d55adbe 200 toolchain.add_macros(config.get_config_data_macros())
screamer 7:5af61d55adbe 201
screamer 0:66f3b5499f7f 202 # Compile Sources
screamer 0:66f3b5499f7f 203 for path in src_paths:
screamer 0:66f3b5499f7f 204 src = toolchain.scan_resources(path)
screamer 0:66f3b5499f7f 205 objects = toolchain.compile_sources(src, build_path, resources.inc_dirs)
screamer 0:66f3b5499f7f 206 resources.objects.extend(objects)
screamer 0:66f3b5499f7f 207
screamer 0:66f3b5499f7f 208 # Link Program
screamer 0:66f3b5499f7f 209 res, needed_update = toolchain.link_program(resources, build_path, name)
screamer 0:66f3b5499f7f 210
screamer 0:66f3b5499f7f 211 if report != None and needed_update:
screamer 0:66f3b5499f7f 212 end = time()
screamer 0:66f3b5499f7f 213 cur_result["elapsed_time"] = end - start
screamer 0:66f3b5499f7f 214 cur_result["output"] = toolchain.get_output()
screamer 0:66f3b5499f7f 215 cur_result["result"] = "OK"
screamer 0:66f3b5499f7f 216
screamer 0:66f3b5499f7f 217 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 218
screamer 0:66f3b5499f7f 219 return res
screamer 0:66f3b5499f7f 220
screamer 0:66f3b5499f7f 221 except Exception, e:
screamer 0:66f3b5499f7f 222 if report != None:
screamer 0:66f3b5499f7f 223 end = time()
screamer 0:66f3b5499f7f 224
screamer 0:66f3b5499f7f 225 if isinstance(e, NotSupportedException):
screamer 0:66f3b5499f7f 226 cur_result["result"] = "NOT_SUPPORTED"
screamer 0:66f3b5499f7f 227 else:
screamer 0:66f3b5499f7f 228 cur_result["result"] = "FAIL"
screamer 0:66f3b5499f7f 229
screamer 0:66f3b5499f7f 230 cur_result["elapsed_time"] = end - start
screamer 0:66f3b5499f7f 231
screamer 0:66f3b5499f7f 232 toolchain_output = toolchain.get_output()
screamer 0:66f3b5499f7f 233 if toolchain_output:
screamer 0:66f3b5499f7f 234 cur_result["output"] += toolchain_output
screamer 0:66f3b5499f7f 235
screamer 0:66f3b5499f7f 236 cur_result["output"] += str(e)
screamer 0:66f3b5499f7f 237
screamer 0:66f3b5499f7f 238 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 239
screamer 0:66f3b5499f7f 240 # Let Exception propagate
screamer 0:66f3b5499f7f 241 raise e
screamer 0:66f3b5499f7f 242
screamer 0:66f3b5499f7f 243 def build_library(src_paths, build_path, target, toolchain_name,
screamer 0:66f3b5499f7f 244 dependencies_paths=None, options=None, name=None, clean=False, archive=True,
screamer 0:66f3b5499f7f 245 notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None,
screamer 7:5af61d55adbe 246 jobs=1, silent=False, report=None, properties=None, extra_verbose=False,
screamer 7:5af61d55adbe 247 project_id=None):
screamer 0:66f3b5499f7f 248 """ src_path: the path of the source directory
screamer 0:66f3b5499f7f 249 build_path: the path of the build directory
screamer 0:66f3b5499f7f 250 target: ['LPC1768', 'LPC11U24', 'LPC2368']
screamer 0:66f3b5499f7f 251 toolchain: ['ARM', 'uARM', 'GCC_ARM', 'GCC_CR']
screamer 0:66f3b5499f7f 252 library_paths: List of paths to additional libraries
screamer 0:66f3b5499f7f 253 clean: Rebuild everything if True
screamer 0:66f3b5499f7f 254 notify: Notify function for logs
screamer 0:66f3b5499f7f 255 verbose: Write the actual tools command lines if True
screamer 0:66f3b5499f7f 256 inc_dirs: additional include directories which should be included in build
screamer 0:66f3b5499f7f 257 inc_dirs_ext: additional include directories which should be copied to library directory
screamer 0:66f3b5499f7f 258 """
screamer 0:66f3b5499f7f 259 if type(src_paths) != ListType:
screamer 0:66f3b5499f7f 260 src_paths = [src_paths]
screamer 0:66f3b5499f7f 261
screamer 0:66f3b5499f7f 262 # The first path will give the name to the library
screamer 7:5af61d55adbe 263 project_name = basename(src_paths[0] if src_paths[0] != "." and src_paths[0] != "./" else getcwd())
screamer 0:66f3b5499f7f 264 if name is None:
screamer 0:66f3b5499f7f 265 # We will use default project name based on project folder name
screamer 0:66f3b5499f7f 266 name = project_name
screamer 0:66f3b5499f7f 267
screamer 0:66f3b5499f7f 268 if report != None:
screamer 0:66f3b5499f7f 269 start = time()
screamer 7:5af61d55adbe 270
screamer 7:5af61d55adbe 271 # If project_id is specified, use that over the default name
screamer 7:5af61d55adbe 272 id_name = project_id.upper() if project_id else name.upper()
screamer 0:66f3b5499f7f 273 description = name
screamer 0:66f3b5499f7f 274 vendor_label = target.extra_labels[0]
screamer 0:66f3b5499f7f 275 cur_result = None
screamer 0:66f3b5499f7f 276 prep_report(report, target.name, toolchain_name, id_name)
screamer 0:66f3b5499f7f 277 cur_result = create_result(target.name, toolchain_name, id_name, description)
screamer 0:66f3b5499f7f 278
screamer 0:66f3b5499f7f 279 if properties != None:
screamer 0:66f3b5499f7f 280 prep_properties(properties, target.name, toolchain_name, vendor_label)
screamer 0:66f3b5499f7f 281
screamer 0:66f3b5499f7f 282 for src_path in src_paths:
screamer 0:66f3b5499f7f 283 if not exists(src_path):
screamer 0:66f3b5499f7f 284 error_msg = "The library source folder does not exist: %s", src_path
screamer 0:66f3b5499f7f 285
screamer 0:66f3b5499f7f 286 if report != None:
screamer 0:66f3b5499f7f 287 cur_result["output"] = error_msg
screamer 0:66f3b5499f7f 288 cur_result["result"] = "FAIL"
screamer 0:66f3b5499f7f 289 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 290
screamer 0:66f3b5499f7f 291 raise Exception(error_msg)
screamer 0:66f3b5499f7f 292
screamer 0:66f3b5499f7f 293 try:
screamer 0:66f3b5499f7f 294 # Toolchain instance
screamer 0:66f3b5499f7f 295 toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent, extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 296 toolchain.VERBOSE = verbose
screamer 0:66f3b5499f7f 297 toolchain.jobs = jobs
screamer 0:66f3b5499f7f 298 toolchain.build_all = clean
screamer 0:66f3b5499f7f 299
screamer 0:66f3b5499f7f 300 toolchain.info("Building library %s (%s, %s)" % (name, target.name, toolchain_name))
screamer 0:66f3b5499f7f 301
screamer 0:66f3b5499f7f 302 # Scan Resources
screamer 0:66f3b5499f7f 303 resources = []
screamer 0:66f3b5499f7f 304 for src_path in src_paths:
screamer 0:66f3b5499f7f 305 resources.append(toolchain.scan_resources(src_path))
screamer 0:66f3b5499f7f 306
screamer 0:66f3b5499f7f 307 # Add extra include directories / files which are required by library
screamer 0:66f3b5499f7f 308 # This files usually are not in the same directory as source files so
screamer 0:66f3b5499f7f 309 # previous scan will not include them
screamer 0:66f3b5499f7f 310 if inc_dirs_ext is not None:
screamer 0:66f3b5499f7f 311 for inc_ext in inc_dirs_ext:
screamer 0:66f3b5499f7f 312 resources.append(toolchain.scan_resources(inc_ext))
screamer 0:66f3b5499f7f 313
screamer 0:66f3b5499f7f 314 # Dependencies Include Paths
screamer 0:66f3b5499f7f 315 dependencies_include_dir = []
screamer 0:66f3b5499f7f 316 if dependencies_paths is not None:
screamer 0:66f3b5499f7f 317 for path in dependencies_paths:
screamer 0:66f3b5499f7f 318 lib_resources = toolchain.scan_resources(path)
screamer 0:66f3b5499f7f 319 dependencies_include_dir.extend(lib_resources.inc_dirs)
screamer 0:66f3b5499f7f 320
screamer 0:66f3b5499f7f 321 if inc_dirs:
screamer 0:66f3b5499f7f 322 dependencies_include_dir.extend(inc_dirs)
screamer 0:66f3b5499f7f 323
screamer 0:66f3b5499f7f 324 if archive:
screamer 0:66f3b5499f7f 325 # Use temp path when building archive
screamer 0:66f3b5499f7f 326 tmp_path = join(build_path, '.temp')
screamer 0:66f3b5499f7f 327 mkdir(tmp_path)
screamer 0:66f3b5499f7f 328 else:
screamer 0:66f3b5499f7f 329 tmp_path = build_path
screamer 0:66f3b5499f7f 330
screamer 7:5af61d55adbe 331 # Handle configuration
screamer 7:5af61d55adbe 332 config = Config(target)
screamer 7:5af61d55adbe 333
screamer 0:66f3b5499f7f 334 # Copy headers, objects and static libraries
screamer 0:66f3b5499f7f 335 for resource in resources:
screamer 0:66f3b5499f7f 336 toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path)
screamer 0:66f3b5499f7f 337 toolchain.copy_files(resource.objects, build_path, rel_path=resource.base_path)
screamer 0:66f3b5499f7f 338 toolchain.copy_files(resource.libraries, build_path, rel_path=resource.base_path)
screamer 0:66f3b5499f7f 339 if resource.linker_script:
screamer 0:66f3b5499f7f 340 toolchain.copy_files(resource.linker_script, build_path, rel_path=resource.base_path)
screamer 7:5af61d55adbe 341 config.add_config_files(resource.json_files)
screamer 7:5af61d55adbe 342
screamer 7:5af61d55adbe 343 toolchain.add_macros(config.get_config_data_macros())
screamer 0:66f3b5499f7f 344
screamer 0:66f3b5499f7f 345 # Compile Sources
screamer 0:66f3b5499f7f 346 objects = []
screamer 0:66f3b5499f7f 347 for resource in resources:
screamer 0:66f3b5499f7f 348 objects.extend(toolchain.compile_sources(resource, abspath(tmp_path), dependencies_include_dir))
screamer 0:66f3b5499f7f 349
screamer 0:66f3b5499f7f 350 if archive:
screamer 0:66f3b5499f7f 351 needed_update = toolchain.build_library(objects, build_path, name)
screamer 0:66f3b5499f7f 352 else:
screamer 0:66f3b5499f7f 353 needed_update = True
screamer 0:66f3b5499f7f 354
screamer 0:66f3b5499f7f 355 if report != None and needed_update:
screamer 0:66f3b5499f7f 356 end = time()
screamer 0:66f3b5499f7f 357 cur_result["elapsed_time"] = end - start
screamer 0:66f3b5499f7f 358 cur_result["output"] = toolchain.get_output()
screamer 0:66f3b5499f7f 359 cur_result["result"] = "OK"
screamer 0:66f3b5499f7f 360
screamer 0:66f3b5499f7f 361 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 362
screamer 0:66f3b5499f7f 363 except Exception, e:
screamer 0:66f3b5499f7f 364 if report != None:
screamer 0:66f3b5499f7f 365 end = time()
screamer 7:5af61d55adbe 366
screamer 7:5af61d55adbe 367 if isinstance(e, ToolException):
screamer 7:5af61d55adbe 368 cur_result["result"] = "FAIL"
screamer 7:5af61d55adbe 369 elif isinstance(e, NotSupportedException):
screamer 7:5af61d55adbe 370 cur_result["result"] = "NOT_SUPPORTED"
screamer 7:5af61d55adbe 371
screamer 0:66f3b5499f7f 372 cur_result["elapsed_time"] = end - start
screamer 0:66f3b5499f7f 373
screamer 0:66f3b5499f7f 374 toolchain_output = toolchain.get_output()
screamer 0:66f3b5499f7f 375 if toolchain_output:
screamer 0:66f3b5499f7f 376 cur_result["output"] += toolchain_output
screamer 0:66f3b5499f7f 377
screamer 0:66f3b5499f7f 378 cur_result["output"] += str(e)
screamer 0:66f3b5499f7f 379
screamer 0:66f3b5499f7f 380 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 381
screamer 0:66f3b5499f7f 382 # Let Exception propagate
screamer 0:66f3b5499f7f 383 raise e
screamer 0:66f3b5499f7f 384
screamer 0:66f3b5499f7f 385 def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False, report=None, properties=None, extra_verbose=False):
screamer 0:66f3b5499f7f 386 """ Wrapper for build_library function.
screamer 0:66f3b5499f7f 387 Function builds library in proper directory using all dependencies and macros defined by user.
screamer 0:66f3b5499f7f 388 """
screamer 0:66f3b5499f7f 389 lib = Library(lib_id)
screamer 0:66f3b5499f7f 390 if lib.is_supported(target, toolchain):
screamer 0:66f3b5499f7f 391 # We need to combine macros from parameter list with macros from library definition
screamer 0:66f3b5499f7f 392 MACROS = lib.macros if lib.macros else []
screamer 0:66f3b5499f7f 393 if macros:
screamer 0:66f3b5499f7f 394 MACROS.extend(macros)
screamer 0:66f3b5499f7f 395
screamer 0:66f3b5499f7f 396 return build_library(lib.source_dir, lib.build_dir, target, toolchain, lib.dependencies, options,
screamer 0:66f3b5499f7f 397 verbose=verbose,
screamer 0:66f3b5499f7f 398 silent=silent,
screamer 0:66f3b5499f7f 399 clean=clean,
screamer 0:66f3b5499f7f 400 macros=MACROS,
screamer 0:66f3b5499f7f 401 notify=notify,
screamer 0:66f3b5499f7f 402 inc_dirs=lib.inc_dirs,
screamer 0:66f3b5499f7f 403 inc_dirs_ext=lib.inc_dirs_ext,
screamer 0:66f3b5499f7f 404 jobs=jobs,
screamer 0:66f3b5499f7f 405 report=report,
screamer 0:66f3b5499f7f 406 properties=properties,
screamer 0:66f3b5499f7f 407 extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 408 else:
screamer 0:66f3b5499f7f 409 print 'Library "%s" is not yet supported on target %s with toolchain %s' % (lib_id, target.name, toolchain)
screamer 0:66f3b5499f7f 410 return False
screamer 0:66f3b5499f7f 411
screamer 0:66f3b5499f7f 412
screamer 0:66f3b5499f7f 413 # We do have unique legacy conventions about how we build and package the mbed library
screamer 0:66f3b5499f7f 414 def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False, report=None, properties=None, extra_verbose=False):
screamer 0:66f3b5499f7f 415 """ Function returns True is library was built and false if building was skipped """
screamer 0:66f3b5499f7f 416
screamer 0:66f3b5499f7f 417 if report != None:
screamer 0:66f3b5499f7f 418 start = time()
screamer 0:66f3b5499f7f 419 id_name = "MBED"
screamer 0:66f3b5499f7f 420 description = "mbed SDK"
screamer 0:66f3b5499f7f 421 vendor_label = target.extra_labels[0]
screamer 0:66f3b5499f7f 422 cur_result = None
screamer 0:66f3b5499f7f 423 prep_report(report, target.name, toolchain_name, id_name)
screamer 0:66f3b5499f7f 424 cur_result = create_result(target.name, toolchain_name, id_name, description)
screamer 0:66f3b5499f7f 425
screamer 0:66f3b5499f7f 426 if properties != None:
screamer 0:66f3b5499f7f 427 prep_properties(properties, target.name, toolchain_name, vendor_label)
screamer 0:66f3b5499f7f 428
screamer 0:66f3b5499f7f 429 # Check toolchain support
screamer 0:66f3b5499f7f 430 if toolchain_name not in target.supported_toolchains:
screamer 0:66f3b5499f7f 431 supported_toolchains_text = ", ".join(target.supported_toolchains)
screamer 0:66f3b5499f7f 432 print '%s target is not yet supported by toolchain %s' % (target.name, toolchain_name)
screamer 0:66f3b5499f7f 433 print '%s target supports %s toolchain%s' % (target.name, supported_toolchains_text, 's' if len(target.supported_toolchains) > 1 else '')
screamer 0:66f3b5499f7f 434
screamer 0:66f3b5499f7f 435 if report != None:
screamer 0:66f3b5499f7f 436 cur_result["result"] = "SKIP"
screamer 0:66f3b5499f7f 437 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 438
screamer 0:66f3b5499f7f 439 return False
screamer 0:66f3b5499f7f 440
screamer 0:66f3b5499f7f 441 try:
screamer 0:66f3b5499f7f 442 # Toolchain
screamer 0:66f3b5499f7f 443 toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent, extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 444 toolchain.VERBOSE = verbose
screamer 0:66f3b5499f7f 445 toolchain.jobs = jobs
screamer 0:66f3b5499f7f 446 toolchain.build_all = clean
screamer 0:66f3b5499f7f 447
screamer 0:66f3b5499f7f 448 # Source and Build Paths
screamer 0:66f3b5499f7f 449 BUILD_TARGET = join(MBED_LIBRARIES, "TARGET_" + target.name)
screamer 0:66f3b5499f7f 450 BUILD_TOOLCHAIN = join(BUILD_TARGET, "TOOLCHAIN_" + toolchain.name)
screamer 0:66f3b5499f7f 451 mkdir(BUILD_TOOLCHAIN)
screamer 0:66f3b5499f7f 452
screamer 0:66f3b5499f7f 453 TMP_PATH = join(MBED_LIBRARIES, '.temp', toolchain.obj_path)
screamer 0:66f3b5499f7f 454 mkdir(TMP_PATH)
screamer 0:66f3b5499f7f 455
screamer 0:66f3b5499f7f 456 # CMSIS
screamer 0:66f3b5499f7f 457 toolchain.info("Building library %s (%s, %s)"% ('CMSIS', target.name, toolchain_name))
screamer 0:66f3b5499f7f 458 cmsis_src = join(MBED_TARGETS_PATH, "cmsis")
screamer 0:66f3b5499f7f 459 resources = toolchain.scan_resources(cmsis_src)
screamer 0:66f3b5499f7f 460
screamer 0:66f3b5499f7f 461 toolchain.copy_files(resources.headers, BUILD_TARGET)
screamer 0:66f3b5499f7f 462 toolchain.copy_files(resources.linker_script, BUILD_TOOLCHAIN)
screamer 0:66f3b5499f7f 463 toolchain.copy_files(resources.bin_files, BUILD_TOOLCHAIN)
screamer 0:66f3b5499f7f 464
screamer 0:66f3b5499f7f 465 objects = toolchain.compile_sources(resources, TMP_PATH)
screamer 0:66f3b5499f7f 466 toolchain.copy_files(objects, BUILD_TOOLCHAIN)
screamer 0:66f3b5499f7f 467
screamer 0:66f3b5499f7f 468 # mbed
screamer 0:66f3b5499f7f 469 toolchain.info("Building library %s (%s, %s)" % ('MBED', target.name, toolchain_name))
screamer 0:66f3b5499f7f 470
screamer 0:66f3b5499f7f 471 # Common Headers
screamer 0:66f3b5499f7f 472 toolchain.copy_files(toolchain.scan_resources(MBED_API).headers, MBED_LIBRARIES)
screamer 0:66f3b5499f7f 473 toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers, MBED_LIBRARIES)
screamer 0:66f3b5499f7f 474
screamer 0:66f3b5499f7f 475 # Target specific sources
screamer 0:66f3b5499f7f 476 HAL_SRC = join(MBED_TARGETS_PATH, "hal")
screamer 0:66f3b5499f7f 477 hal_implementation = toolchain.scan_resources(HAL_SRC)
screamer 0:66f3b5499f7f 478 toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files + hal_implementation.libraries, BUILD_TARGET, HAL_SRC)
screamer 0:66f3b5499f7f 479 incdirs = toolchain.scan_resources(BUILD_TARGET).inc_dirs
screamer 0:66f3b5499f7f 480 objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES] + incdirs)
screamer 0:66f3b5499f7f 481
screamer 0:66f3b5499f7f 482 # Common Sources
screamer 0:66f3b5499f7f 483 mbed_resources = toolchain.scan_resources(MBED_COMMON)
screamer 0:66f3b5499f7f 484 objects += toolchain.compile_sources(mbed_resources, TMP_PATH, [MBED_LIBRARIES] + incdirs)
screamer 0:66f3b5499f7f 485
screamer 0:66f3b5499f7f 486 # A number of compiled files need to be copied as objects as opposed to
screamer 0:66f3b5499f7f 487 # being part of the mbed library, for reasons that have to do with the way
screamer 0:66f3b5499f7f 488 # the linker search for symbols in archives. These are:
screamer 0:66f3b5499f7f 489 # - retarget.o: to make sure that the C standard lib symbols get overridden
screamer 0:66f3b5499f7f 490 # - board.o: mbed_die is weak
screamer 0:66f3b5499f7f 491 # - mbed_overrides.o: this contains platform overrides of various weak SDK functions
screamer 0:66f3b5499f7f 492 separate_names, separate_objects = ['retarget.o', 'board.o', 'mbed_overrides.o'], []
screamer 0:66f3b5499f7f 493
screamer 0:66f3b5499f7f 494 for o in objects:
screamer 0:66f3b5499f7f 495 for name in separate_names:
screamer 0:66f3b5499f7f 496 if o.endswith(name):
screamer 0:66f3b5499f7f 497 separate_objects.append(o)
screamer 0:66f3b5499f7f 498
screamer 0:66f3b5499f7f 499 for o in separate_objects:
screamer 0:66f3b5499f7f 500 objects.remove(o)
screamer 0:66f3b5499f7f 501
screamer 0:66f3b5499f7f 502 needed_update = toolchain.build_library(objects, BUILD_TOOLCHAIN, "mbed")
screamer 0:66f3b5499f7f 503
screamer 0:66f3b5499f7f 504 for o in separate_objects:
screamer 0:66f3b5499f7f 505 toolchain.copy_files(o, BUILD_TOOLCHAIN)
screamer 0:66f3b5499f7f 506
screamer 0:66f3b5499f7f 507 if report != None and needed_update:
screamer 0:66f3b5499f7f 508 end = time()
screamer 0:66f3b5499f7f 509 cur_result["elapsed_time"] = end - start
screamer 0:66f3b5499f7f 510 cur_result["output"] = toolchain.get_output()
screamer 0:66f3b5499f7f 511 cur_result["result"] = "OK"
screamer 0:66f3b5499f7f 512
screamer 0:66f3b5499f7f 513 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 514
screamer 0:66f3b5499f7f 515 return True
screamer 0:66f3b5499f7f 516
screamer 0:66f3b5499f7f 517 except Exception, e:
screamer 0:66f3b5499f7f 518 if report != None:
screamer 0:66f3b5499f7f 519 end = time()
screamer 0:66f3b5499f7f 520 cur_result["result"] = "FAIL"
screamer 0:66f3b5499f7f 521 cur_result["elapsed_time"] = end - start
screamer 0:66f3b5499f7f 522
screamer 0:66f3b5499f7f 523 toolchain_output = toolchain.get_output()
screamer 0:66f3b5499f7f 524 if toolchain_output:
screamer 0:66f3b5499f7f 525 cur_result["output"] += toolchain_output
screamer 0:66f3b5499f7f 526
screamer 0:66f3b5499f7f 527 cur_result["output"] += str(e)
screamer 0:66f3b5499f7f 528
screamer 0:66f3b5499f7f 529 add_result_to_report(report, cur_result)
screamer 0:66f3b5499f7f 530
screamer 0:66f3b5499f7f 531 # Let Exception propagate
screamer 0:66f3b5499f7f 532 raise e
screamer 0:66f3b5499f7f 533
screamer 0:66f3b5499f7f 534 def get_unique_supported_toolchains():
screamer 0:66f3b5499f7f 535 """ Get list of all unique toolchains supported by targets """
screamer 0:66f3b5499f7f 536 unique_supported_toolchains = []
screamer 0:66f3b5499f7f 537 for target in TARGET_NAMES:
screamer 0:66f3b5499f7f 538 for toolchain in TARGET_MAP[target].supported_toolchains:
screamer 0:66f3b5499f7f 539 if toolchain not in unique_supported_toolchains:
screamer 0:66f3b5499f7f 540 unique_supported_toolchains.append(toolchain)
screamer 0:66f3b5499f7f 541 return unique_supported_toolchains
screamer 0:66f3b5499f7f 542
screamer 0:66f3b5499f7f 543
screamer 0:66f3b5499f7f 544 def mcu_toolchain_matrix(verbose_html=False, platform_filter=None):
screamer 0:66f3b5499f7f 545 """ Shows target map using prettytable """
screamer 0:66f3b5499f7f 546 unique_supported_toolchains = get_unique_supported_toolchains()
screamer 0:66f3b5499f7f 547 from prettytable import PrettyTable # Only use it in this function so building works without extra modules
screamer 0:66f3b5499f7f 548
screamer 0:66f3b5499f7f 549 # All tests status table print
screamer 0:66f3b5499f7f 550 columns = ["Platform"] + unique_supported_toolchains
screamer 0:66f3b5499f7f 551 pt = PrettyTable(["Platform"] + unique_supported_toolchains)
screamer 0:66f3b5499f7f 552 # Align table
screamer 0:66f3b5499f7f 553 for col in columns:
screamer 0:66f3b5499f7f 554 pt.align[col] = "c"
screamer 0:66f3b5499f7f 555 pt.align["Platform"] = "l"
screamer 0:66f3b5499f7f 556
screamer 0:66f3b5499f7f 557 perm_counter = 0
screamer 0:66f3b5499f7f 558 target_counter = 0
screamer 0:66f3b5499f7f 559 for target in sorted(TARGET_NAMES):
screamer 0:66f3b5499f7f 560 if platform_filter is not None:
screamer 0:66f3b5499f7f 561 # FIlter out platforms using regex
screamer 0:66f3b5499f7f 562 if re.search(platform_filter, target) is None:
screamer 0:66f3b5499f7f 563 continue
screamer 0:66f3b5499f7f 564 target_counter += 1
screamer 0:66f3b5499f7f 565
screamer 0:66f3b5499f7f 566 row = [target] # First column is platform name
screamer 0:66f3b5499f7f 567 default_toolchain = TARGET_MAP[target].default_toolchain
screamer 0:66f3b5499f7f 568 for unique_toolchain in unique_supported_toolchains:
screamer 0:66f3b5499f7f 569 text = "-"
screamer 0:66f3b5499f7f 570 if default_toolchain == unique_toolchain:
screamer 0:66f3b5499f7f 571 text = "Default"
screamer 0:66f3b5499f7f 572 perm_counter += 1
screamer 0:66f3b5499f7f 573 elif unique_toolchain in TARGET_MAP[target].supported_toolchains:
screamer 0:66f3b5499f7f 574 text = "Supported"
screamer 0:66f3b5499f7f 575 perm_counter += 1
screamer 0:66f3b5499f7f 576 row.append(text)
screamer 0:66f3b5499f7f 577 pt.add_row(row)
screamer 0:66f3b5499f7f 578
screamer 0:66f3b5499f7f 579 result = pt.get_html_string() if verbose_html else pt.get_string()
screamer 0:66f3b5499f7f 580 result += "\n"
screamer 0:66f3b5499f7f 581 result += "*Default - default on-line compiler\n"
screamer 0:66f3b5499f7f 582 result += "*Supported - supported off-line compiler\n"
screamer 0:66f3b5499f7f 583 result += "\n"
screamer 0:66f3b5499f7f 584 result += "Total platforms: %d\n"% (target_counter)
screamer 0:66f3b5499f7f 585 result += "Total permutations: %d"% (perm_counter)
screamer 0:66f3b5499f7f 586 return result
screamer 0:66f3b5499f7f 587
screamer 0:66f3b5499f7f 588
screamer 0:66f3b5499f7f 589 def get_target_supported_toolchains(target):
screamer 0:66f3b5499f7f 590 """ Returns target supported toolchains list """
screamer 0:66f3b5499f7f 591 return TARGET_MAP[target].supported_toolchains if target in TARGET_MAP else None
screamer 0:66f3b5499f7f 592
screamer 0:66f3b5499f7f 593
screamer 0:66f3b5499f7f 594 def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, extra_verbose=False):
screamer 0:66f3b5499f7f 595 # Toolchain
screamer 0:66f3b5499f7f 596 toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 597 toolchain.VERBOSE = verbose
screamer 0:66f3b5499f7f 598 toolchain.jobs = jobs
screamer 0:66f3b5499f7f 599 toolchain.build_all = clean
screamer 0:66f3b5499f7f 600
screamer 0:66f3b5499f7f 601 # Source and Build Paths
screamer 0:66f3b5499f7f 602 BUILD_TARGET = join(MBED_LIBRARIES, "TARGET_" + target.name)
screamer 0:66f3b5499f7f 603 BUILD_TOOLCHAIN = join(BUILD_TARGET, "TOOLCHAIN_" + toolchain.name)
screamer 0:66f3b5499f7f 604 mkdir(BUILD_TOOLCHAIN)
screamer 0:66f3b5499f7f 605
screamer 0:66f3b5499f7f 606 TMP_PATH = join(MBED_LIBRARIES, '.temp', toolchain.obj_path)
screamer 0:66f3b5499f7f 607 mkdir(TMP_PATH)
screamer 0:66f3b5499f7f 608
screamer 0:66f3b5499f7f 609 # CMSIS
screamer 0:66f3b5499f7f 610 toolchain.info("Static analysis for %s (%s, %s)" % ('CMSIS', target.name, toolchain_name))
screamer 0:66f3b5499f7f 611 cmsis_src = join(MBED_TARGETS_PATH, "cmsis")
screamer 0:66f3b5499f7f 612 resources = toolchain.scan_resources(cmsis_src)
screamer 0:66f3b5499f7f 613
screamer 0:66f3b5499f7f 614 # Copy files before analysis
screamer 0:66f3b5499f7f 615 toolchain.copy_files(resources.headers, BUILD_TARGET)
screamer 0:66f3b5499f7f 616 toolchain.copy_files(resources.linker_script, BUILD_TOOLCHAIN)
screamer 0:66f3b5499f7f 617
screamer 0:66f3b5499f7f 618 # Gather include paths, c, cpp sources and macros to transfer to cppcheck command line
screamer 0:66f3b5499f7f 619 includes = ["-I%s"% i for i in resources.inc_dirs]
screamer 0:66f3b5499f7f 620 includes.append("-I%s"% str(BUILD_TARGET))
screamer 0:66f3b5499f7f 621 c_sources = " ".join(resources.c_sources)
screamer 0:66f3b5499f7f 622 cpp_sources = " ".join(resources.cpp_sources)
screamer 0:66f3b5499f7f 623 macros = ["-D%s"% s for s in toolchain.get_symbols() + toolchain.macros]
screamer 0:66f3b5499f7f 624
screamer 0:66f3b5499f7f 625 includes = map(str.strip, includes)
screamer 0:66f3b5499f7f 626 macros = map(str.strip, macros)
screamer 0:66f3b5499f7f 627
screamer 0:66f3b5499f7f 628 check_cmd = CPPCHECK_CMD
screamer 0:66f3b5499f7f 629 check_cmd += CPPCHECK_MSG_FORMAT
screamer 0:66f3b5499f7f 630 check_cmd += includes
screamer 0:66f3b5499f7f 631 check_cmd += macros
screamer 0:66f3b5499f7f 632
screamer 0:66f3b5499f7f 633 # We need to pass some params via file to avoid "command line too long in some OSs"
screamer 0:66f3b5499f7f 634 tmp_file = tempfile.NamedTemporaryFile(delete=False)
screamer 0:66f3b5499f7f 635 tmp_file.writelines(line + '\n' for line in c_sources.split())
screamer 0:66f3b5499f7f 636 tmp_file.writelines(line + '\n' for line in cpp_sources.split())
screamer 0:66f3b5499f7f 637 tmp_file.close()
screamer 0:66f3b5499f7f 638 check_cmd += ["--file-list=%s"% tmp_file.name]
screamer 0:66f3b5499f7f 639
screamer 0:66f3b5499f7f 640 _stdout, _stderr, _rc = run_cmd(check_cmd)
screamer 0:66f3b5499f7f 641 if verbose:
screamer 0:66f3b5499f7f 642 print _stdout
screamer 0:66f3b5499f7f 643 print _stderr
screamer 0:66f3b5499f7f 644
screamer 0:66f3b5499f7f 645 # =========================================================================
screamer 0:66f3b5499f7f 646
screamer 0:66f3b5499f7f 647 # MBED
screamer 0:66f3b5499f7f 648 toolchain.info("Static analysis for %s (%s, %s)" % ('MBED', target.name, toolchain_name))
screamer 0:66f3b5499f7f 649
screamer 0:66f3b5499f7f 650 # Common Headers
screamer 0:66f3b5499f7f 651 toolchain.copy_files(toolchain.scan_resources(MBED_API).headers, MBED_LIBRARIES)
screamer 0:66f3b5499f7f 652 toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers, MBED_LIBRARIES)
screamer 0:66f3b5499f7f 653
screamer 0:66f3b5499f7f 654 # Target specific sources
screamer 0:66f3b5499f7f 655 HAL_SRC = join(MBED_TARGETS_PATH, "hal")
screamer 0:66f3b5499f7f 656 hal_implementation = toolchain.scan_resources(HAL_SRC)
screamer 0:66f3b5499f7f 657
screamer 0:66f3b5499f7f 658 # Copy files before analysis
screamer 0:66f3b5499f7f 659 toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files, BUILD_TARGET, HAL_SRC)
screamer 0:66f3b5499f7f 660 incdirs = toolchain.scan_resources(BUILD_TARGET)
screamer 0:66f3b5499f7f 661
screamer 0:66f3b5499f7f 662 target_includes = ["-I%s" % i for i in incdirs.inc_dirs]
screamer 0:66f3b5499f7f 663 target_includes.append("-I%s"% str(BUILD_TARGET))
screamer 0:66f3b5499f7f 664 target_includes.append("-I%s"% str(HAL_SRC))
screamer 0:66f3b5499f7f 665 target_c_sources = " ".join(incdirs.c_sources)
screamer 0:66f3b5499f7f 666 target_cpp_sources = " ".join(incdirs.cpp_sources)
screamer 0:66f3b5499f7f 667 target_macros = ["-D%s"% s for s in toolchain.get_symbols() + toolchain.macros]
screamer 0:66f3b5499f7f 668
screamer 0:66f3b5499f7f 669 # Common Sources
screamer 0:66f3b5499f7f 670 mbed_resources = toolchain.scan_resources(MBED_COMMON)
screamer 0:66f3b5499f7f 671
screamer 0:66f3b5499f7f 672 # Gather include paths, c, cpp sources and macros to transfer to cppcheck command line
screamer 0:66f3b5499f7f 673 mbed_includes = ["-I%s" % i for i in mbed_resources.inc_dirs]
screamer 0:66f3b5499f7f 674 mbed_includes.append("-I%s"% str(BUILD_TARGET))
screamer 0:66f3b5499f7f 675 mbed_includes.append("-I%s"% str(MBED_COMMON))
screamer 0:66f3b5499f7f 676 mbed_includes.append("-I%s"% str(MBED_API))
screamer 0:66f3b5499f7f 677 mbed_includes.append("-I%s"% str(MBED_HAL))
screamer 0:66f3b5499f7f 678 mbed_c_sources = " ".join(mbed_resources.c_sources)
screamer 0:66f3b5499f7f 679 mbed_cpp_sources = " ".join(mbed_resources.cpp_sources)
screamer 0:66f3b5499f7f 680
screamer 0:66f3b5499f7f 681 target_includes = map(str.strip, target_includes)
screamer 0:66f3b5499f7f 682 mbed_includes = map(str.strip, mbed_includes)
screamer 0:66f3b5499f7f 683 target_macros = map(str.strip, target_macros)
screamer 0:66f3b5499f7f 684
screamer 0:66f3b5499f7f 685 check_cmd = CPPCHECK_CMD
screamer 0:66f3b5499f7f 686 check_cmd += CPPCHECK_MSG_FORMAT
screamer 0:66f3b5499f7f 687 check_cmd += target_includes
screamer 0:66f3b5499f7f 688 check_cmd += mbed_includes
screamer 0:66f3b5499f7f 689 check_cmd += target_macros
screamer 0:66f3b5499f7f 690
screamer 0:66f3b5499f7f 691 # We need to pass some parames via file to avoid "command line too long in some OSs"
screamer 0:66f3b5499f7f 692 tmp_file = tempfile.NamedTemporaryFile(delete=False)
screamer 0:66f3b5499f7f 693 tmp_file.writelines(line + '\n' for line in target_c_sources.split())
screamer 0:66f3b5499f7f 694 tmp_file.writelines(line + '\n' for line in target_cpp_sources.split())
screamer 0:66f3b5499f7f 695 tmp_file.writelines(line + '\n' for line in mbed_c_sources.split())
screamer 0:66f3b5499f7f 696 tmp_file.writelines(line + '\n' for line in mbed_cpp_sources.split())
screamer 0:66f3b5499f7f 697 tmp_file.close()
screamer 0:66f3b5499f7f 698 check_cmd += ["--file-list=%s"% tmp_file.name]
screamer 0:66f3b5499f7f 699
screamer 0:66f3b5499f7f 700 _stdout, _stderr, _rc = run_cmd_ext(check_cmd)
screamer 0:66f3b5499f7f 701 if verbose:
screamer 0:66f3b5499f7f 702 print _stdout
screamer 0:66f3b5499f7f 703 print _stderr
screamer 0:66f3b5499f7f 704
screamer 0:66f3b5499f7f 705
screamer 0:66f3b5499f7f 706 def static_analysis_scan_lib(lib_id, target, toolchain, cppcheck_cmd, cppcheck_msg_format,
screamer 0:66f3b5499f7f 707 options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, extra_verbose=False):
screamer 0:66f3b5499f7f 708 lib = Library(lib_id)
screamer 0:66f3b5499f7f 709 if lib.is_supported(target, toolchain):
screamer 0:66f3b5499f7f 710 static_analysis_scan_library(lib.source_dir, lib.build_dir, target, toolchain, cppcheck_cmd, cppcheck_msg_format,
screamer 0:66f3b5499f7f 711 lib.dependencies, options,
screamer 0:66f3b5499f7f 712 verbose=verbose, clean=clean, macros=macros, notify=notify, jobs=jobs, extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 713 else:
screamer 0:66f3b5499f7f 714 print 'Library "%s" is not yet supported on target %s with toolchain %s'% (lib_id, target.name, toolchain)
screamer 0:66f3b5499f7f 715
screamer 0:66f3b5499f7f 716
screamer 0:66f3b5499f7f 717 def static_analysis_scan_library(src_paths, build_path, target, toolchain_name, cppcheck_cmd, cppcheck_msg_format,
screamer 0:66f3b5499f7f 718 dependencies_paths=None, options=None, name=None, clean=False,
screamer 0:66f3b5499f7f 719 notify=None, verbose=False, macros=None, jobs=1, extra_verbose=False):
screamer 0:66f3b5499f7f 720 """ Function scans library (or just some set of sources/headers) for staticly detectable defects """
screamer 0:66f3b5499f7f 721 if type(src_paths) != ListType:
screamer 0:66f3b5499f7f 722 src_paths = [src_paths]
screamer 0:66f3b5499f7f 723
screamer 0:66f3b5499f7f 724 for src_path in src_paths:
screamer 0:66f3b5499f7f 725 if not exists(src_path):
screamer 0:66f3b5499f7f 726 raise Exception("The library source folder does not exist: %s", src_path)
screamer 0:66f3b5499f7f 727
screamer 0:66f3b5499f7f 728 # Toolchain instance
screamer 0:66f3b5499f7f 729 toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, extra_verbose=extra_verbose)
screamer 0:66f3b5499f7f 730 toolchain.VERBOSE = verbose
screamer 0:66f3b5499f7f 731 toolchain.jobs = jobs
screamer 0:66f3b5499f7f 732
screamer 0:66f3b5499f7f 733 # The first path will give the name to the library
screamer 0:66f3b5499f7f 734 name = basename(src_paths[0])
screamer 0:66f3b5499f7f 735 toolchain.info("Static analysis for library %s (%s, %s)" % (name.upper(), target.name, toolchain_name))
screamer 0:66f3b5499f7f 736
screamer 0:66f3b5499f7f 737 # Scan Resources
screamer 0:66f3b5499f7f 738 resources = []
screamer 0:66f3b5499f7f 739 for src_path in src_paths:
screamer 0:66f3b5499f7f 740 resources.append(toolchain.scan_resources(src_path))
screamer 0:66f3b5499f7f 741
screamer 0:66f3b5499f7f 742 # Dependencies Include Paths
screamer 0:66f3b5499f7f 743 dependencies_include_dir = []
screamer 0:66f3b5499f7f 744 if dependencies_paths is not None:
screamer 0:66f3b5499f7f 745 for path in dependencies_paths:
screamer 0:66f3b5499f7f 746 lib_resources = toolchain.scan_resources(path)
screamer 0:66f3b5499f7f 747 dependencies_include_dir.extend(lib_resources.inc_dirs)
screamer 0:66f3b5499f7f 748
screamer 0:66f3b5499f7f 749 # Create the desired build directory structure
screamer 0:66f3b5499f7f 750 bin_path = join(build_path, toolchain.obj_path)
screamer 0:66f3b5499f7f 751 mkdir(bin_path)
screamer 0:66f3b5499f7f 752 tmp_path = join(build_path, '.temp', toolchain.obj_path)
screamer 0:66f3b5499f7f 753 mkdir(tmp_path)
screamer 0:66f3b5499f7f 754
screamer 0:66f3b5499f7f 755 # Gather include paths, c, cpp sources and macros to transfer to cppcheck command line
screamer 0:66f3b5499f7f 756 includes = ["-I%s" % i for i in dependencies_include_dir + src_paths]
screamer 0:66f3b5499f7f 757 c_sources = " "
screamer 0:66f3b5499f7f 758 cpp_sources = " "
screamer 0:66f3b5499f7f 759 macros = ['-D%s' % s for s in toolchain.get_symbols() + toolchain.macros]
screamer 0:66f3b5499f7f 760
screamer 0:66f3b5499f7f 761 # Copy Headers
screamer 0:66f3b5499f7f 762 for resource in resources:
screamer 0:66f3b5499f7f 763 toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path)
screamer 0:66f3b5499f7f 764 includes += ["-I%s" % i for i in resource.inc_dirs]
screamer 0:66f3b5499f7f 765 c_sources += " ".join(resource.c_sources) + " "
screamer 0:66f3b5499f7f 766 cpp_sources += " ".join(resource.cpp_sources) + " "
screamer 0:66f3b5499f7f 767
screamer 0:66f3b5499f7f 768 dependencies_include_dir.extend(toolchain.scan_resources(build_path).inc_dirs)
screamer 0:66f3b5499f7f 769
screamer 0:66f3b5499f7f 770 includes = map(str.strip, includes)
screamer 0:66f3b5499f7f 771 macros = map(str.strip, macros)
screamer 0:66f3b5499f7f 772
screamer 0:66f3b5499f7f 773 check_cmd = cppcheck_cmd
screamer 0:66f3b5499f7f 774 check_cmd += cppcheck_msg_format
screamer 0:66f3b5499f7f 775 check_cmd += includes
screamer 0:66f3b5499f7f 776 check_cmd += macros
screamer 0:66f3b5499f7f 777
screamer 0:66f3b5499f7f 778 # We need to pass some parameters via file to avoid "command line too long in some OSs"
screamer 0:66f3b5499f7f 779 # Temporary file is created to store e.g. cppcheck list of files for command line
screamer 0:66f3b5499f7f 780 tmp_file = tempfile.NamedTemporaryFile(delete=False)
screamer 0:66f3b5499f7f 781 tmp_file.writelines(line + '\n' for line in c_sources.split())
screamer 0:66f3b5499f7f 782 tmp_file.writelines(line + '\n' for line in cpp_sources.split())
screamer 0:66f3b5499f7f 783 tmp_file.close()
screamer 0:66f3b5499f7f 784 check_cmd += ["--file-list=%s"% tmp_file.name]
screamer 0:66f3b5499f7f 785
screamer 0:66f3b5499f7f 786 # This will allow us to grab result from both stdio and stderr outputs (so we can show them)
screamer 0:66f3b5499f7f 787 # We assume static code analysis tool is outputting defects on STDERR
screamer 0:66f3b5499f7f 788 _stdout, _stderr, _rc = run_cmd_ext(check_cmd)
screamer 0:66f3b5499f7f 789 if verbose:
screamer 0:66f3b5499f7f 790 print _stdout
screamer 0:66f3b5499f7f 791 print _stderr
screamer 0:66f3b5499f7f 792
screamer 0:66f3b5499f7f 793
screamer 0:66f3b5499f7f 794 def print_build_results(result_list, build_name):
screamer 0:66f3b5499f7f 795 """ Generate result string for build results """
screamer 0:66f3b5499f7f 796 result = ""
screamer 0:66f3b5499f7f 797 if len(result_list) > 0:
screamer 0:66f3b5499f7f 798 result += build_name + "\n"
screamer 0:66f3b5499f7f 799 result += "\n".join([" * %s" % f for f in result_list])
screamer 0:66f3b5499f7f 800 result += "\n"
screamer 0:66f3b5499f7f 801 return result
screamer 0:66f3b5499f7f 802
screamer 0:66f3b5499f7f 803 def write_build_report(build_report, template_filename, filename):
screamer 0:66f3b5499f7f 804 build_report_failing = []
screamer 0:66f3b5499f7f 805 build_report_passing = []
screamer 0:66f3b5499f7f 806
screamer 0:66f3b5499f7f 807 for report in build_report:
screamer 0:66f3b5499f7f 808 if len(report["failing"]) > 0:
screamer 0:66f3b5499f7f 809 build_report_failing.append(report)
screamer 0:66f3b5499f7f 810 else:
screamer 0:66f3b5499f7f 811 build_report_passing.append(report)
screamer 0:66f3b5499f7f 812
screamer 0:66f3b5499f7f 813 env = Environment(extensions=['jinja2.ext.with_'])
screamer 0:66f3b5499f7f 814 env.loader = FileSystemLoader('ci_templates')
screamer 0:66f3b5499f7f 815 template = env.get_template(template_filename)
screamer 0:66f3b5499f7f 816
screamer 0:66f3b5499f7f 817 with open(filename, 'w+') as f:
screamer 0:66f3b5499f7f 818 f.write(template.render(failing_builds=build_report_failing, passing_builds=build_report_passing))
screamer 1:a99c8e460c5c 819
screamer 2:07730b0f452c 820 def get_build_profile(path):
screamer 1:a99c8e460c5c 821 profile = None
screamer 1:a99c8e460c5c 822 builds = get_build_ids(path)
screamer 1:a99c8e460c5c 823 for build in builds:
screamer 1:a99c8e460c5c 824 if MBED_SDK_REV_MAP.has_key(build):
screamer 1:a99c8e460c5c 825 idx = MBED_SDK_REV_MAP[build]
screamer 1:a99c8e460c5c 826
screamer 1:a99c8e460c5c 827 if idx is None:
screamer 1:a99c8e460c5c 828 profile = 'v5'
screamer 1:a99c8e460c5c 829 elif idx <= 43:
screamer 1:a99c8e460c5c 830 profile = 'v1'
screamer 1:a99c8e460c5c 831 elif idx <= 68:
screamer 2:07730b0f452c 832 profile = 'v2'
screamer 1:a99c8e460c5c 833 elif idx <= 76:
screamer 1:a99c8e460c5c 834 profile = 'v3'
screamer 1:a99c8e460c5c 835 elif idx <= 105:
screamer 1:a99c8e460c5c 836 profile = 'v4'
screamer 1:a99c8e460c5c 837 else:
screamer 1:a99c8e460c5c 838 profile = 'v5'
screamer 1:a99c8e460c5c 839
screamer 1:a99c8e460c5c 840 return profile
screamer 1:a99c8e460c5c 841
screamer 1:a99c8e460c5c 842 def get_build_ids(path):
screamer 1:a99c8e460c5c 843 builds = []
screamer 1:a99c8e460c5c 844
screamer 1:a99c8e460c5c 845 for (root, dirs, files) in walk(path):
screamer 1:a99c8e460c5c 846 for d in copy(dirs):
screamer 1:a99c8e460c5c 847 if d.startswith('.'):
screamer 1:a99c8e460c5c 848 dirs.remove(d)
screamer 1:a99c8e460c5c 849
screamer 1:a99c8e460c5c 850 for filename in filter(lambda s: s.endswith(".bld"), files):
screamer 1:a99c8e460c5c 851 try:
screamer 1:a99c8e460c5c 852 # TODO check user has permission to link against build
screamer 1:a99c8e460c5c 853 url = open(join(root, filename), 'r').read()
screamer 1:a99c8e460c5c 854 builds.append(re.sub(r'^.+/(.*?)$', r'\1', url))
screamer 1:a99c8e460c5c 855 except:
screamer 1:a99c8e460c5c 856 pass
screamer 1:a99c8e460c5c 857
screamer 1:a99c8e460c5c 858 return builds
screamer 1:a99c8e460c5c 859
screamer 1:a99c8e460c5c 860 MBED_SDK_REV_MAP = {
screamer 1:a99c8e460c5c 861 '8ed44a420e5c': 105,
screamer 1:a99c8e460c5c 862 'b9ad9a133dc7': 104,
screamer 1:a99c8e460c5c 863 'bad568076d81': 103,
screamer 1:a99c8e460c5c 864 'da0ca467f8b5': 102,
screamer 1:a99c8e460c5c 865 '7cff1c4259d7': 101,
screamer 1:a99c8e460c5c 866 'cbbeb26dbd92': 100,
screamer 1:a99c8e460c5c 867 'dbbf35b96557': 99,
screamer 1:a99c8e460c5c 868 '8ab26030e058': 98,
screamer 1:a99c8e460c5c 869 '433970e64889': 97,
screamer 1:a99c8e460c5c 870 '487b796308b0': 96,
screamer 1:a99c8e460c5c 871 '7e07b6fb45cf': 95,
screamer 1:a99c8e460c5c 872 '9ad691361fac': 94,
screamer 1:a99c8e460c5c 873 'e188a91d3eaa': 93,
screamer 1:a99c8e460c5c 874 '4fc01daae5a5': 92,
screamer 1:a99c8e460c5c 875 '031413cf7a89': 91,
screamer 1:a99c8e460c5c 876 'cb3d968589d8': 90,
screamer 1:a99c8e460c5c 877 '552587b429a1': 89,
screamer 1:a99c8e460c5c 878 '9327015d4013': 88,
screamer 1:a99c8e460c5c 879 '6213f644d804': 87,
screamer 1:a99c8e460c5c 880 '04dd9b1680ae': 86,
screamer 1:a99c8e460c5c 881 '024bf7f99721': 85,
screamer 1:a99c8e460c5c 882 '0b3ab51c8877': 84,
screamer 1:a99c8e460c5c 883 '8a40adfe8776': 83,
screamer 1:a99c8e460c5c 884 '6473597d706e': 82,
screamer 1:a99c8e460c5c 885 '7d30d6019079': 81,
screamer 1:a99c8e460c5c 886 '8e73be2a2ac1': 80,
screamer 1:a99c8e460c5c 887 '0c05e21ae27e': 79,
screamer 1:a99c8e460c5c 888 'ed8466a608b4': 78,
screamer 1:a99c8e460c5c 889 '869cf507173a': 77,
screamer 1:a99c8e460c5c 890 '824293ae5e43': 76,
screamer 1:a99c8e460c5c 891 'dc225afb6914': 75,
screamer 1:a99c8e460c5c 892 'a842253909c9': 74,
screamer 1:a99c8e460c5c 893 '1efda918f0ba': 73,
screamer 1:a99c8e460c5c 894 '4096f863f923': 72,
screamer 1:a99c8e460c5c 895 '8fabd470bb6e': 71,
screamer 1:a99c8e460c5c 896 '673126e12c73': 70,
screamer 1:a99c8e460c5c 897 '4a7918f48478': 69,
screamer 1:a99c8e460c5c 898 'f37f3b9c9f0b': 68,
screamer 1:a99c8e460c5c 899 'a9913a65894f': 67,
screamer 1:a99c8e460c5c 900 '9c8f0e3462fb': 66,
screamer 1:a99c8e460c5c 901 '5798e58a58b1': 65,
screamer 1:a99c8e460c5c 902 'e3affc9e7238': 64,
screamer 1:a99c8e460c5c 903 'b3110cd2dd17': 63,
screamer 1:a99c8e460c5c 904 '7e6c9f46b3bd': 62,
screamer 1:a99c8e460c5c 905 '5e5da4a5990b': 61,
screamer 1:a99c8e460c5c 906 '3d0ef94e36ec': 60,
screamer 1:a99c8e460c5c 907 '0883845fe643': 59,
screamer 1:a99c8e460c5c 908 '0954ebd79f59': 58,
screamer 1:a99c8e460c5c 909 '0480438fc29c': 57,
screamer 1:a99c8e460c5c 910 '3753e96f3c8b': 56,
screamer 1:a99c8e460c5c 911 'd722ed6a4237': 55,
screamer 1:a99c8e460c5c 912 '71b101360fb9': 54,
screamer 1:a99c8e460c5c 913 '63cdd78b2dc1': 53,
screamer 1:a99c8e460c5c 914 '09236a68d21b': 52,
screamer 1:a99c8e460c5c 915 'a076018f59af': 51,
screamer 1:a99c8e460c5c 916 'b60934f96c0c': 50,
screamer 1:a99c8e460c5c 917 'eeb8a2a33ec9': 49,
screamer 1:a99c8e460c5c 918 '49c296715c73': 48,
screamer 1:a99c8e460c5c 919 '134def52cfa0': 47,
screamer 1:a99c8e460c5c 920 '890817bdcffb': 46,
screamer 1:a99c8e460c5c 921 '3d775a932e1d': 45,
screamer 1:a99c8e460c5c 922 '24d45a770a51': 44,
screamer 1:a99c8e460c5c 923 'e2ed12d17f06': 43,
screamer 1:a99c8e460c5c 924 'cd19af002ccc': 42,
screamer 1:a99c8e460c5c 925 '10b9abbe79a6': 41,
screamer 1:a99c8e460c5c 926 '976df7c37ad5': 40,
screamer 1:a99c8e460c5c 927 '737756e0b479': 39,
screamer 1:a99c8e460c5c 928 '4c0c40fd0593': 38,
screamer 1:a99c8e460c5c 929 '14f4805c468c': 37,
screamer 1:a99c8e460c5c 930 'b4b9f287a47e': 36,
screamer 1:a99c8e460c5c 931 '5284544d04b6': 35,
screamer 1:a99c8e460c5c 932 '7495d544864f': 34,
screamer 1:a99c8e460c5c 933 '5364839841bd': 33,
screamer 1:a99c8e460c5c 934 '3b05dd009342': 32,
screamer 1:a99c8e460c5c 935 'a7ef757f598c': 31,
screamer 1:a99c8e460c5c 936 '3991a86798e3': 30,
screamer 1:a99c8e460c5c 937 '078e4b97a13e': 29,
screamer 1:a99c8e460c5c 938 '667d61c9177b': 28,
screamer 1:a99c8e460c5c 939 '7110ebee3484': 27,
screamer 1:a99c8e460c5c 940 '63bcd7ba4912': 26,
screamer 1:a99c8e460c5c 941 '9a9732ce53a1': 25,
screamer 1:a99c8e460c5c 942 'e2ac27c8e93e': 24,
screamer 1:a99c8e460c5c 943 '74b8d43b5817': 23,
screamer 1:a99c8e460c5c 944 '9114680c05da': 22,
screamer 1:a99c8e460c5c 945 '3944f1e2fa4f': 21,
screamer 1:a99c8e460c5c 946 '029aa53d7323': 20,
screamer 1:a99c8e460c5c 947 'e6be4cd80aad': 19,
screamer 1:a99c8e460c5c 948 'b3c9f16cbb96': 18,
screamer 1:a99c8e460c5c 949 '49a220cc26e0': 17,
screamer 1:a99c8e460c5c 950 '32af5db564d4': 16,
screamer 1:a99c8e460c5c 951 'd1a9de3f4fe0': 15,
screamer 1:a99c8e460c5c 952 '20a79241b4a0': 14,
screamer 1:a99c8e460c5c 953 'a0336ede94ce': 13,
screamer 1:a99c8e460c5c 954 'f63353af7be8': 12,
screamer 1:a99c8e460c5c 955 '1c1ebd0324fa': 11,
screamer 1:a99c8e460c5c 956 'fcb9359f0959': 10,
screamer 1:a99c8e460c5c 957 'cf0d45ce28a6': 9,
screamer 1:a99c8e460c5c 958 '00a04e5cd407': 8,
screamer 1:a99c8e460c5c 959 '15d74db76485': 7,
screamer 1:a99c8e460c5c 960 '3fd6a337c7cc': 6,
screamer 1:a99c8e460c5c 961 '62573be585e9': 5,
screamer 1:a99c8e460c5c 962 '5d1359a283bc': 4,
screamer 1:a99c8e460c5c 963 'aefd12a1f1c5': 3,
screamer 1:a99c8e460c5c 964 '969fc1867111': 2,
screamer 1:a99c8e460c5c 965 '6b7f447ca868': 1,
screamer 1:a99c8e460c5c 966 '82220227f4fa': 0,
screamer 7:5af61d55adbe 967 }