diff --git a/doc/guides/kconfig/index.rst b/doc/guides/kconfig/index.rst index f9ed279f935..3ea4257c74c 100644 --- a/doc/guides/kconfig/index.rst +++ b/doc/guides/kconfig/index.rst @@ -637,6 +637,10 @@ Device Tree Related Functions 'm' or 'M' divide by 1,048,576 (1 << 20) 'g' or 'G' divide by 1,073,741,824 (1 << 30) + dt_str_val(kconf, _, name): + This function looks up 'name' in the DTS generated "conf" style database + and if its found it will return the value as string. + Example Usage ============= diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index 860f6b3bbc1..ec0632c4023 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -76,8 +76,18 @@ def dt_hex_val(kconf, _, name, unit=None): return hex(d) +def dt_str_val(kconf, _, name): + """ + This function looks up 'name' in the DTS generated "conf" style database + and if its found it will return the value as string. + """ + if doc_mode or name not in dt_defines: + return "" + + return dt_defines[name].strip('\"') functions = { "dt_int_val": (dt_int_val, 1, 2), "dt_hex_val": (dt_hex_val, 1, 2), + "dt_str_val": (dt_str_val, 1, 1), }