1# Copyright (c) 2016 Intel Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4if MINIMAL_LIBC
5
6config MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS
7	bool "Non-reentrant functions"
8	default y if !USERSPACE
9	select NEED_LIBC_MEM_PARTITION
10	help
11	  Enable non-reentrant functions that make use of the globals; e.g.
12	  rand() and gmtime(). The globals must be put into a dedicated C
13	  library memory partition when CONFIG_USERSPACE=y, and enabling this
14	  option may require an additional memory protection region.
15
16config MINIMAL_LIBC_LL_PRINTF
17	bool "Build with minimal libc long long printf" if !64BIT
18	default y if 64BIT
19	help
20	  Build with long long printf enabled. This will increase the size of
21	  the image.
22
23config MINIMAL_LIBC_OPTIMIZE_STRING_FOR_SIZE
24	bool "Use size optimized string functions"
25	default y if SIZE_OPTIMIZATIONS || SIZE_OPTIMIZATIONS_AGGRESSIVE
26	help
27	  Enable smaller but potentially slower implementations of memcpy and
28	  memset. On the Cortex-M0+ this reduces the total code size by 120 bytes.
29
30config MINIMAL_LIBC_RAND
31	bool "Rand and srand functions"
32	help
33	  Enable rand_r() for the minimal libc.
34
35	  In order to make use of the non-reentrant rand() and srand(), it is
36	  necessary to set CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS=y.
37
38config MINIMAL_LIBC_TIME
39	bool "Time functions"
40	select COMMON_LIBC_TIME if POSIX_TIMERS
41	select POSIX_C_LANG_SUPPORT_R
42	select COMMON_LIBC_GMTIME_R
43	select COMMON_LIBC_ASCTIME
44	select COMMON_LIBC_LOCALTIME_R_UTC
45	select COMMON_LIBC_CTIME
46	default y
47	help
48	  Enable time() and gmtime_r() for the minimal libc.
49
50	  time() requires CONFIG_POSIX_TIMERS=y because it relies on the POSIX
51	  clock_gettime() function.
52
53	  In order to make use of the non-reentrant gmtime(), it is necessary
54	  to set CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS=y.
55
56config MINIMAL_LIBC_STRING_ERROR_TABLE
57	bool "String error table for strerror() and strerror_r()"
58	help
59	  Select this option to ensure that streror(), strerror_r()
60	  produce strings corresponding to the descriptions in errno.h.
61
62	  The string error table can add ~2kiB to ROM. As such, it is
63	  disabled by default. In this case, strerror() and strerror_r()
64	  symbols are still present, but the functions produce an empty
65	  string.
66
67endif # MINIMAL_LIBC
68