mirror of https://github.com/ARMmbed/mbed-os.git
Allow missing toolchain parameter to get_config
parent
4c7cf21feb
commit
361fc65f08
|
@ -122,7 +122,7 @@ def add_result_to_report(report, result):
|
|||
result_wrap = {0: result}
|
||||
report[target][toolchain][id_name].append(result_wrap)
|
||||
|
||||
def get_config(src_paths, target, toolchain_name, app_config=None):
|
||||
def get_config(src_paths, target, toolchain_name=None, app_config=None):
|
||||
"""Get the configuration object for a target-toolchain combination
|
||||
|
||||
Positional arguments:
|
||||
|
@ -134,16 +134,20 @@ def get_config(src_paths, target, toolchain_name, app_config=None):
|
|||
if not isinstance(src_paths, list):
|
||||
src_paths = [src_paths]
|
||||
|
||||
# Pass all params to the unified prepare_resources()
|
||||
toolchain = prepare_toolchain(src_paths, None, target, toolchain_name,
|
||||
app_config=app_config)
|
||||
res = Resources(MockNotifier())
|
||||
if toolchain_name:
|
||||
toolchain = prepare_toolchain(src_paths, None, target, toolchain_name,
|
||||
app_config=app_config)
|
||||
config = toolchain.config
|
||||
res.scan_with_toolchain(src_paths, toolchain, exclude=False)
|
||||
else:
|
||||
config = Config(target, src_paths, app_config=app_config)
|
||||
res.scan_with_config(src_paths, config, exclude=False)
|
||||
if config.has_regions:
|
||||
_ = list(config.regions)
|
||||
|
||||
res = Resources(MockNotifier()).scan_with_toolchain(src_paths, toolchain, exclude=False)
|
||||
if toolchain.config.has_regions:
|
||||
_ = list(toolchain.config.regions)
|
||||
|
||||
cfg, macros = toolchain.config.get_config_data()
|
||||
features = toolchain.config.get_features()
|
||||
cfg, macros = config.get_config_data()
|
||||
features = config.get_features()
|
||||
return cfg, macros, features
|
||||
|
||||
def is_official_target(target_name, version):
|
||||
|
|
|
@ -54,9 +54,7 @@ if __name__ == '__main__':
|
|||
target = extract_mcus(parser, options)[0]
|
||||
|
||||
# Toolchain
|
||||
if options.tool is None:
|
||||
args_error(parser, "argument -t/--toolchain is required")
|
||||
toolchain = options.tool[0]
|
||||
toolchain = options.tool[0] if options.tool is not None else None
|
||||
|
||||
options.prefix = options.prefix or [""]
|
||||
|
||||
|
|
|
@ -373,6 +373,9 @@ class Resources(object):
|
|||
self.labels.setdefault(prefix, [])
|
||||
self.labels[prefix].extend(labels)
|
||||
|
||||
def add_target_labels(self, target):
|
||||
self._add_labels("TARGET_", target.labels)
|
||||
|
||||
def add_toolchain_labels(self, toolchain):
|
||||
for prefix, value in toolchain.get_labels().items():
|
||||
self._add_labels(prefix, value)
|
||||
|
@ -586,3 +589,15 @@ class Resources(object):
|
|||
toolchain.set_config_data(toolchain.config.get_config_data())
|
||||
|
||||
return self
|
||||
|
||||
def scan_with_config(self, src_paths, config, exclude=True, base_path=None):
|
||||
if config.target:
|
||||
self.add_target_labels(config.target)
|
||||
for path in src_paths:
|
||||
if exists(path):
|
||||
if exclude:
|
||||
self.add_directory(path, base_path, exclude_paths=[toolchain.build_dir])
|
||||
else:
|
||||
self.add_directory(path, base_path)
|
||||
config.load_resources(self)
|
||||
return self
|
||||
|
|
|
@ -2228,7 +2228,7 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
|||
else:
|
||||
target_name = target
|
||||
target = TARGET_MAP[target_name]
|
||||
cfg, _, _ = get_config(base_source_paths, target_name, toolchain_name, app_config=app_config)
|
||||
cfg, _, _ = get_config(base_source_paths, target, app_config=app_config)
|
||||
|
||||
baud_rate = 9600
|
||||
if 'platform.stdio-baud-rate' in cfg:
|
||||
|
|
Loading…
Reference in New Issue