1# C library 2 3# Copyright (c) 2016 Intel Corporation 4# SPDX-License-Identifier: Apache-2.0 5 6config REQUIRES_FULL_LIBC 7 prompt "Require complete C library" 8 bool 9 help 10 Select a C library implementation that provides a complete C library 11 implementation, rather than the subset provided by MINIMAL_LIBC. 12 13config REQUIRES_FLOAT_PRINTF 14 bool "Requires floating point support in printf" 15 select CBPRINTF_FP_SUPPORT if MINIMAL_LIBC 16 select NEWLIB_LIBC_FLOAT_PRINTF if NEWLIB_LIBC 17 help 18 Select a printf implementation that provides a complete 19 implementation including floating point support. 20 21config FULL_LIBC_SUPPORTED 22 bool 23 help 24 Selected when the target has at least one C library that offers a 25 complete implementation and which would be selected when 26 REQUIRES_FULL_LIBC is set. 27 28config MINIMAL_LIBC_SUPPORTED 29 bool 30 default y 31 help 32 Selected when the target has support for the minimal C library 33 34config NEWLIB_LIBC_SUPPORTED 35 bool 36 default y 37 depends on "$(TOOLCHAIN_HAS_NEWLIB)" = "y" 38 select FULL_LIBC_SUPPORTED 39 help 40 Selected when the target has support for the newlib C library 41 42# Picolibc with C++ support in Zephyr SDK is handled by Zephyr SDK's own Kconfig. 43config PICOLIBC_SUPPORTED 44 bool 45 depends on !NATIVE_APPLICATION 46 depends on ("$(TOOLCHAIN_HAS_PICOLIBC)" = "y") || (ZEPHYR_PICOLIBC_MODULE && !REQUIRES_FULL_LIBCPP) 47 default y 48 select FULL_LIBC_SUPPORTED 49 help 50 Selected when the target has support for picolibc. 51 52config NATIVE_LIBC_INCOMPATIBLE 53 bool 54 help 55 Other Kconfig options can select this, if they are not compatible with the 56 native/host libC, and should only be compiled with an embedded libC 57 58menu "C Library" 59 60choice LIBC_IMPLEMENTATION 61 prompt "C Library Implementation" 62 default EXTERNAL_LIBC if NATIVE_BUILD && !(NATIVE_LIBRARY && NATIVE_LIBC_INCOMPATIBLE) 63 default PICOLIBC 64 default NEWLIB_LIBC if REQUIRES_FULL_LIBC 65 default MINIMAL_LIBC 66 67config MINIMAL_LIBC 68 bool "Minimal C library" 69 depends on !NATIVE_APPLICATION 70 depends on !REQUIRES_FULL_LIBC 71 depends on MINIMAL_LIBC_SUPPORTED 72 imply COMPILER_FREESTANDING 73 select COMMON_LIBC_ABORT 74 select COMMON_LIBC_STRNLEN 75 imply COMMON_LIBC_MALLOC 76 imply COMMON_LIBC_CALLOC 77 imply COMMON_LIBC_REALLOCARRAY 78 help 79 Build with minimal C library. 80 81config PICOLIBC 82 bool "Picolibc library" 83 select COMMON_LIBC_ABORT 84 imply THREAD_LOCAL_STORAGE if ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE 85 select LIBC_ERRNO if THREAD_LOCAL_STORAGE 86 select NEED_LIBC_MEM_PARTITION 87 imply COMMON_LIBC_MALLOC 88 depends on !NATIVE_APPLICATION 89 depends on PICOLIBC_SUPPORTED 90 help 91 Build with picolibc library. The picolibc library is built as 92 a module if PICOLIBC_MODULE is set, otherwise picolibc is 93 expected to be provided by the toolchain. 94 95config NEWLIB_LIBC 96 bool "Newlib C library" 97 select COMMON_LIBC_ABORT 98 depends on !NATIVE_APPLICATION 99 depends on NEWLIB_LIBC_SUPPORTED 100 select NEED_LIBC_MEM_PARTITION 101 imply POSIX_DEVICE_IO_ALIAS_CLOSE 102 imply POSIX_DEVICE_IO_ALIAS_OPEN 103 imply POSIX_DEVICE_IO_ALIAS_READ 104 imply POSIX_DEVICE_IO_ALIAS_WRITE 105 imply POSIX_FD_MGMT_ALIAS_LSEEK 106 imply POSIX_FILE_SYSTEM_ALIAS_FSTAT 107 imply POSIX_MULTI_PROCESS_ALIAS_GETPID 108 help 109 Build with newlib library. The newlib library is expected to be 110 part of the SDK in this case. 111 112config ARCMWDT_LIBC 113 bool "ARC MWDT C library" 114 depends on !NATIVE_APPLICATION 115 depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "arcmwdt" 116 help 117 C library provided by ARC MWDT toolchain. 118 119config EXTERNAL_LIBC 120 bool "External C library" 121 help 122 Build with external/user provided C library. 123 124endchoice # LIBC_IMPLEMENTATION 125 126config HAS_NEWLIB_LIBC_NANO 127 bool 128 129rsource "common/Kconfig" 130rsource "minimal/Kconfig" 131rsource "newlib/Kconfig" 132rsource "picolibc/Kconfig" 133 134config STDOUT_CONSOLE 135 bool "Send stdout to console" 136 depends on CONSOLE_HAS_DRIVER 137 depends on !(NATIVE_APPLICATION || (NATIVE_LIBRARY && EXTERNAL_LIBC)) 138 default y 139 help 140 This option directs standard output (e.g. printf) to the console 141 device, rather than suppressing it entirely. See also EARLY_CONSOLE 142 option. 143 144config NEED_LIBC_MEM_PARTITION 145 bool 146 help 147 Hidden option to signal that a memory partition is needed for 148 the C library even though it would not have been enabled 149 otherwise. 150 151endmenu 152