Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to device tree generation support for DT_NODELABEL_<node-label>_<FOO> generation #22555

Closed
galak opened this issue Feb 6, 2020 · 3 comments · Fixed by #23245
Closed
Assignees
Labels
Enhancement Changes/Updates/Additions to existing features

Comments

@galak
Copy link
Collaborator

galak commented Feb 6, 2020

Add support to scripts/dts/gen_defines.py to generate device tree node label based defines. These should be of the form DT_NODELABEL_<node-label>_<FOO>

So for something like:

    soc {
            flash-controller@40020000 {
                    cool_label_name: flash0: flash@0 {
                            flash0_reg: reg = < 0x0 0x100000 >;
                            };
                    };
            };
    };
/* assuming Issue #22554 - DT_PATH_ */
#define DT_NODELABEL_FLASH0_BASE_ADDRESS DT_PATH_SOC_FLASH_CONTROLLER_40020000_BASE_ADDRESS
#define DT_NODELABEL_COOL_LABEL_NAME_BASE_ADDRESS DT_PATH_SOC_FLASH_CONTROLLER_40020000_BASE_ADDRESS

NOTE: We should only generate labels for node's at this time. So the label flash0_reg on a property should NOT generate a define. In the future if we need this we should call it DT_PROP_LABEL_...

@galak galak added the Enhancement Changes/Updates/Additions to existing features label Feb 6, 2020
@galak
Copy link
Collaborator Author

galak commented Feb 6, 2020

Need to document as part of this work:

  • node labels should ideally get used rarely in the code, should be for true cases that DT_INST defines can't be used because you need to know the actual SoC/HW instance
  • If a label is used for SoC identification it should match the SoC Vendor documentation for that device.

@erwango
Copy link
Member

erwango commented Feb 7, 2020

Having a DT_NODEL_LABEL_<node-label> will be required to enable following usage

#ifdef DT_NODEL_LABEL_<node-label>
#endif

This will help removing most (all ideally) of #ifdef CONFIG_CAN_1 like macros.

@pabigot
Copy link
Collaborator

pabigot commented Feb 7, 2020

I would strongly prefer DT_NODELABEL_ as the prefix rather than introduce what appear to be syntactic subelements within the namespace identifier.

@galak galak changed the title Add support to device tree generation support for DT_NODE_LABEL_<node-label>_<FOO> generation Add support to device tree generation support for DT_NODELABEL_<node-label>_<FOO> generation Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants