Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-sdk-tools by
Diff: toolchains/__init__.py
- Revision:
- 9:2d27d77ada5c
- Parent:
- 7:5af61d55adbe
- Child:
- 12:f2e8a005c7d3
--- a/toolchains/__init__.py Tue Jun 07 11:35:02 2016 +0100 +++ b/toolchains/__init__.py Tue Jun 14 11:07:30 2016 +0100 @@ -247,7 +247,7 @@ self.PROFILE = TOOLCHAIN_PROFILES[self.name].get(profile) self.info("Using toolchain %s profile %s" % (self.name, profile)) - if 'UVISOR_PRESENT=1' in self.macros: + if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels: self.target.core = re.sub(r"F$", '', self.target.core) def get_output(self): @@ -258,7 +258,10 @@ """ msg = None - if event['type'] in ['info', 'debug']: + if not self.VERBOSE and event['type'] == 'tool_error': + msg = event['message'] + + elif event['type'] in ['info', 'debug']: msg = event['message'] elif event['type'] == 'cc': @@ -314,6 +317,7 @@ # Target and Toolchain symbols labels = self.get_labels() self.symbols = ["TARGET_%s" % t for t in labels['TARGET']] + self.symbols.extend(["FEATURE_%s" % t for t in labels['FEATURE']]) self.symbols.extend(["TOOLCHAIN_%s" % t for t in labels['TOOLCHAIN']]) # Config support @@ -332,10 +336,9 @@ # Add target's symbols self.symbols += self.target.macros # Add target's hardware - try : - self.symbols += ["DEVICE_" + feature + "=1" for feature in self.target.features] - except AttributeError : - pass + self.symbols += ["DEVICE_" + data + "=1" for data in self.target.device_has] + # Add target's features + self.symbols += ["FEATURE_" + data + "=1" for data in self.target.features] # Add extra symbols passed via 'macros' parameter self.symbols += self.macros @@ -355,6 +358,7 @@ toolchain_labels.remove('mbedToolchain') self.labels = { 'TARGET': self.target.get_labels() + ["DEBUG" if "debug-info" in self.options else "RELEASE"], + 'FEATURE': self.target.features, 'TOOLCHAIN': toolchain_labels } return self.labels @@ -422,6 +426,7 @@ if ((d.startswith('.') or d in self.legacy_ignore_dirs) or (d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or + (d.startswith('FEATURE_') and d[8:] not in labels['FEATURE']) or (d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or (d == 'TESTS')): dirs.remove(d) @@ -778,10 +783,6 @@ def default_cmd(self, command): self.debug("Command: %s"% ' '.join(command)) _stdout, _stderr, _rc = run_cmd(command) - # Print all warning / erros from stderr to console output - for error_line in _stderr.splitlines(): - print error_line - self.debug("Return: %s"% _rc) for output_line in _stdout.splitlines(): @@ -794,6 +795,7 @@ self.tool_error(line) raise ToolException(_stderr) + ### NOTIFICATIONS ### def info(self, message): self.notify({'type': 'info', 'message': message}) @@ -829,30 +831,25 @@ def mem_stats(self, map): # Creates parser object toolchain = self.__class__.__name__ - t = MemmapParser() + + # Create memap object + memap = MemapParser() + + # Parse and decode a map file + if memap.parse(abspath(map), toolchain) is False: + self.info("Unknown toolchain for memory statistics %s" % toolchain) + return - try: - with open(map, 'rt') as f: - # Decode map file depending on the toolchain - if toolchain == "ARM_STD" or toolchain == "ARM_MICRO": - t.search_objects(abspath(map), "ARM") - t.parse_map_file_armcc(f) - elif toolchain == "GCC_ARM": - t.parse_map_file_gcc(f) - elif toolchain == "IAR": - self.info("[WARNING] IAR Compiler not fully supported (yet)") - t.search_objects(abspath(map), toolchain) - t.parse_map_file_iar(f) - else: - self.info("Unknown toolchain for memory statistics %s" % toolchain) - return + # Write output to stdout in text (pretty table) format + memap.generate_output('table') - t.generate_output(sys.stdout, False) - map_out = splitext(map)[0] + "_map.json" - with open(map_out, 'w') as fo: - t.generate_output(fo, True) - except OSError: - return + # Write output to file in JSON format + map_out = splitext(map)[0] + "_map.json" + memap.generate_output('json', map_out) + + # Write output to file in CSV format for the CI + map_csv = splitext(map)[0] + "_map.csv" + memap.generate_output('csv-ci', map_csv) from tools.settings import ARM_BIN