scripts: dts: gen_defines: add DT_DEBRACKET_INTERNAL helper
Add a utility macro used to remove brackets from around a single
argument. While __DEBRACKET exists in util_internal.h, this change makes
DT independent (otherwise we should include util_internal.h, which is
another option).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py
index 6bff4cb..88fcf1c 100755
--- a/scripts/dts/gen_defines.py
+++ b/scripts/dts/gen_defines.py
@@ -102,6 +102,8 @@
with open(args.header_out, "w", encoding="utf-8") as header_file:
write_top_comment(edt)
+ write_utils()
+
# populate all z_path_id first so any children references will
# work correctly.
for node in sorted(edt.nodes, key=lambda node: node.dep_ordinal):
@@ -239,6 +241,13 @@
out_comment(s, blank_before=False)
+def write_utils():
+ # Writes utility macros
+
+ out_comment("Used to remove brackets from around a single argument")
+ out_define("DT_DEBRACKET_INTERNAL(...)", "__VA_ARGS__")
+
+
def write_node_comment(node):
# Writes a comment describing 'node' to the header and configuration file