Skip to content

Instantly share code, notes, and snippets.

@pabigot
Created February 20, 2020 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pabigot/e1851e261cea5881fab01743f65ef61c to your computer and use it in GitHub Desktop.
Save pabigot/e1851e261cea5881fab01743f65ef61c to your computer and use it in GitHub Desktop.
zephyr devicetree macro name structure
<name> ::= 'DT_' <node-id> [ '_' <suffix> ];
<init-id> ::= [A-Z]
<id-char> ::= [A-Z0-9]
<decimal> ::= [0-9]+ ;
<hexadecimal> ::= [0-9a-f]+ ;
<identifier> ::= <init-id> <id-char>* ;
<long-identifier> ::= <identifier> ( '_' <identifier> )* ;
<node-name> ::= <long-identifier> ;
<node-label> ::= <long-identifier> ;
<unit-address> ::= hexadecimal [ '_' <unit-address> ] ;
<property-name> ::= <long-identifier> ;
# An encoded vendor,model string from a "compatible" property
<compatible> ::= <long-identifier> ;
# A sequence meant to identify a specific node in the devicetree.
# Used as a prefix for node properties and to represent the node
# itself.
<node-id> ::= <node-alias> | <node-compat> | <node-inst> | <node-label> | <node-path> ;
# This name is used to reference a generic capability such as an LED
# or button.
<node-alias> ::= 'ALIAS_' + <alias> ;
# A property from the /aliases node
<alias> ::= <property-name>
# This name is used in driver instantiation
<node-inst> ::= 'INST_' <decimal> '_' <compatible> ;
# This name is used to reference by SOC-specific identifier
<node-label> ::= 'NODELABEL_' <long-identifier> ;
# This name is used to reference by full devicetree path
<node-path> ::= 'PATH_' <path> ;
<path> ::= ; # **TBD**
# Some old thing we probably want to get rid of.
<node-legacy> ::= [ <bus> '_' ] <compatible> '_' <unit_address> ;
<bus> ::= <long-identifier> ;
<suffix> ::= <property-suffix> ;
# Used to identify a property value (or value component)
<property-suffix> ::= <property-name> [ <ordinal> ] ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment