blob: fa6ae7e6e9ba5926fd8a433dad46f28664138a63 [file] [log] [blame]
# Copyright © 2021 Amazon.com, Inc. or its affiliates.
# SPDX-License-Identifier: Apache-2.0
if PICOLIBC
config PICOLIBC_USE_MODULE
bool "Picolibc as module" if "$(TOOLCHAIN_HAS_PICOLIBC)" = "y"
default y if "$(TOOLCHAIN_HAS_PICOLIBC)" != "y"
depends on ZEPHYR_PICOLIBC_MODULE
depends on !GLIBCXX_LIBCPP
help
Use picolibc module instead of picolibc included with toolchain.
This is enabled by default for toolchains other than the Zephyr
SDK.
# force TLS when using toolchain with TLS support
config PICOLIBC_USE_TOOLCHAIN
bool
default y if PICOLIBC && !PICOLIBC_USE_MODULE
select THREAD_LOCAL_STORAGE if ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
config PICOLIBC_HEAP_SIZE
int "[DEPRECATED] Picolibc heap size (bytes)"
default -2
help
[DEPRECATED] Use COMMON_LIBC_MALLOC_ARENA_SIZE
Indicate the size in bytes of the memory arena used for common C
library malloc() implementation when using Picolibc.
If set to -2, then the value of COMMON_LIBC_MALLOC_ARENA_SIZE
will be used.
choice PICOLIBC_IO_LEVEL
prompt "Picolibc printf/scanf level"
default PICOLIBC_IO_MINIMAL if CBPRINTF_NANO
default PICOLIBC_IO_LONG_LONG if CBPRINTF_FULL_INTEGRAL
default PICOLIBC_IO_INTEGER
help
Selects the level of printf and scanf support
config PICOLIBC_IO_FLOAT
bool "full support for integer/floating point values in printf/scanf"
help
Include full floating point and integer support in printf/scanf
functions.
config PICOLIBC_IO_LONG_LONG
bool "full support for integer values, including long long, in printf/scanf"
depends on !REQUIRES_FLOAT_PRINTF && (!CBPRINTF_FP_SUPPORT || CBPRINTF_NANO)
help
Includes full integer with long long, but no floating
point in printf/scanf.
config PICOLIBC_IO_INTEGER
bool "full support for integer values, other than long long, in printf/scanf"
depends on !REQUIRES_FLOAT_PRINTF && ((!CBPRINTF_FP_SUPPORT && !CBPRINTF_FULL_INTEGRAL) || CBPRINTF_NANO)
help
Include full integer other than long long, but no floating point
in printf/scanf.
config PICOLIBC_IO_MINIMAL
bool "limited support for integer values in printf/scanf"
depends on !REQUIRES_FLOAT_PRINTF && CBPRINTF_NANO
help
Include limited integer and no floating point support in
printf/scanf.
endchoice
if PICOLIBC_USE_MODULE
choice PICOLIBC_OPTIMIZATIONS
prompt "Optimization level"
default PICOLIBC_SIZE_OPTIMIZATIONS if SIZE_OPTIMIZATIONS
default PICOLIBC_SPEED_OPTIMIZATIONS if SPEED_OPTIMIZATIONS
default PICOLIBC_DEBUG_OPTIMIZATIONS if DEBUG_OPTIMIZATIONS
default PICOLIBC_NO_OPTIMIZATIONS if NO_OPTIMIZATIONS
help
Note that these flags shall only control the compiler
optimization level for picolibc, not the level for the
rest of Zephyr
config PICOLIBC_SIZE_OPTIMIZATIONS
bool "Optimize for size"
help
Compiler optimizations will be set to -Os independently of other
options.
config PICOLIBC_SPEED_OPTIMIZATIONS
bool "Optimize for speed"
help
Compiler optimizations will be set to -O2 independently of other
options.
config PICOLIBC_DEBUG_OPTIMIZATIONS
bool "Optimize debugging experience"
help
Compiler optimizations will be set to -Og independently of other
options.
config PICOLIBC_NO_OPTIMIZATIONS
bool "Optimize nothing"
help
Compiler optimizations will be set to -O0 independently of other
options.
endchoice
config PICOLIBC_FAST_STRCMP
bool "always use fast strcmp paths"
default y
help
This provides a faster strcmp version even when libc is
built in space-optimized mode
config PICOLIBC_ASSERT_VERBOSE
bool "assert provides verbose information"
help
The usual picolibc assert helper, __assert_func, takes file, line,
function and expression information to make the presented message
more helpful. These all require storage in the image. Unselecting
this option eliminates all of that information, making the results
less helpful but also making them consume less memory.
config PICOLIBC_IO_C99_FORMATS
bool "support C99 format additions in printf/scanf"
default y
help
Includes C99 printf and scanf support for j, z, t size
modifiers. C99 support is always included in the floating-point
variant
config PICOLIBC_IO_POS_ARGS
bool "Support POSIX positional args (e.g. %$1d) in printf/scanf"
default y
depends on !PICOLIBC_IO_MINIMAL
help
Includes support for positional args (e.g. $1) in integer-only
printf and scanf. Positional args are always supported in the
floating-point variant.
config PICOLIBC_IO_FLOAT_EXACT
bool "support for exact float/string conversion"
default y
help
Uses Ryu algorithm for exact binary/decimal float conversions.
This ensures that printf values with enough digits can be
fed to scanf and generate exactly the same binary value.
config PICOLIBC_IO_SMALL_ULTOA
bool "avoid soft division in printf"
default y
help
Replaces division and modulus by 10 with shifts and adds when
doing binary to decimal conversion in printf for 64-bit
values on 32-bit targets.
config PICOLIBC_IO_MINIMAL_LONG_LONG
bool "Include long long support in minimal printf"
depends on PICOLIBC_IO_MINIMAL
default y if CBPRINTF_FULL_INTEGRAL
help
Include long long support in the minimal picolibc printf code
config PICOLIBC_LOCALE_INFO
bool "support locales in libc functions"
help
Includes code for basic locale support
config PICOLIBC_LOCALE_EXTENDED_INFO
bool "support extended locales in libc functions"
help
Includes code for extended locale support
config PICOLIBC_MULTIBYTE
bool "support multibyte functions in libc"
help
Includes code for multi-byte characters
config PICOLIBC_PICOEXIT
bool "use smaller atexit/onexit implementation"
default y
help
Provides a simpler atexit/onexit implementation that doesn't use
malloc, but only supports a small number (32) of exit handlers.
config PICOLIBC_MULTITHREAD
bool "support multiple threads using retargetable locking API"
default y
help
Protects shared data structures in libc with mutexes that use
an API which can be retargeted to OS provided routines.
config PICOLIBC_GLOBAL_ERRNO
bool "use a single global variable for errno"
help
Picolibc usually uses a TLS variable for errno, ensuring that
multiple threads have a reliable mechanism for detecting libc
exceptions. This option switches to a single global errno variable,
which can be used to avoid TLS variable usage by the library if
necessary.
endif # PICOLIBC_USE_MODULE
endif # PICOLIBC