scripts: gen_defines: refactor write_special_props
Move the partition handling code into its own function and rework the comment. This is prep work for adding additional generated macros to this function. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
3252821b4c
commit
7f69a03f72
1 changed files with 16 additions and 8 deletions
|
@ -352,20 +352,16 @@ def write_special_props(node):
|
||||||
# data cannot otherwise be obtained from write_vanilla_props()
|
# data cannot otherwise be obtained from write_vanilla_props()
|
||||||
# results
|
# results
|
||||||
|
|
||||||
global flash_area_num
|
|
||||||
|
|
||||||
out_comment("Special property macros:")
|
|
||||||
|
|
||||||
# Macros that are special to the devicetree specification
|
# Macros that are special to the devicetree specification
|
||||||
|
out_comment("Macros for properties that are special in the specification:")
|
||||||
write_regs(node)
|
write_regs(node)
|
||||||
write_interrupts(node)
|
write_interrupts(node)
|
||||||
write_compatibles(node)
|
write_compatibles(node)
|
||||||
write_status(node)
|
write_status(node)
|
||||||
|
|
||||||
if node.parent and "fixed-partitions" in node.parent.compats:
|
# Macros that are special to bindings inherited from Linux, which
|
||||||
macro = f"{node.z_path_id}_PARTITION_ID"
|
# we can't capture with the current bindings language.
|
||||||
out_dt_define(macro, flash_area_num)
|
write_fixed_partitions(node)
|
||||||
flash_area_num += 1
|
|
||||||
|
|
||||||
def write_regs(node):
|
def write_regs(node):
|
||||||
# reg property: edtlib knows the right #address-cells and
|
# reg property: edtlib knows the right #address-cells and
|
||||||
|
@ -513,6 +509,18 @@ def write_status(node):
|
||||||
out_dt_define(f"{node.z_path_id}_STATUS_{str2ident(node.status)}", 1)
|
out_dt_define(f"{node.z_path_id}_STATUS_{str2ident(node.status)}", 1)
|
||||||
|
|
||||||
|
|
||||||
|
def write_fixed_partitions(node):
|
||||||
|
# Macros for child nodes of each fixed-partitions node.
|
||||||
|
|
||||||
|
if not (node.parent and "fixed-partitions" in node.parent.compats):
|
||||||
|
return
|
||||||
|
|
||||||
|
global flash_area_num
|
||||||
|
out_comment("fixed-partitions identifier:")
|
||||||
|
out_dt_define(f"{node.z_path_id}_PARTITION_ID", flash_area_num)
|
||||||
|
flash_area_num += 1
|
||||||
|
|
||||||
|
|
||||||
def write_vanilla_props(node):
|
def write_vanilla_props(node):
|
||||||
# Writes macros for any and all properties defined in the
|
# Writes macros for any and all properties defined in the
|
||||||
# "properties" section of the binding for the node.
|
# "properties" section of the binding for the node.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue