lib/libc: picolibc: select its source with Kconfig choice
Implement the selection of the picolibc source in a Kconfig choice as they are mutually exclusive. The following table represents the possible choices, where 'X' means that `PICOLIBC_SUPPORTED=n` and is guarded in the parent level as `PICOLIBC=n`, so we do not need to care. Module Toolchain C++ | Choice 0 0 0 | X 0 0 1 | X 0 1 0 | Toolchain only 0 1 1 | Toolchain only 1 0 0 | Module only 1 0 1 | X 1 1 0 | Toolchain/Module 1 1 1 | Toolchain only The current implementation favors `PICOLIBC_USE_TOOLCHAIN` over `PICOLIBC_USE_MODULE` whenever possible, that preference is maintained in this implementation as well - the TOOLCHAIN source will be the default choice when the toolchain supports it or when the C++ is enabled. Otherwise, fallback to MODULE. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
38753852c8
commit
f87539081d
|
@ -3,9 +3,13 @@
|
|||
|
||||
if PICOLIBC
|
||||
|
||||
choice PICOLIBC_SOURCE
|
||||
prompt "Source of Picolibc"
|
||||
default PICOLIBC_USE_TOOLCHAIN if REQUIRES_FULL_LIBCPP || "$(TOOLCHAIN_HAS_PICOLIBC)" = "y"
|
||||
default PICOLIBC_USE_MODULE
|
||||
|
||||
config PICOLIBC_USE_MODULE
|
||||
bool "Picolibc as module" if "$(TOOLCHAIN_HAS_PICOLIBC)" = "y"
|
||||
default y if "$(TOOLCHAIN_HAS_PICOLIBC)" != "y"
|
||||
bool "Picolibc from module"
|
||||
depends on ZEPHYR_PICOLIBC_MODULE
|
||||
depends on !GLIBCXX_LIBCPP
|
||||
help
|
||||
|
@ -15,9 +19,14 @@ config PICOLIBC_USE_MODULE
|
|||
|
||||
# force TLS when using toolchain with TLS support
|
||||
config PICOLIBC_USE_TOOLCHAIN
|
||||
bool
|
||||
default y if !PICOLIBC_USE_MODULE
|
||||
bool "Picolibc from toolchain"
|
||||
depends on "$(TOOLCHAIN_HAS_PICOLIBC)" = "y"
|
||||
select THREAD_LOCAL_STORAGE if ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
|
||||
help
|
||||
Use picolibc included with the toolchain.
|
||||
This is required when using a full C++ standard library (`REQUIRES_FULL_LIBCPP=y`).
|
||||
|
||||
endchoice # PICOLIBC_SOURCE
|
||||
|
||||
choice PICOLIBC_IO_LEVEL
|
||||
prompt "Picolibc printf/scanf level"
|
||||
|
|
Loading…
Reference in New Issue