1menu "Newlib"
2
3    choice NEWLIB_STDOUT_LINE_ENDING
4        prompt "Line ending for UART output"
5        default NEWLIB_STDOUT_LINE_ENDING_CRLF
6        help
7            This option allows configuring the desired line endings sent to UART
8            when a newline ('\n', LF) appears on stdout.
9            Three options are possible:
10
11            CRLF: whenever LF is encountered, prepend it with CR
12
13            LF: no modification is applied, stdout is sent as is
14
15            CR: each occurence of LF is replaced with CR
16
17            This option doesn't affect behavior of the UART driver (drivers/uart.h).
18
19        config NEWLIB_STDOUT_LINE_ENDING_CRLF
20            bool "CRLF"
21        config NEWLIB_STDOUT_LINE_ENDING_LF
22            bool "LF"
23        config NEWLIB_STDOUT_LINE_ENDING_CR
24            bool "CR"
25    endchoice
26
27    choice NEWLIB_STDIN_LINE_ENDING
28        prompt "Line ending for UART input"
29        default NEWLIB_STDIN_LINE_ENDING_CR
30        help
31            This option allows configuring which input sequence on UART produces
32            a newline ('\n', LF) on stdin.
33            Three options are possible:
34
35            CRLF: CRLF is converted to LF
36
37            LF: no modification is applied, input is sent to stdin as is
38
39            CR: each occurence of CR is replaced with LF
40
41            This option doesn't affect behavior of the UART driver (drivers/uart.h).
42
43        config NEWLIB_STDIN_LINE_ENDING_CRLF
44            bool "CRLF"
45        config NEWLIB_STDIN_LINE_ENDING_LF
46            bool "LF"
47        config NEWLIB_STDIN_LINE_ENDING_CR
48            bool "CR"
49    endchoice
50
51    config NEWLIB_NANO_FORMAT
52        bool "Enable 'nano' formatting options for printf/scanf family"
53        default y if IDF_TARGET_ESP32C2
54        help
55            In most chips the ROM contains parts of newlib C library, including printf/scanf family
56            of functions. These functions have been compiled with so-called "nano"
57            formatting option. This option doesn't support 64-bit integer formats and C99
58            features, such as positional arguments.
59
60            For more details about "nano" formatting option, please see newlib readme file,
61            search for '--enable-newlib-nano-formatted-io':
62            https://sourceware.org/newlib/README
63
64            If this option is enabled and the ROM contains functions from newlib-nano, the build system
65            will use functions available in ROM, reducing the application binary size.
66            Functions available in ROM run faster than functions which run from flash. Functions available
67            in ROM can also run when flash instruction cache is disabled.
68
69            Some chips (e.g. ESP32-C6) has the full formatting versions of printf/scanf in ROM instead of
70            the nano versions and in this building with newlib nano might actually increase the size of
71            the binary. Which functions are present in ROM can be seen from ROM caps:
72            ESP_ROM_HAS_NEWLIB_NANO_FORMAT and ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT.
73
74            If you need 64-bit integer formatting support or C99 features, keep this
75            option disabled.
76
77    choice NEWLIB_TIME_SYSCALL
78        prompt "Timers used for gettimeofday function"
79        default NEWLIB_TIME_SYSCALL_USE_RTC_HRT
80        help
81            This setting defines which hardware timers are used to
82            implement 'gettimeofday' and 'time' functions in C library.
83
84            - If both high-resolution (systimer for all targets except ESP32)
85                and RTC timers are used, timekeeping will continue in deep sleep.
86                Time will be reported at 1 microsecond resolution.
87                This is the default, and the recommended option.
88            - If only high-resolution timer (systimer) is used, gettimeofday will
89                provide time at microsecond resolution.
90                Time will not be preserved when going into deep sleep mode.
91            - If only RTC timer is used, timekeeping will continue in
92                deep sleep, but time will be measured at 6.(6) microsecond
93                resolution. Also the gettimeofday function itself may take
94                longer to run.
95            - If no timers are used, gettimeofday and time functions
96                return -1 and set errno to ENOSYS.
97            - When RTC is used for timekeeping, two RTC_STORE registers are
98                used to keep time in deep sleep mode.
99
100        config NEWLIB_TIME_SYSCALL_USE_RTC_HRT
101            bool "RTC and high-resolution timer"
102            select ESP_TIME_FUNCS_USE_RTC_TIMER
103            select ESP_TIME_FUNCS_USE_ESP_TIMER
104        config NEWLIB_TIME_SYSCALL_USE_RTC
105            bool "RTC"
106            select ESP_TIME_FUNCS_USE_RTC_TIMER
107        config NEWLIB_TIME_SYSCALL_USE_HRT
108            bool "High-resolution timer"
109            select ESP_TIME_FUNCS_USE_ESP_TIMER
110        config NEWLIB_TIME_SYSCALL_USE_NONE
111            bool "None"
112            select ESP_TIME_FUNCS_USE_NONE
113    endchoice
114
115endmenu # Newlib
116