-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
kconfig: BT: Default to using BT_CTLR when BT #9499
kconfig: BT: Default to using BT_CTLR when BT #9499
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.
This will enable BT_CTLR
even if BT
isn't enabled, because the default that gets added to BT_CTLR
symbol after dependency propagation is default y if BOARD_NRF52810_PCA10040
.
That should be fine as long as no code makes decisions based on BT_CTLR
without looking at BT
first though.
If it's not fine, an if BT
could be added. This aspect of Kconfig.defconfig files is a bit wonky. They work more like an OR than an AND.
44ad8ce
to
6f0cb5b
Compare
boards/arm/nrf52810_pca10040/Kconfig
Outdated
@@ -11,4 +11,12 @@ config BOARD_ENABLE_DCDC | |||
select SOC_DCDC_NRF52X | |||
default y | |||
|
|||
if BT |
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.
A space after an if
and before an endif
looks less cramped, imo.
That is not fine, added an if. Thank you for catching this. I wonder what the cleanest solution here is. I am not familiar with BT, but if there are multiple implementations of the controller available, e.g. off-chip, or on-chip. And it only makes sense to enable one of them, then I wonder if a choice statement and maybe different defaults depending on the board would be the cleanest solution. |
Looks like there's also a dependency on |
6f0cb5b
to
bf91268
Compare
If there's only two options, a plain |
I believe there are several, but a BT expert would have to chime in. |
boards/arm/nrf52810_pca10040/Kconfig
Outdated
# BT_CTLR depends on BT. When BT is enabled we should default to also | ||
# enabling the controller. | ||
config BT_CTLR | ||
default y |
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.
Could also do default y if BT
by the way, which saves some lines. No super strong opinions though.
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.
agree, no need of if BT, use default y if BT.
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.
Done
boards/arm/nrf52810_pca10040/Kconfig
Outdated
# BT_CTLR depends on BT. When BT is enabled we should default to also | ||
# enabling the controller. | ||
config BT_CTLR | ||
default y |
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.
agree, no need of if BT, use default y if BT.
As reported in issue zephyrproject-rtos#9494, BT samples are using the off-chip UART-based BT controller on 52810. But the on-chip BT controller is supported on 52810, so this is the reasonable default when BT is enabled. This patch enables BT_CTLR by default when BT is enabled. This resolves zephyrproject-rtos#9494. Signed-off-by: Sebastian Bøe <[email protected]>
bf91268
to
d98c2f0
Compare
@ulfalizer : While we are on the topic. What is the cleanest way to have boards affect the defaults of the kernel? E.g. how should a board change the default choice in a Kconfig like this?
What I have done in this patch is not clean, as you need to duplicate the dependency information of the original config. |
The choice would have to have a name:
The default could then be changed with an additional definition in a Kconfig.defconfig file:
(In this case, there's no need to repeat the dependency information, because the choice symbols won't be visible unless
Yeah, that's a drawback of Kconfig.defconfig files in general I think. The extra symbol definitions can't "limit" the base definition of the symbol/choice, only extend it. That means you might have to duplicate a bunch of dependency information. For symbols that you know will be visible (that have satisfied dependencies), it's cleaner to set them in a Setting a only potentially visible symbol (a symbol with that has a prompt that but might not be visible by default) in a (Setting a value in a |
Codecov Report
@@ Coverage Diff @@
## master #9499 +/- ##
=======================================
Coverage 52.22% 52.22%
=======================================
Files 212 212
Lines 25948 25948
Branches 5577 5577
=======================================
Hits 13551 13551
Misses 10140 10140
Partials 2257 2257 Continue to review full report at Codecov.
|
Knowing how dependency propagation works might clarify why it works like that. Say you have a symbol with two definitions:
(I just made it a Those definitions are logically equivalent to the following definitions (this is what happens internally as well):
Symbols with multiple definitions just get all the properties from the different definition locations, so the symbol finally ends up like this:
Note that the properties from the second definition did not get a dependency on |
Thank you for the explanation.
I don't understand the difference between the situation with FEATURE and the situation with BT_CTLR. Is it because one uses 'choice' symbols, and the other uses normal symbols? Because BT_CTLR is also invisible unless BT is enabled. |
Yeah, it's just a subtlety specific to choices. When Choices are a bit wonky in general. Lots of complexity around them... |
Never mind, I understood it now, your explanation was great.
|
@cvinayak : Review comments have been addressed. Please re-evaluate the review. |
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 OK, just minor suggestions from me.
# BT_CTLR depends on BT. When BT is enabled we should default to also | ||
# enabling the controller. | ||
config BT_CTLR | ||
default y if BT |
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.
Now this looks better, @SebastianBoe (with the dependence on BT)
@@ -11,4 +11,9 @@ config BOARD_ENABLE_DCDC | |||
select SOC_DCDC_NRF52X | |||
default y | |||
|
|||
# BT_CTLR depends on BT. When BT is enabled we should default to also |
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 "should"
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.
LGTM
As reported in issue #9494, BT samples are using the off-chip
UART-based BT controller on 52810. But the on-chip BT controller is
supported on 52810, so this is the reasonable default when BT is
enabled.
This patch enables BT_CTLR by default when BT is enabled.
This resolves #9494.
Signed-off-by: Sebastian Bøe [email protected]