kconfig: add dt_nodelabel_path() helper
This helper allows setting default Kconfig values based on devicetree node properties without giving the full path to the node. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
0682c46fb9
commit
1fff2358db
1 changed files with 15 additions and 0 deletions
|
@ -349,6 +349,20 @@ def dt_nodelabel_has_compat(kconf, _, label, compat):
|
|||
return "n"
|
||||
|
||||
|
||||
def dt_nodelabel_path(kconf, _, label):
|
||||
"""
|
||||
This function takes a node label (not a label property) and
|
||||
returns the path to the node which has that label, or an empty
|
||||
string if there is no such node.
|
||||
"""
|
||||
if doc_mode or edt is None:
|
||||
return ""
|
||||
|
||||
node = edt.label2node.get(label)
|
||||
|
||||
return node.path if node else ""
|
||||
|
||||
|
||||
def shields_list_contains(kconf, _, shield):
|
||||
"""
|
||||
Return "n" if cmake environment variable 'SHIELD_AS_LIST' doesn't exist.
|
||||
|
@ -381,5 +395,6 @@ functions = {
|
|||
"dt_node_int_prop_int": (dt_node_int_prop, 2, 2),
|
||||
"dt_node_int_prop_hex": (dt_node_int_prop, 2, 2),
|
||||
"dt_nodelabel_has_compat": (dt_nodelabel_has_compat, 2, 2),
|
||||
"dt_nodelabel_path": (dt_nodelabel_path, 1, 1),
|
||||
"shields_list_contains": (shields_list_contains, 1, 1),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue