-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
doc: dt: Clarify the relationship between DT and Kconfig #8507
Conversation
cc @b0661 |
I put this together in the context of a discussion in the TSC call where we decided to track the changes required to DT and Kconfig in order to achieve better integration. See #8499 for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the nit, looks good to me.
DTS describes stuff, Kconfig configures stuff.
doc/devices/dts/device_tree.rst
Outdated
|
||
As mentioned above there are several tools used to configuring the build with | ||
Zephyr. | ||
The two main ones, Device Tree and Kconfig might seem to overlap in its purpose, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "its".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good description of how we are using DeviceTree and it resolves #7230.
This isn't IMHO what the relationship between DT and Kconfig 'should' be, but that is another matter :)
Codecov Report
@@ Coverage Diff @@
## master #8507 +/- ##
=========================================
+ Coverage 63.8% 63.8% +<.01%
=========================================
Files 426 426
Lines 40890 40890
Branches 6921 6921
=========================================
+ Hits 26088 26089 +1
Misses 11666 11666
+ Partials 3136 3135 -1
Continue to review full report at Codecov.
|
* Device Tree is used to describe the **hardware** and its **boot-time | ||
configuration**. | ||
* Kconfig is used to describe which **software features** will be built into | ||
the final image, and their **configuration**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree to this general stating, I think we should clarify the use of 'chosen' node:
chosen {
zephyr,console = &uart0;
zephyr,uart-mcumgr = &uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
Device Tree specification provides the following definition:
"3.5 /chosen Node:
The /chosen node does not represent a real device in the system but describes parameters chosen or specified by the system firmware at run time. It shall be a child of the root node."
This lis kind of SW oriented configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. Where do you think we should add this information? I would not want to include it in those first 2 lines, but rather add it as a precision later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this now a bit below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically style comments, but some other content-related comments, too
doc/devices/dts/device_tree.rst
Outdated
replace or curtail the use of some Kconfig files throughout the system, and | ||
instead use device tree files to describe the configuration of device nodes. | ||
CMSIS and vendor header files can be used in conjunction with the device tree to | ||
fully describe hardware. Device tree is not intended to replace Kconfig, CMSIS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to fully replace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, it doesn't replace it at all. I will rephrase instead
doc/devices/dts/device_tree.rst
Outdated
Device Tree vs Kconfig | ||
********************** | ||
|
||
As mentioned above there are several tools used to configuring the build with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to configure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
doc/devices/dts/device_tree.rst
Outdated
|
||
As mentioned above there are several tools used to configuring the build with | ||
Zephyr. | ||
The two main ones, Device Tree and Kconfig might seem to overlap in purpose, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kconfig,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
doc/devices/dts/device_tree.rst
Outdated
As mentioned above there are several tools used to configuring the build with | ||
Zephyr. | ||
The two main ones, Device Tree and Kconfig might seem to overlap in purpose, | ||
but in fact they do not. This section is intended to serve as a reference when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
|
||
The scope of each configuration tool can be summarized as follows: | ||
|
||
* Device Tree is used to describe the **hardware** and its **boot-time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or build-time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, this might be a bit confusing, since Kconfig is also determining the build-time configuration.
So maybe
Device Tree is used to describe the hardware capabilities and configuration at build time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well actually I disagree, I think my original wording (taken form Erwan) is clearer. Boot-time here really means that, when the hardware boots. Compilation and build time are really irrelevant IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see the "its" refers to "hardware, This clarifies it.
In principle, "software" also has "boot-time" configuration.
* Device Tree is used to describe the **hardware** and its **boot-time | ||
configuration**. | ||
* Kconfig is used to describe which **software features** will be built into | ||
the final image, and their **configuration**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
firmware features?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose to phrase this differently, see last version of the commit
doc/devices/dts/device_tree.rst
Outdated
of the hardware peripheral in memory or its interrupt line. | ||
* Additional, **hardware boot-time configuration** is also described with Device | ||
Tree. This includes things like the interrupt line and IRQ priority. These | ||
might also be modifiable at runtime later, but their boot-time "default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
might also be modifiable at runtime later, but their boot-time "default" | ||
configuration is described in Device Tree. | ||
* The fact that the user intends to include **software support** for UART in the | ||
build is described in Kconfig. In this way users can opt not to include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Through Kconfig, the users can opt to....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
|
||
* Device Tree describes the presence of a radio peripheral compatible with a | ||
certain radio driver. | ||
* Additional hardware boot-time configuration settings might also be present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
default TX power in dBm if the hardware does have a simple, cross-wireless | ||
technology register for that. | ||
* Kconfig will describe which **protocol stack** is to be used with that radio. | ||
The user might decide to select BLE or 802.15.4, which will both depend on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
c44d86e
to
d8ae655
Compare
doc/devices/dts/device_tree.rst
Outdated
As mentioned above there are several tools used to configure the build with | ||
Zephyr. | ||
The two main ones, Device Tree and Kconfig, might seem to overlap in purpose, | ||
but in fact they do not. This section inteds to serve as a reference when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to: (and removing the misspelled "intends")
This section serves as a reference to help you decide whether to place
configuration items in Device Tree or Kconfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
the final image, and their **configuration**. | ||
|
||
Hence Device Tree deals mostly with hardware and Kconfig with software. A | ||
noteworthy exception is Device Tree's `chosen` keyword, which allows the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use two backticks:
``chosen``
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
Hence Device Tree deals mostly with hardware and Kconfig with software. A | ||
noteworthy exception is Device Tree's `chosen` keyword, which allows the user | ||
to select a particular instance of a hardware device to be used for a concrete | ||
purpose by the software. An example of this is using this keyword to select |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
An example of this is selecting a particular UART for use
as the system's console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Fixed.
doc/devices/dts/device_tree.rst
Outdated
purpose by the software. An example of this is using this keyword to select | ||
a particular UART to be used as the system's console. | ||
|
||
In order to further clarify this separation, let's use a particular, well-known |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete the "In order":
To further clarify this separation, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
doc/devices/dts/device_tree.rst
Outdated
Tree. This includes the UART type, its driver compatibility and certain | ||
"immutable" (i.e. not software-configurable) settings such as the base address | ||
of the hardware peripheral in memory or its interrupt line. | ||
* Additional, **hardware boot-time configuration** is also described with Device |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to Additionally,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
"immutable" (i.e. not software-configurable) settings such as the base address | ||
of the hardware peripheral in memory or its interrupt line. | ||
* Additional, **hardware boot-time configuration** is also described with Device | ||
Tree. This includes things like the interrupt line and IRQ priority. These |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change like
to such as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
|
||
* The fact that the target hardware **contains** 2 UARTs is described with Device | ||
Tree. This includes the UART type, its driver compatibility and certain | ||
"immutable" (i.e. not software-configurable) settings such as the base address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd delete the quotes on immutable
. Using the quotes implies that it might not be immutable, such as saying, Bob and his "wife" went out to dinner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, thank you. Fixed.
doc/devices/dts/device_tree.rst
Outdated
of the hardware peripheral in memory or its interrupt line. | ||
* Additional, **hardware boot-time configuration** is also described with Device | ||
Tree. This includes things like the interrupt line and IRQ priority. These | ||
may also be modifiable at runtime later, but their boot-time "default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, no need for the quotes on default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
doc/devices/dts/device_tree.rst
Outdated
build is described in Kconfig. Through the use of Kconfig, users can opt not | ||
to include support for this particular hardware item if they don't require it. | ||
|
||
Another example could be a device with a 2.4GHz, multi-protocol radio supporting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change could be
to is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
doc/devices/dts/device_tree.rst
Outdated
* Device Tree describes the presence of a radio peripheral compatible with a | ||
certain radio driver. | ||
* Additional hardware boot-time configuration settings may also be present | ||
in the Device Tree files. In this particular case it could be perhaps a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd delete the word perhaps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
doc/devices/dts/device_tree.rst
Outdated
describe hardware. Device tree is not intended to replace CMSIS or vendor | ||
include files. | ||
replace or curtail the use of some Kconfig files throughout the system, and | ||
instead use device tree files to describe the configuration of device nodes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"replace or curtail the use of some Kconfig files throughout the system, and instead use device tree files to describe the configuration of device nodes"
Isn't it rather a temporary side effect of device tree introduction?
While it makes sense to us, this might be unclear for a future Zephyr user.
I think we'd rather remove this part or provide a generic description with no reference with Kconfig, as:
"Device tree provides a unified description of a hardware system used in an application. It is used in Zephyr to describe hardware and provide a boot time configuration."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionnaly, we might want to add a reference to specification, if not already present (http://www.devicetre.org/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you. Will make the change
doc/devices/dts/device_tree.rst
Outdated
configuration is described in Device Tree. | ||
* The fact that the user intends to include **software support** for UART in the | ||
build is described in Kconfig. Through the use of Kconfig, users can opt not | ||
to include support for this particular hardware item if they don't require it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this part should be clarified as it eludes the device tree "status" property.
Should we use it?
If we use it (which I think we should do), we should mention it will take precedence and then Kconfig will be able to amend only if status is "okay". If "status" is "disabled" it won't be available in Kconfig.
If we don't use it, we'll need to change the (device tree extract scripts) code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add a comment about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny comment
doc/devices/dts/device_tree.rst
Outdated
immutable (i.e. not software-configurable) settings such as the base address | ||
of the hardware peripheral in memory or its interrupt line. | ||
* Additionally, **hardware boot-time configuration** is also described with Device | ||
Tree. This includes things such as the interrupt line and IRQ priority. These |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very particular example, changing irq/prio at runtime is going to be very rare. Use the i2c clock-frequency instead, since it's very common to change it at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've amended this now using UART baudrate
Try to clarify the scope of Device Tree vs Kconfig in order to allow Zephyr users to identify where a particular configuration option when developing an application, board support or SoC support. Fixes zephyrproject-rtos#7230 Signed-off-by: Carles Cufi <[email protected]>
@ioannisg @erwango @tbursztyka @dbkinder addressed your comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks nice
Try to clarify the scope of Device Tree vs Kconfig in order to allow
Zephyr users to identify where a particular configuration option when
developing an application, board support or SoC support.
Fixes #7230
Signed-off-by: Carles Cufi [email protected]