Skip to content

Commit 9afe6a5

Browse files
mysterywolfRbb666
authored andcommitted
[klibc] separate klibc Kconfig
1 parent f849afb commit 9afe6a5

File tree

7 files changed

+343
-154
lines changed

7 files changed

+343
-154
lines changed

src/Kconfig

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
menu "RT-Thread Kernel"
22

3+
rsource "klibc/Kconfig"
4+
35
config RT_NAME_MAX
46
int "The maximal size of kernel object name"
57
range 2 64
@@ -201,123 +203,6 @@ menu "kservice options"
201203
default n
202204
endmenu
203205

204-
menu "klibc options"
205-
206-
config RT_KLIBC_USING_STDLIB
207-
bool "Enable klibc to use standard C library"
208-
default n
209-
210-
if RT_KLIBC_USING_STDLIB
211-
config RT_KLIBC_USING_STDLIB_MEMORY
212-
bool "Use stdlib memory functions to replace (faster, but not safe)"
213-
default n
214-
help
215-
e.g. use memcpy to replace rt_memcpy
216-
endif
217-
218-
config RT_KLIBC_USING_TINY_SIZE
219-
bool "Enable tiny size of klibc"
220-
default n
221-
222-
menu "rt_vsnprintf options"
223-
config RT_KLIBC_USING_VSNPRINTF_STANDARD
224-
bool "standard rt_vsnprintf version"
225-
default y if ARCH_CPU_64BIT
226-
default n
227-
help
228-
Standard version of rt_vsnprintf, which is full function but higher stack usage.
229-
230-
config RT_KLIBC_USING_VSNPRINTF_LONGLONG
231-
bool "Enable rt_vsnprintf function to support long-long format"
232-
default y if RT_KLIBC_USING_VSNPRINTF_STANDARD
233-
default n
234-
help
235-
Support for the long long integral types (with the ll, z and t length modifiers for specifiers
236-
%d,%i,%o,%x,%X,%u, and with the %p specifier). Note: 'L' (long double) is not supported.
237-
238-
if RT_KLIBC_USING_VSNPRINTF_STANDARD
239-
240-
config RT_KLIBC_USING_VSNPRINTF_DECIMAL_SPECIFIERS
241-
bool "Support decimal notation floating point conversion specifiers (%f, %F)"
242-
default y
243-
help
244-
Support for the decimal notation floating point conversion specifiers (%f, %F)
245-
246-
config RT_KLIBC_USING_VSNPRINTF_EXPONENTIAL_SPECIFIERS
247-
bool "Support exponential notation floating point conversion specifiers (%e, %g, %E, %G)"
248-
default y
249-
help
250-
Support for the exponential notation floating point conversion specifiers (%e, %g, %E, %G)
251-
252-
config RT_KLIBC_USING_VSNPRINTF_WRITEBACK_SPECIFIER
253-
bool "Support length write-back specifier (%n)"
254-
default y
255-
help
256-
Support for the length write-back specifier (%n)
257-
258-
config RT_KLIBC_USING_VSNPRINTF_CHECK_NUL_IN_FORMAT_SPECIFIER
259-
bool "safety check: no NULL end string"
260-
default y if RT_USING_DEBUG
261-
default n
262-
help
263-
Be extra-safe, and don't assume format specifiers are completed correctly
264-
before the format string end.
265-
266-
config RT_KLIBC_USING_VSNPRINTF_MSVC_STYLE_INTEGER_SPECIFIERS
267-
bool "Support MSVC style integer specifiers"
268-
default n
269-
help
270-
the integer format specifiers used in Microsoft's Visual C++ (MSVC) compiler.
271-
These specifiers, like %I64d for 64-bit integers, deviate slightly from the standard
272-
C format specifiers and are specific to MSVC. They allow for controlled formatting of
273-
integers in printf()-like functions, accommodating different integer sizes and ensuring
274-
compatibility with MSVC's environment. It's important to note that these specifiers might
275-
not be recognized or function in other compilers due to their MSVC-specific nature.
276-
277-
config RT_KLIBC_USING_VSNPRINTF_INTEGER_BUFFER_SIZE
278-
int "'ntoa' conversion buffer size"
279-
default 32
280-
help
281-
'ntoa' conversion buffer size, this must be big enough to hold one converted
282-
numeric number including padded zeros (dynamically created on stack)
283-
284-
config RT_KLIBC_USING_VSNPRINTF_DECIMAL_BUFFER_SIZE
285-
int "printing individual decimal numbers buffer size"
286-
default 32
287-
help
288-
size of the fixed (on-stack) buffer for printing individual decimal numbers.
289-
this must be big enough to hold one converted floating-point value including
290-
padded zeros.
291-
292-
config RT_KLIBC_USING_VSNPRINTF_FLOAT_PRECISION
293-
int "floating point conversion specifiers"
294-
default 6
295-
help
296-
Default precision for the floating point conversion specifiers (the C standard sets this at 6)
297-
298-
config RT_KLIBC_USING_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL
299-
int "integral nums printed as float in rt_vsnprint"
300-
default 9
301-
help
302-
According to the C languages standard, printf() and related functions must be able to print any
303-
integral number in floating-point notation, regardless of length, when using the %f specifier -
304-
possibly hundreds of characters, potentially overflowing your buffers. In this implementation,
305-
all values beyond this threshold are switched to exponential notation.
306-
307-
config RT_KLIBC_USING_VSNPRINTF_LOG10_TAYLOR_TERMS
308-
int "the number of terms in a Taylor series expansion of log_10(x)"
309-
default 4
310-
range 2 99
311-
help
312-
The number of terms in a Taylor series expansion of log_10(x) to
313-
use for approximation - including the power-zero term (i.e. the
314-
value at the point of expansion).
315-
316-
endif
317-
endmenu # rt_vsnprintf options
318-
319-
endmenu # klibc options
320-
321206
menuconfig RT_USING_DEBUG
322207
bool "Enable debugging features"
323208
default y

src/klibc/Kconfig

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
menu "klibc options"
2+
3+
comment "------------rt_memset options------------"
4+
config RT_KLIBC_USING_USER_MEMSET
5+
bool "Enable rt_memset to use user-defined version"
6+
default n
7+
8+
if !RT_KLIBC_USING_USER_MEMSET
9+
config RT_KLIBC_USING_LIBC_MEMSET
10+
bool "Enable rt_memset to use libc memset"
11+
default n
12+
13+
config RT_KLIBC_USING_TINY_MEMSET
14+
bool "Enable rt_memset to use tiny version"
15+
depends on !RT_KLIBC_USING_LIBC_MEMSET
16+
default n
17+
endif
18+
19+
comment "------------rt_memcpy options------------"
20+
config RT_KLIBC_USING_USER_MEMCPY
21+
bool "Enable rt_memcpy to use user-defined version"
22+
default n
23+
24+
if !RT_KLIBC_USING_USER_MEMCPY
25+
config RT_KLIBC_USING_LIBC_MEMCPY
26+
bool "Enable rt_memcpy to use libc memcpy"
27+
default n
28+
29+
config RT_KLIBC_USING_TINY_MEMCPY
30+
bool "Enable rt_memcpy to use tiny version"
31+
depends on !RT_KLIBC_USING_LIBC_MEMCPY
32+
default n
33+
endif
34+
35+
comment "------------rt_memmove options------------"
36+
config RT_KLIBC_USING_USER_MEMMOVE
37+
bool "Enable rt_memmove to use user-defined version"
38+
default n
39+
40+
if !RT_KLIBC_USING_USER_MEMMOVE
41+
config RT_KLIBC_USING_LIBC_MEMMOVE
42+
bool "Enable rt_memmove to use libc memmove"
43+
default n
44+
endif
45+
46+
comment "------------rt_memcmp options------------"
47+
config RT_KLIBC_USING_USER_MEMCMP
48+
bool "Enable rt_memcmp to use user-defined version"
49+
default n
50+
51+
if !RT_KLIBC_USING_USER_MEMCMP
52+
config RT_KLIBC_USING_LIBC_MEMCMP
53+
bool "Enable rt_memcmp to use libc memcmp"
54+
default n
55+
endif
56+
57+
comment "------------rt_strstr options------------"
58+
config RT_KLIBC_USING_USER_STRSTR
59+
bool "Enable rt_strstr to use user-defined version"
60+
default n
61+
62+
if !RT_KLIBC_USING_USER_STRSTR
63+
config RT_KLIBC_USING_LIBC_STRSTR
64+
bool "Enable rt_strstr to use libc strstr"
65+
default n
66+
endif
67+
68+
comment "------------rt_strcasecmp options------------"
69+
config RT_KLIBC_USING_USER_STRCASECMP
70+
bool "Enable rt_strcasecmp to use user-defined version"
71+
default n
72+
73+
comment "------------rt_strncpy options------------"
74+
config RT_KLIBC_USING_USER_STRNCPY
75+
bool "Enable rt_strncpy to use user-defined version"
76+
default n
77+
78+
if !RT_KLIBC_USING_USER_STRNCPY
79+
config RT_KLIBC_USING_LIBC_STRNCPY
80+
bool "Enable rt_strncpy to use libc strncpy"
81+
default n
82+
endif
83+
84+
comment "------------rt_strcpy options------------"
85+
config RT_KLIBC_USING_USER_STRCPY
86+
bool "Enable rt_strcpy to use user-defined version"
87+
default n
88+
89+
if !RT_KLIBC_USING_USER_STRCPY
90+
config RT_KLIBC_USING_LIBC_STRCPY
91+
bool "Enable rt_strcpy to use libc strcpy"
92+
default n
93+
endif
94+
95+
comment "------------rt_strncmp options------------"
96+
config RT_KLIBC_USING_USER_STRNCMP
97+
bool "Enable rt_strncmp to use user-defined version"
98+
default n
99+
100+
if !RT_KLIBC_USING_USER_STRNCMP
101+
config RT_KLIBC_USING_LIBC_STRNCMP
102+
bool "Enable rt_strncmp to use libc strncmp"
103+
default n
104+
endif
105+
106+
comment "------------rt_strcmp options------------"
107+
config RT_KLIBC_USING_USER_STRCMP
108+
bool "Enable rt_strcmp to use user-defined version"
109+
default n
110+
111+
if !RT_KLIBC_USING_USER_STRCMP
112+
config RT_KLIBC_USING_LIBC_STRCMP
113+
bool "Enable rt_strcmp to use libc strcmp"
114+
default n
115+
endif
116+
117+
comment "------------rt_strlen options------------"
118+
config RT_KLIBC_USING_USER_STRLEN
119+
bool "Enable rt_strlen to use user-defined version"
120+
default n
121+
122+
if !RT_KLIBC_USING_USER_STRLEN
123+
config RT_KLIBC_USING_LIBC_STRLEN
124+
bool "Enable rt_strlen to use libc strlen"
125+
default n
126+
endif
127+
128+
comment "------------rt_strlen options------------"
129+
config RT_KLIBC_USING_USER_STRLEN
130+
bool "Enable rt_strlen to use user-defined version"
131+
default n
132+
133+
if !RT_KLIBC_USING_USER_STRLEN
134+
config RT_KLIBC_USING_LIBC_STRLEN
135+
bool "Enable rt_strlen to use libc strlen"
136+
default n
137+
endif
138+
139+
comment "------------rt_strnlen options------------"
140+
config RT_KLIBC_USING_USER_STRNLEN
141+
bool "Enable rt_strnlen to use user-defined version"
142+
default n
143+
144+
comment "------------rt_vsscanf options------------"
145+
config RT_KLIBC_USING_LIBC_VSSCANF
146+
bool "Enable rt_vsscanf to use libc vsscanf"
147+
default n
148+
149+
comment "------------rt_vsnprintf options------------"
150+
config RT_KLIBC_USING_LIBC_VSNPRINTF
151+
bool "Enable rt_vsnprintf to use libc vsscanf"
152+
default n
153+
154+
config RT_KLIBC_USING_VSNPRINTF_LONGLONG
155+
bool "Enable rt_vsnprintf function to support long-long format"
156+
depends on !RT_KLIBC_USING_LIBC_VSNPRINTF
157+
default n
158+
help
159+
Support for the long long integral types (with the ll, z and t length modifiers for specifiers
160+
%d,%i,%o,%x,%X,%u, and with the %p specifier). Note: 'L' (long double) is not supported.
161+
162+
menuconfig RT_KLIBC_USING_VSNPRINTF_STANDARD
163+
bool "Enable standard rt_vsnprintf version"
164+
default y if ARCH_CPU_64BIT
165+
default n
166+
select RT_KLIBC_USING_VSNPRINTF_LONGLONG
167+
depends on !RT_KLIBC_USING_LIBC_VSNPRINTF
168+
help
169+
Standard version of rt_vsnprintf, which is full function but higher stack usage.
170+
171+
if RT_KLIBC_USING_VSNPRINTF_STANDARD
172+
173+
config RT_KLIBC_USING_VSNPRINTF_DECIMAL_SPECIFIERS
174+
bool "Support decimal notation floating point conversion specifiers (%f, %F)"
175+
default y
176+
help
177+
Support for the decimal notation floating point conversion specifiers (%f, %F)
178+
179+
config RT_KLIBC_USING_VSNPRINTF_EXPONENTIAL_SPECIFIERS
180+
bool "Support exponential notation floating point conversion specifiers (%e, %g, %E, %G)"
181+
default y
182+
help
183+
Support for the exponential notation floating point conversion specifiers (%e, %g, %E, %G)
184+
185+
config RT_KLIBC_USING_VSNPRINTF_WRITEBACK_SPECIFIER
186+
bool "Support length write-back specifier (%n)"
187+
default y
188+
help
189+
Support for the length write-back specifier (%n)
190+
191+
config RT_KLIBC_USING_VSNPRINTF_CHECK_NUL_IN_FORMAT_SPECIFIER
192+
bool "safety check: no NULL end string"
193+
default y if RT_USING_DEBUG
194+
default n
195+
help
196+
Be extra-safe, and don't assume format specifiers are completed correctly
197+
before the format string end.
198+
199+
config RT_KLIBC_USING_VSNPRINTF_MSVC_STYLE_INTEGER_SPECIFIERS
200+
bool "Support MSVC style integer specifiers"
201+
default n
202+
help
203+
the integer format specifiers used in Microsoft's Visual C++ (MSVC) compiler.
204+
These specifiers, like %I64d for 64-bit integers, deviate slightly from the standard
205+
C format specifiers and are specific to MSVC. They allow for controlled formatting of
206+
integers in printf()-like functions, accommodating different integer sizes and ensuring
207+
compatibility with MSVC's environment. It's important to note that these specifiers might
208+
not be recognized or function in other compilers due to their MSVC-specific nature.
209+
210+
config RT_KLIBC_USING_VSNPRINTF_INTEGER_BUFFER_SIZE
211+
int "'ntoa' conversion buffer size"
212+
default 32
213+
help
214+
'ntoa' conversion buffer size, this must be big enough to hold one converted
215+
numeric number including padded zeros (dynamically created on stack)
216+
217+
config RT_KLIBC_USING_VSNPRINTF_DECIMAL_BUFFER_SIZE
218+
int "printing individual decimal numbers buffer size"
219+
default 32
220+
help
221+
size of the fixed (on-stack) buffer for printing individual decimal numbers.
222+
this must be big enough to hold one converted floating-point value including
223+
padded zeros.
224+
225+
config RT_KLIBC_USING_VSNPRINTF_FLOAT_PRECISION
226+
int "floating point conversion specifiers"
227+
default 6
228+
help
229+
Default precision for the floating point conversion specifiers (the C standard sets this at 6)
230+
231+
config RT_KLIBC_USING_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL
232+
int "integral nums printed as float in rt_vsnprint"
233+
default 9
234+
help
235+
According to the C languages standard, printf() and related functions must be able to print any
236+
integral number in floating-point notation, regardless of length, when using the %f specifier -
237+
possibly hundreds of characters, potentially overflowing your buffers. In this implementation,
238+
all values beyond this threshold are switched to exponential notation.
239+
240+
config RT_KLIBC_USING_VSNPRINTF_LOG10_TAYLOR_TERMS
241+
int "the number of terms in a Taylor series expansion of log_10(x)"
242+
default 4
243+
range 2 99
244+
help
245+
The number of terms in a Taylor series expansion of log_10(x) to
246+
use for approximation - including the power-zero term (i.e. the
247+
value at the point of expansion).
248+
249+
endif
250+
endmenu

0 commit comments

Comments
 (0)