|
| 1 | +# Copyright © 2021 Amazon.com, Inc. or its affiliates. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +config PICOLIBC_USE_MODULE |
| 5 | + bool "Use picolibc module" |
| 6 | + default y |
| 7 | + select PICOLIBC_MODULE |
| 8 | + help |
| 9 | + Use picolibc module instead of picolibc included with toolchain |
| 10 | + |
| 11 | +config PICOLIBC_ALIGNED_HEAP_SIZE |
| 12 | + int "Picolibc aligned heap size (bytes)" |
| 13 | + depends on MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT |
| 14 | + depends on USERSPACE |
| 15 | + default 0 |
| 16 | + help |
| 17 | + If user mode is enabled, and MPU hardware has requirements that |
| 18 | + regions be sized to a power of two and aligned to their size, |
| 19 | + and user mode threads need to access this heap, then this is necessary |
| 20 | + to properly define an MPU region for the heap. |
| 21 | + |
| 22 | + If this is left at 0, then remaining system RAM will be used for this |
| 23 | + area and it may not be possible to program it as an MPU region. |
| 24 | + |
| 25 | +config PICOLIBC_LIBC_MAX_MAPPED_REGION_SIZE |
| 26 | + int "Maximum memory mapped for picolibc heap" |
| 27 | + depends on MMU |
| 28 | + default 1048576 |
| 29 | + help |
| 30 | + On MMU-based systems, indicates the maximum amount of memory which |
| 31 | + will be used for the picolibc malloc() heap. The actual amount of |
| 32 | + memory used will be the minimum of this value and the amount of |
| 33 | + free physical memory at kernel boot. |
| 34 | + |
| 35 | +config PICOLIBC_IO_LONG_LONG |
| 36 | + bool "support for long long in integer-only printf/scanf" |
| 37 | + default n |
| 38 | + help |
| 39 | + Includes support for long long in integer-only printf/scanf. long long |
| 40 | + types are always supported in the floating-point versions. |
| 41 | + |
| 42 | +config PICOLIBC_IO_FLOAT |
| 43 | + bool "support for floating point values in printf/scanf" |
| 44 | + default n |
| 45 | + help |
| 46 | + Include floating point support in printf/scanf functions. |
| 47 | + |
| 48 | +if PICOLIBC_USE_MODULE |
| 49 | + |
| 50 | +if PICOLIBC |
| 51 | +choice PICOLIBC_OPTIMIZATIONS |
| 52 | + prompt "Optimization level" |
| 53 | + default PICOLIBC_SIZE_OPTIMIZATIONS if SIZE_OPTIMIZATIONS |
| 54 | + default PICOLIBC_SPEED_OPTIMIZATIONS if SPEED_OPTIMIZATIONS |
| 55 | + default PICOLIBC_DEBUG_OPTIMIZATIONS if DEBUG_OPTIMIZATIONS |
| 56 | + default PICOLIBC_NO_OPTIMIZATIONS if NO_OPTIMIZATIONS |
| 57 | + help |
| 58 | + Note that these flags shall only control the compiler |
| 59 | + optimization level for picolibc, not the level for the |
| 60 | + rest of Zephyr |
| 61 | + |
| 62 | +config PICOLIBC_SIZE_OPTIMIZATIONS |
| 63 | + bool "Optimize for size" |
| 64 | + help |
| 65 | + Compiler optimizations will be set to -Os independently of other |
| 66 | + options. |
| 67 | + |
| 68 | +config PICOLIBC_SPEED_OPTIMIZATIONS |
| 69 | + bool "Optimize for speed" |
| 70 | + help |
| 71 | + Compiler optimizations will be set to -O2 independently of other |
| 72 | + options. |
| 73 | + |
| 74 | +config PICOLIBC_DEBUG_OPTIMIZATIONS |
| 75 | + bool "Optimize debugging experience" |
| 76 | + help |
| 77 | + Compiler optimizations will be set to -Og independently of other |
| 78 | + options. |
| 79 | + |
| 80 | +config PICOLIBC_NO_OPTIMIZATIONS |
| 81 | + bool "Optimize nothing" |
| 82 | + help |
| 83 | + Compiler optimizations will be set to -O0 independently of other |
| 84 | + options. |
| 85 | + |
| 86 | +endchoice |
| 87 | + |
| 88 | +config PICOLIBC_FAST_STRCMP |
| 89 | + bool "always use fast strcmp paths" |
| 90 | + default y |
| 91 | + help |
| 92 | + This provides a faster strcmp version even when libc is |
| 93 | + built in space-optimized mode |
| 94 | + |
| 95 | +config PICOLIBC_IO_C99_FORMATS |
| 96 | + bool "support C99 format additions in printf/scanf" |
| 97 | + default y |
| 98 | + help |
| 99 | + Includes support for hex floats (in floating-point version) and j, z, |
| 100 | + t size modifiers. |
| 101 | + |
| 102 | +config PICOLIBC_IO_POS_ARGS |
| 103 | + bool "Support POSIX positional args (e.g. %$1d) in printf/scanf" |
| 104 | + default y |
| 105 | + depends on !PICOLIBC_IO_FLOAT |
| 106 | + help |
| 107 | + Includes support for positional args (e.g. $1) in integer-only printf |
| 108 | + and scanf. Positional args are always supported in the floating-point |
| 109 | + versions. |
| 110 | + |
| 111 | +config PICOLIBC_IO_FLOAT_EXACT |
| 112 | + bool "support for exact float/string conversion" |
| 113 | + default y |
| 114 | + depends on PICOLIBC_USE_MODULE |
| 115 | + help |
| 116 | + Uses Ryu algorithm for exact binary/decimal float conversions. |
| 117 | + This ensures that printf values with enough digits can be |
| 118 | + fed to scanf and generate exactly the same binary value. |
| 119 | + |
| 120 | +config PICOLIBC_LOCALE_INFO |
| 121 | + bool "support locales in libc functions" |
| 122 | + default n |
| 123 | + depends on PICOLIBC_USE_MODULE |
| 124 | + help |
| 125 | + Includes code for basic locale support |
| 126 | + |
| 127 | +config PICOLIBC_LOCALE_EXTENDED_INFO |
| 128 | + bool "support extended locales in libc functions" |
| 129 | + default n |
| 130 | + depends on PICOLIBC_USE_MODULE |
| 131 | + help |
| 132 | + Includes code for extended locale support |
| 133 | + |
| 134 | +config PICOLIBC_MULTIBYTE |
| 135 | + bool "support multibyte functions in libc" |
| 136 | + default n |
| 137 | + depends on PICOLIBC_USE_MODULE |
| 138 | + help |
| 139 | + Includes code for multi-byte characters |
| 140 | + |
| 141 | +config PICOLIBC_PICOEXIT |
| 142 | + bool "use smaller atexit/onexit implementation" |
| 143 | + default y |
| 144 | + depends on PICOLIBC_USE_MODULE |
| 145 | + help |
| 146 | + Provides a simpler atexit/onexit implementation that doesn't use |
| 147 | + malloc, but only supports a small number (32) of exit handlers. |
| 148 | + |
| 149 | +config PICOLIBC_MULTITHREAD |
| 150 | + bool "support multiple threads using retargetable locking API" |
| 151 | + default y |
| 152 | + depends on PICOLIBC_USE_MODULE |
| 153 | + help |
| 154 | + Protects shared data structures in libc with mutexes that use |
| 155 | + an API which can be retargeted to OS provided routines. |
| 156 | + |
| 157 | +config PICOLIBC_GLOBAL_ERRNO |
| 158 | + bool "use a single global variable for errno" |
| 159 | + depends on PICOLIBC_USE_MODULE |
| 160 | + help |
| 161 | + Picolibc usually uses a TLS variable for errno, ensuring that |
| 162 | + multiple threads have a reliable mechanism for detecting libc |
| 163 | + exceptions. This option switches to a single global errno variable, |
| 164 | + which can be used to avoid TLS variable usage by the library if |
| 165 | + necessary. |
| 166 | + |
| 167 | +endif |
| 168 | + |
| 169 | +endif |
0 commit comments