-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Shift DTS before Kconfig #12108
Shift DTS before Kconfig #12108
Conversation
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 tried to build test this, but it doesn't seem to have a solution for our use case for selecting nodes in an overlay based on kconfig:
https://github.com/foundriesio/dm-hawkbit-mqtt/blob/master/common.overlay
Is there an equivalent in DT i'm missing?
I'm not aware of any way, need to look into how true DTS overlay work more. For us to be able to truly have DTS not require Kconfig, what you are doing based on SoC and CONFIG_ defines isn't something we can support. I do think it would be interesting and useful to expand the DTC tooling to allow for conditional nodes based on some property being set. |
When building standard "hello_world" on Windows I get:
|
3853249
to
217abfa
Compare
Works fine on Windows now |
217abfa
to
d3a362a
Compare
d3a362a
to
7df543e
Compare
Is the ELCE discussion still plan of record? In particular these two:
We could definitely work with that. It would be nice to stop cluttering the top level directory of each application with $board.conf and $board.overlay files, by the way. Picking these up automatically for example would be nice:
That of course would require all of those values to be determined before running DTS, or during the first run of DTS, as discussed. Edit: and similarly for "conf mixins", of course. |
Codecov Report
@@ Coverage Diff @@
## master #12108 +/- ##
==========================================
- Coverage 53.53% 53.51% -0.02%
==========================================
Files 239 239
Lines 27052 26983 -69
Branches 6521 6518 -3
==========================================
- Hits 14482 14440 -42
+ Misses 9900 9879 -21
+ Partials 2670 2664 -6
Continue to review full report at Codecov.
|
Can we deduce the SOC from the BOARD in a similar manner to how we deduce the ARCH from the BOARD? I'm concerned that a two-pass DT approach will be difficult to reason about. |
A related Slack comment:
But we also need to extract part number information. One approach is discussed here #12073. It would be best to come up with a solution that covers all our needs. |
7df543e
to
424cfc6
Compare
424cfc6
to
b1f336d
Compare
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.
Just some small suggestions.
All checks are passing now. Review history of this comment for details about previous failed status. |
94a2f33
to
3b89b5b
Compare
@dbkinder can you review the docs again? |
@dbkinder can you look at the docs again? |
@galak I've submitted a PR for the west commands which hopefully should make it clear why CONFIG_BOOTLOADER_MCUBOOT is a big usability win: I would like to work with you to make sure we can keep the usability of building, signing, and flashing MCUboot child images in Zephyr even if DTS comes before Kconfig. Do you have time for that this week/next? Thanks! |
@galak : I believe you've posted a PR somewhere that runs DTC multiple times, is that still on the table? Or does this replace that PR? |
I think that's still on the table but for different reasons. |
3b89b5b
to
39cead0
Compare
Expose PROJECT_BINARY_DIR to kconfig since we will we looking for generated files from dts pass in the future and need to know the location of those files. Signed-off-by: Kumar Gala <[email protected]>
Based on work from Sebastian Bøe and updated to current tree. Signed-off-by: Sebastian Bøe <[email protected]> Signed-off-by: Kumar Gala <[email protected]>
As we want to remove dts dependency on Kconfig, we had a case based on CONFIG_BOOTLOADER_MCUBOOT. From a DTS point of view that was just getting the chosen property 'zephyr,code-partition' set. We can easily move this to the actual dts files and remove the mcuboot.overlay. Signed-off-by: Kumar Gala <[email protected]>
As a step to completing removing use of Kconfig defines in dts files we need to change how we configure/set CONFIG_FLASH_LOAD_{OFFSET,SIZE}. Previously we would set them based on how the chosen property 'zephyr,code-partition' was set to. If 'zephyr,code-partition' wasn't set we would default the values to 0. We had some generic overlay logic which would define 'zephyr,code-partition' based on CONFIG_BOOTLOADER_MCUBOOT. Going forward if the DTS has 'zephyr,code-partition' set we will generate DT_CODE_PARTITION_OFFSET & DT_CODE_PARTITION_SIZE defines. We will leave it to Kconfig to set CONFIG_FLASH_LOAD_OFFSET & CONFIG_FLASH_LOAD_SIZE. We introduce a python script that allows Kconfig to extract data from the DTS and thus we can utilize DT_CODE_PARTITION_OFFSET and DT_CODE_PARTITION_SIZE values to set defaults for CONFIG_FLASH_LOAD_OFFSET & CONFIG_FLASH_LOAD_SIZE. Signed-off-by: Kumar Gala <[email protected]> Signed-off-by: Carles Cufi <[email protected]>
Export a new KCONFIG_DOC_MODE environment variable when building the doc and invoking Kconfig, so that the functions that expect a build folder can accordingly return a hardcoded value. Signed-off-by: Carles Cufi <[email protected]>
Add docs on the kconfigfunctions that we support. We only expose some functions related to device tree currently. Signed-off-by: Kumar Gala <[email protected]>
dts will now generate DT_SRAM_BASE_ADDRESS, DT_SRAM_SIZE, DT_FLASH_BASE_ADDRESS, and DT_FLASH_SIZE defines. Kconfig can utilize these defines to set defaults for the CONFIG_ variants. Signed-off-by: Kumar Gala <[email protected]>
Move the how enabling of CONFIG_XIP impacts CONFIG_FLASH_SIZE and CONFIG_FLASH_BASE_ADDRESS to Kconfig instead of dts. Signed-off-by: Kumar Gala <[email protected]>
The dts files on these boards had some CONFIG_ defines related to which memory should be used to hold code. We move this choice out of DTS and back into Kconfig. As such, we removed the default setting of 'zephyr,flash' and just map CONFIG_CODE_ITCM to: DT_NXP_IMX_RT_ITCM_0_SIZE DT_NXP_IMX_RT_ITCM_0_BASE_ADDRESS CONFIG_CODE_{QSPI,HYPERFLASH} to: DT_NXP_IMX_FLEXSPI_402A8000_SIZE_1 DT_NXP_IMX_FLEXSPI_402A8000_BASE_ADDDRESS_1 for the mimxrt1050_evk, we remove the default setting of 'zephyr,sram' and just map: CONFIG_DATA_DTCM to: DT_NXP_IMX_DTCM_0_SIZE DT_NXP_IMX_DTCM_0_BASE_ADDRESS CONFIG_DATA_SDRAM to: DT_MMIO_SRAM_80000000_SIZE DT_MMIO_SRAM_80000000_BASE_ADDRESS Signed-off-by: Kumar Gala <[email protected]>
39cead0
to
ee63a78
Compare
This is a WIP PR to get feedback on the direction and code associated with moving DTS generation before Kconfig.
The general idea is that Kconfig can utilize DTS generated values for defaults or other purposes going forward, and that there will NOT be any Kconfig based symbols or ifdef's in dts files.
To keep some functionality with dts_fixup.h files working we need to split the DTS generation into 2 pieces. The first will preprocess the .dts file, compile dts, and generate the generated_dts_board.conf. The second pass will run after Kconfig since we need to know CONFIG_SOC to find all the dts_fixup.h files. The second pass will just generate the generated_dts_board.h
resolves #7302