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 depends on !NATIVE_APPLICATION 31 default y 32 help 33 Selected when the target has support for the minimal C library 34 35config NEWLIB_LIBC_SUPPORTED 36 bool 37 default y 38 depends on "$(TOOLCHAIN_HAS_NEWLIB)" = "y" 39 depends on !NATIVE_APPLICATION 40 select FULL_LIBC_SUPPORTED 41 help 42 Selected when the target has support for the newlib C library 43 44# Picolibc with C++ support in Zephyr SDK is handled by Zephyr SDK's own Kconfig. 45config PICOLIBC_SUPPORTED 46 bool 47 depends on !NATIVE_APPLICATION 48 depends on ("$(TOOLCHAIN_HAS_PICOLIBC)" = "y") || (ZEPHYR_PICOLIBC_MODULE && !REQUIRES_FULL_LIBCPP) 49 default y 50 select FULL_LIBC_SUPPORTED 51 help 52 Selected when the target has support for picolibc. 53 54config IAR_LIBC_SUPPORTED 55 bool 56 default n 57 select FULL_LIBC_SUPPORTED 58 help 59 Selected if the target is an IAR Systems compiler 60 61config NATIVE_LIBC_INCOMPATIBLE 62 bool 63 help 64 Other Kconfig options can select this, if they are not compatible with the 65 native/host libC, and should only be compiled with an embedded libC 66 67menu "C Library" 68 69choice LIBC_IMPLEMENTATION 70 prompt "C Library Implementation" 71 default EXTERNAL_LIBC if NATIVE_BUILD && !(NATIVE_LIBRARY && NATIVE_LIBC_INCOMPATIBLE) 72 default PICOLIBC 73 default NEWLIB_LIBC if REQUIRES_FULL_LIBC 74 default MINIMAL_LIBC 75 default IAR_LIBC 76 77config MINIMAL_LIBC 78 bool "Minimal C library" 79 depends on !REQUIRES_FULL_LIBC 80 depends on MINIMAL_LIBC_SUPPORTED 81 imply COMPILER_FREESTANDING 82 select COMMON_LIBC_ABORT 83 select COMMON_LIBC_STRNLEN 84 imply COMMON_LIBC_MALLOC 85 imply COMMON_LIBC_CALLOC 86 imply COMMON_LIBC_REALLOCARRAY 87 help 88 Build with minimal C library. 89 90config PICOLIBC 91 bool "Picolibc library" 92 select COMMON_LIBC_ABORT 93 imply THREAD_LOCAL_STORAGE if ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE 94 select LIBC_ERRNO if THREAD_LOCAL_STORAGE 95 select NEED_LIBC_MEM_PARTITION 96 select TC_PROVIDES_POSIX_C_LANG_SUPPORT_R 97 imply COMMON_LIBC_MALLOC 98 imply COMMON_LIBC_ABORT 99 depends on PICOLIBC_SUPPORTED 100 help 101 Build with picolibc library. The picolibc library is built as 102 a module if PICOLIBC_MODULE is set, otherwise picolibc is 103 expected to be provided by the toolchain. 104 105config NEWLIB_LIBC 106 bool "Newlib C library" 107 select COMMON_LIBC_ABORT 108 depends on NEWLIB_LIBC_SUPPORTED 109 select NEED_LIBC_MEM_PARTITION 110 select TC_PROVIDES_POSIX_C_LANG_SUPPORT_R 111 imply POSIX_DEVICE_IO_ALIAS_CLOSE 112 imply POSIX_DEVICE_IO_ALIAS_OPEN 113 imply POSIX_DEVICE_IO_ALIAS_READ 114 imply POSIX_DEVICE_IO_ALIAS_WRITE 115 imply POSIX_FD_MGMT_ALIAS_LSEEK 116 imply POSIX_FILE_SYSTEM_ALIAS_FSTAT 117 imply POSIX_MULTI_PROCESS_ALIAS_GETPID 118 imply POSIX_SIGNALS_ALIAS_KILL 119 help 120 Build with newlib library. The newlib library is expected to be 121 part of the SDK in this case. 122 123config ARCMWDT_LIBC 124 bool "ARC MWDT C library" 125 depends on !NATIVE_APPLICATION 126 depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "arcmwdt" 127 help 128 C library provided by ARC MWDT toolchain. 129 130config EXTERNAL_LIBC 131 bool "External C library" 132 help 133 Build with external/user provided C library. 134 135config IAR_LIBC 136 bool "IAR C Runtime Library" 137 depends on IAR_LIBC_SUPPORTED 138 depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "iar" 139 select COMMON_LIBC_STRNLEN 140 select COMMON_LIBC_TIME if POSIX_TIMERS 141 help 142 Use the full IAR Compiler runtime libraries. 143 A reduced Zephyr minimal libc will be used for library functionality 144 not provided by the IAR C Runtime Library. 145 146endchoice # LIBC_IMPLEMENTATION 147 148config HAS_NEWLIB_LIBC_NANO 149 bool 150 151rsource "common/Kconfig" 152rsource "minimal/Kconfig" 153rsource "newlib/Kconfig" 154rsource "picolibc/Kconfig" 155 156config STDOUT_CONSOLE 157 bool "Send stdout to console" 158 depends on CONSOLE_HAS_DRIVER 159 depends on !(NATIVE_APPLICATION || (NATIVE_LIBRARY && EXTERNAL_LIBC)) 160 default y 161 help 162 This option directs standard output (e.g. printf) to the console 163 device, rather than suppressing it entirely. See also EARLY_CONSOLE 164 option. 165 166config NEED_LIBC_MEM_PARTITION 167 bool 168 help 169 Hidden option to signal that a memory partition is needed for 170 the C library even though it would not have been enabled 171 otherwise. 172 173endmenu 174