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