diff --git a/doc/guides/dts/macros.bnf b/doc/guides/dts/macros.bnf index 2af99c062b1..2b9e1dd9106 100644 --- a/doc/guides/dts/macros.bnf +++ b/doc/guides/dts/macros.bnf @@ -27,12 +27,14 @@ node-macro =/ %s"DT_N" path-id %s"_EXISTS" node-macro =/ %s"DT_N" path-id %s"_BUS" ["_" dt-name] ; The reg property is special and has its own macros. node-macro =/ %s"DT_N" path-id %s"_REG_NUM" +node-macro =/ %s"DT_N" path-id %s"_REG_IDX_" DIGIT "_EXISTS" node-macro =/ %s"DT_N" path-id %s"_REG_IDX_" DIGIT %s"_VAL_" ( %s"ADDRESS" / %s"SIZE") node-macro =/ %s"DT_N" path-id %s"_REG_NAME_" dt-name %s"_VAL_" ( %s"ADDRESS" / %s"SIZE") ; The interrupts property is also special. node-macro =/ %s"DT_N" path-id %s"_IRQ_NUM" +node-macro =/ %s"DT_N" path-id %s"_IRQ_IDX_" DIGIT "_EXISTS" node-macro =/ %s"DT_N" path-id %s"_IRQ_IDX_" DIGIT %s"_VAL_" dt-name [ %s"_EXISTS" ] node-macro =/ %s"DT_N" path-id %s"_IRQ_NAME_" dt-name diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index bc544c6f9c8..a5ef1f3d21e 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -239,6 +239,7 @@ def write_regs(node): idx_vals.append((f"{path_id}_REG_NUM", len(node.regs))) for i, reg in enumerate(node.regs): + idx_vals.append((f"{path_id}_REG_IDX_{i}_EXISTS", 1)) if reg.addr is not None: idx_macro = f"{path_id}_REG_IDX_{i}_VAL_ADDRESS" idx_vals.append((idx_macro, @@ -312,6 +313,7 @@ def write_interrupts(node): cell_value = map_arm_gic_irq_type(irq, cell_value) cell_value = encode_zephyr_multi_level_irq(irq, cell_value) + idx_vals.append((f"{path_id}_IRQ_IDX_{i}_EXISTS", 1)) idx_macro = f"{path_id}_IRQ_IDX_{i}_VAL_{name}" idx_vals.append((idx_macro, cell_value)) idx_vals.append((idx_macro + "_EXISTS", 1))