Skip to content

DTS should use (one or more) prefixes on all defines #7213

@SebastianBoe

Description

@SebastianBoe

Kconfig and DTS are inconsistent in their naming convention. In Kconfig all defines are prefixed with CONFIG_. In DTS it is a mix of CONFIG_ and no prefix. Unless there is a good reason for DTS to generate macros without the CONFIG_ prefix we should start enforcing that DTS limits itself to CONFIG_.

Consistently prefixing with CONFIG_ effectively creates a namespace
and that is important for two reasons:

It reduces the likelihood of encountering aliasing issues with application code
if we can have a simple rule like:

"Preprocessor macros prefixed with CONFIG_ are reserved by the configuration system (DTS+Kconfig)."

It also makes it more predictable to a user where macros come from and therefore makes it easier to read the code, e.g. if he sees a macro:

FLASH_NRF_FLASH_WRITE_BLOCK_SIZE

vs.

CONFIG_FLASH_NRF_FLASH_WRITE_BLOCK_SIZE

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions