|
20 | 20 | from os.path import dirname, abspath
|
21 | 21 | import sys
|
22 | 22 | from collections import namedtuple
|
23 |
| -from os.path import splitext |
| 23 | +from os.path import splitext, relpath |
24 | 24 | from intelhex import IntelHex
|
25 | 25 | from jinja2 import FileSystemLoader, StrictUndefined
|
26 | 26 | from jinja2.environment import Environment
|
@@ -389,25 +389,25 @@ def __init__(self, tgt, top_level_dirs=None, app_config=None):
|
389 | 389 | search for a configuration file).
|
390 | 390 | """
|
391 | 391 | config_errors = []
|
392 |
| - app_config_location = app_config |
393 |
| - if app_config_location is None: |
| 392 | + self.app_config_location = app_config |
| 393 | + if self.app_config_location is None: |
394 | 394 | for directory in top_level_dirs or []:
|
395 | 395 | full_path = os.path.join(directory, self.__mbed_app_config_name)
|
396 | 396 | if os.path.isfile(full_path):
|
397 |
| - if app_config_location is not None: |
| 397 | + if self.app_config_location is not None: |
398 | 398 | raise ConfigException("Duplicate '%s' file in '%s' and '%s'"
|
399 | 399 | % (self.__mbed_app_config_name,
|
400 |
| - app_config_location, full_path)) |
| 400 | + self.app_config_location, full_path)) |
401 | 401 | else:
|
402 |
| - app_config_location = full_path |
| 402 | + self.app_config_location = full_path |
403 | 403 | try:
|
404 |
| - self.app_config_data = json_file_to_dict(app_config_location) \ |
405 |
| - if app_config_location else {} |
| 404 | + self.app_config_data = json_file_to_dict(self.app_config_location) \ |
| 405 | + if self.app_config_location else {} |
406 | 406 | except ValueError as exc:
|
407 | 407 | self.app_config_data = {}
|
408 | 408 | config_errors.append(
|
409 | 409 | ConfigException("Could not parse mbed app configuration from %s"
|
410 |
| - % app_config_location)) |
| 410 | + % self.app_config_location)) |
411 | 411 |
|
412 | 412 | # Check the keys in the application configuration data
|
413 | 413 | unknown_keys = set(self.app_config_data.keys()) - \
|
@@ -527,6 +527,11 @@ def regions(self):
|
527 | 527 | raise ConfigException("Not enough memory on device to fit all "
|
528 | 528 | "application regions")
|
529 | 529 |
|
| 530 | + @property |
| 531 | + def report(self): |
| 532 | + return {'app_config': self.app_config_location, |
| 533 | + 'library_configs': map(relpath, self.processed_configs.keys())} |
| 534 | + |
530 | 535 | def _process_config_and_overrides(self, data, params, unit_name, unit_kind):
|
531 | 536 | """Process "config_parameters" and "target_config_overrides" into a
|
532 | 537 | given dictionary
|
|
0 commit comments