blob: e01a74f44de8953aa1c196754dc0a1d4f718ebb8 [file] [log] [blame]
Anas Nashif6e1fbd92016-12-24 08:40:16 -05001.. _c_library_v2:
2
3Standard C Library
4##################
5
6The kernel currently provides only the minimal subset of the standard C library
Anas Nashif7d82e172019-09-15 23:47:55 -04007required to meet the needs of Zephyr and its subsystems and features, primarily
8in the areas of string manipulation and display.
Anas Nashif6e1fbd92016-12-24 08:40:16 -05009
10Applications that require a more extensive C library can either submit
Anas Nashif7d82e172019-09-15 23:47:55 -040011contributions that enhance the existing library or substitute with a
12replacement library.
Anas Nashif6e1fbd92016-12-24 08:40:16 -050013
David B. Kinderf5ea8fe2017-02-27 13:15:43 -080014The Zephyr SDK and other supported toolchains comes with a bare-metal C library
Anas Nashif6e1fbd92016-12-24 08:40:16 -050015based on ``newlib`` that can be used with Zephyr by selecting the
16:option:`CONFIG_NEWLIB_LIBC` in the application configuration file. Part of the
17support for ``newlib`` is a set of hooks available under
18:file:`lib/libc/newlib/libc-hooks.c` which integrates the c library with basic
19kernel services.
Anas Nashif7d82e172019-09-15 23:47:55 -040020
21
22Minimal C Library
23*****************
24
25The minimal C library is part of Zephyr and provides a minimal set of C
26functions needed by Zephyr.
27
28The following functions are implemented in the minimal C
29library included with Zephyr:
30
David B. Kinderf6521292019-09-17 14:19:02 -070031.. rst-class:: rst-columns
Anas Nashif7d82e172019-09-15 23:47:55 -040032
33 - abs()
34 - atoi()
35 - bsearch()
36 - calloc()
37 - free()
38 - gmtime()
39 - gmtime_r()
40 - isalnum()
41 - isalpha()
42 - isdigit()
43 - isgraph()
44 - isprint()
45 - isspace()
46 - isupper()
47 - isxdigit()
48 - localtime()
49 - malloc()
50 - memchr()
51 - memcmp()
52 - memcpy()
53 - memmove()
54 - memset()
55 - mktime()
56 - rand()
57 - realloc()
58 - snprintf()
59 - sprintf()
60 - strcat()
61 - strchr()
62 - strcmp()
63 - strcpy()
64 - strlen()
65 - trncat()
66 - strncmp()
67 - strncpy()
68 - strrchr()
69 - strstr()
70 - strtol()
71 - trtoul()
72 - time()
73 - tolower()
74 - toupper()
75 - vsnprintf()
76 - vsprintf()