Skip to content

Commit 0e5cb66

Browse files
committed
Allow library configs to override target configs
1 parent d680cee commit 0e5cb66

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tools/config/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def get_full_name(name, unit_name, unit_kind, label=None,
117117
unit_name, unit_kind, label)))
118118
prefix = temp[0]
119119
# Check if the given parameter prefix matches the expected prefix
120-
if (unit_kind == "library" and prefix != unit_name) or \
120+
if (unit_kind == "library" and prefix not in [unit_name, "target"]) or \
121121
(unit_kind == "target" and prefix != "target"):
122122
raise ConfigException(
123123
"Invalid prefix '%s' for parameter name '%s' in '%s'" %
@@ -857,7 +857,7 @@ def get_target_config_data(self):
857857
params[full_name].set_value(val, tname, "target")
858858
return params
859859

860-
def get_lib_config_data(self):
860+
def get_lib_config_data(self, target_data):
861861
""" Read and interpret configuration data defined by libraries. It is
862862
assumed that "add_config_files" above was already called and the library
863863
configuration data exists in self.lib_config_data
@@ -866,7 +866,7 @@ def get_lib_config_data(self):
866866
"""
867867
all_params, macros = {}, {}
868868
for lib_name, lib_data in self.lib_config_data.items():
869-
all_params.update(self._process_config_and_overrides(lib_data, {},
869+
all_params.update(self._process_config_and_overrides(lib_data, target_data,
870870
lib_name,
871871
"library"))
872872
_process_macros(lib_data.get("macros", []), macros, lib_name,
@@ -901,9 +901,8 @@ def get_config_data(self):
901901
Arguments: None
902902
"""
903903
all_params = self.get_target_config_data()
904-
lib_params, macros = self.get_lib_config_data()
905-
all_params.update(lib_params)
906-
self.get_app_config_data(all_params, macros)
904+
lib_params, macros = self.get_lib_config_data(all_params)
905+
self.get_app_config_data(lib_params, macros)
907906
return all_params, macros
908907

909908
@staticmethod

0 commit comments

Comments
 (0)