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_MALLOC
17	bool "[DEPRECATED] Minimal libc malloc implementation"
18	default y
19	imply COMMON_LIBC_MALLOC
20	help
21	  [DEPRECATED] Use COMMON_LIBC_MALLOC
22
23	  Enable the minimal libc's implementation of malloc, free, and realloc.
24	  Disable if you wish to provide your own implementations of these functions.
25
26config MINIMAL_LIBC_MALLOC_ARENA_SIZE
27	int "[DEPRECATED] Size of the minimal libc malloc arena"
28	default -2
29	depends on COMMON_LIBC_MALLOC
30	help
31	  [DEPRECATED] Use COMMON_LIBC_MALLOC_ARENA_SIZE
32
33	  Indicate the size in bytes of the memory arena used for common C
34	  library malloc() implementation when using the minimal C library.
35
36	  If set to -2, then the value of COMMON_LIBC_MALLOC_ARENA_SIZE
37	  will be used.
38
39config MINIMAL_LIBC_CALLOC
40	bool "[DEPRECATED] Minimal libc trivial calloc implementation"
41	default y
42	help
43	  [DEPRECATED] Use COMMON_LIBC_CALLOC
44
45	  Enable the minimal libc's trivial implementation of calloc, which
46	  forwards to malloc and memset.
47
48config MINIMAL_LIBC_REALLOCARRAY
49	bool "[DEPRECATED] Minimal libc trivial reallocarray implementation"
50	default y
51	help
52	  [DEPRECATED] Use COMMON_LIBC_REALLOCARRAY
53
54	  Enable the minimal libc's trivial implementation of reallocarray, which
55	  forwards to realloc.
56
57config MINIMAL_LIBC_LL_PRINTF
58	bool "Build with minimal libc long long printf" if !64BIT
59	default y if 64BIT
60	help
61	  Build with long long printf enabled. This will increase the size of
62	  the image.
63
64config MINIMAL_LIBC_OPTIMIZE_STRING_FOR_SIZE
65	bool "Use size optimized string functions"
66	default y if SIZE_OPTIMIZATIONS
67	help
68	  Enable smaller but potentially slower implementations of memcpy and
69	  memset. On the Cortex-M0+ this reduces the total code size by 120 bytes.
70
71config MINIMAL_LIBC_RAND
72	bool "Rand and srand functions"
73	help
74	  Enable rand_r() for the minimal libc.
75
76	  In order to make use of the non-reentrant rand() and srand(), it is
77	  necessary to set CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS=y.
78
79config MINIMAL_LIBC_TIME
80	bool "Time functions"
81	select COMMON_LIBC_TIME if POSIX_CLOCK
82	default y
83	help
84	  Enable time() and gmtime_r() for the minimal libc.
85
86	  time() requires CONFIG_POSIX_CLOCK=y because it relies on the POSIX
87	  clock_gettime() function.
88
89	  In order to make use of the non-reentrant gmtime(), it is necessary
90	  to set CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS=y.
91
92config MINIMAL_LIBC_STRING_ERROR_TABLE
93	bool "String error table for strerror() and strerror_r()"
94	help
95	  Select this option to ensure that streror(), strerror_r()
96	  produce strings corresponding to the descriptions in errno.h.
97
98	  The string error table can add ~2kiB to ROM. As such, it is
99	  disabled by default. In this case, strerror() and strerror_r()
100	  symbols are still present, but the functions produce an empty
101	  string.
102
103endif # MINIMAL_LIBC
104