-
Notifications
You must be signed in to change notification settings - Fork 0
kconfig: review proposal on PR#53338 #1
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
Changes from all commits
2240cc5
04870f5
17cbb1b
4c4632e
3cb0c74
eb84c8c
9cba2fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ config PICOLIBC_SUPPORTED | |
bool | ||
depends on ARC || ARM || ARM64 || MIPS || RISCV | ||
depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "arcmwdt" | ||
# Picolibc with C++ support in Zephyr SDK is handled by Zephyr SDK's own Kconfig. | ||
depends on !(CPLUSPLUS && "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr") | ||
default y | ||
help | ||
Selected when the target has support for picolibc. | ||
|
@@ -42,6 +44,7 @@ config PICOLIBC | |
select THREAD_LOCAL_STORAGE if ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE | ||
select LIBC_ERRNO if THREAD_LOCAL_STORAGE | ||
depends on !NATIVE_APPLICATION | ||
depends on PICOLIBC_SUPPORTED | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd left this out as external toolchains may not indicate picolibc support? How do we detect newlib support for those? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Kconfig ? we don't. We do have the but was intended for twister filtering, as seen in zephyrproject-rtos#12393 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. created: zephyrproject-rtos#53856 |
||
help | ||
Build with picolibc library. The picolibc library is built as | ||
a module if PICOLIBC_MODULE is set, otherwise picolibc is | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,10 @@ | |
if PICOLIBC | ||
|
||
config PICOLIBC_USE_MODULE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here's the dependency loop if we want to base There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, The fact that See also other comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, I was just thinking about this incorrectly -- I was thinking that |
||
bool "Use picolibc module" | ||
bool "Picolibc as module" | ||
default y | ||
select PICOLIBC_MODULE | ||
depends on ZEPHYR_PICOLIBC_MODULE | ||
depends on !CPLUSPLUS | ||
help | ||
Use picolibc module instead of picolibc included with toolchain | ||
|
||
|
@@ -148,6 +149,6 @@ config PICOLIBC_GLOBAL_ERRNO | |
which can be used to avoid TLS variable usage by the library if | ||
necessary. | ||
|
||
endif # PICOLIBC_USE_MODULE | ||
endif # PICOLIBC_MODULE | ||
|
||
endif # PICOLIBC |
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 definitely feels wrong --
PICOLIBC_SUPPORTED
is true for everything except building with C++ and using picolibc from the module source. Every toolchain other than zephyr 0.15 and earlier may include picolibc, and may (or may not) include C++ support. I think we want to make the user responsible for determining whether the toolchain has the necessary bits in that case?Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks for your feedback @keith-packard, highly appreciated so that we can get things right.
Especially because Kconfig and good dependencies can be tricky.
I tried to give the reason here:
zephyrproject-rtos#53338 (review)
But let's take one step back, so that we are clear.
Support in this case can be supporting picolibc built as a module or if the toolchain has built-in support.
(My understanding, please correct me if arcmwdt does support using picolibc as a module)
This depends on actual toolchain build configuration and / or version.
Zephyr don't have toolchain testing in place for this kind of testing, so it's users responsibility to ensure picolibc is supported when using such toolchain. Thus Kconfig should always provide the possibility to select picolibc when such a toolchain is used.
For 3rd party toolchains, it's the users responsibility to know if toolchain supports built-in version, as described in 1.iv.
This gives us the
PICOLIBC
choice entry in Kconfig underLIBC_IMPLEMENTATION
choice menu.To minimize number of tests and dependencies in
PICOLIBC
entry we create the helper symbolPICOLIBC_SUPPORTED
This allows a simple:
The
PICOLIBC_SUPPORTED
then defines ifPICOLIBC
should be available for user control.Combining above, then this gives
PICOLIBC_SUPPORTED=y
in following cases:(3rd party toolchain && !arcmwdt) || (zephyr-sdk==0.15 && !C++) || (zephyr-sdk>=0.16)
As a toolchain which is not arcmwdt and not Zephyr must be a 3rd party toolchain, then the above can be reduced to:
(!arcmwdt && !zephyr-sdk) || (zephyr-sdk && !C++)
Because ZEPHYR_TOOLCHAIN_VARIANT cannot be arcmwdt and Zephyr at the same time, the above can be written as:
(!arcmwdt) && !(zephyr-sdk && C++)
The last part:
|| (zephyr-sdk>=0.16)
is what is included when Zephyr SDK 0.16 is included, cause then the Kconfig from there is sourced, and you'll have the following in Kconfig:
Two
depends on
in same setting translates into&&
.depends on
in two configs of identical name translates into||
.An Zephyr-sdk 0.15 does not include the
zephyr-sdk-0.16/cmake/zephyr/Kconfig
, so therefore only the first part remains.All of this only covers picolibc itself.
Whether to use picolibc as a module is then dependent on picolibc being used.
For example a user selecting
NEWLIB
should not be able to selectPICOLIBC_USE_MODULE
, and picolibc as a module should not be selectable if C++ is enabled (AFAIU).And ofcourse it also depends on the Zephyr picolibc module being present in the workspace (west manifest)
Bullet 2. above therfore gives:
No dependency loops in this description.
Of course both PICOLIBC when using a certain Zephyr SDK version depends on !C++ and so does the use of
PICOLIBC_USE_MODULE
, but that is not a loop.A dependency loop in Kconfig forms if one of them suddenly starts to
select CPLUSPLUS
.Of course if any assumptions in 1. and 2. are wrong, then the implementation is wrong.