Ulf Magnusson | bd6e044 | 2019-11-01 13:45:29 +0100 | [diff] [blame] | 1 | # General configuration options |
Anas Nashif | 7d4163d | 2015-08-22 14:43:07 -0400 | [diff] [blame] | 2 | |
Anas Nashif | 7d4163d | 2015-08-22 14:43:07 -0400 | [diff] [blame] | 3 | # Copyright (c) 2014-2015 Wind River Systems, Inc. |
Daniel Leung | 8df10d4 | 2016-03-25 14:30:50 -0700 | [diff] [blame] | 4 | # Copyright (c) 2016 Intel Corporation |
Dominik Ermel | 865f801 | 2023-05-11 11:47:21 +0000 | [diff] [blame] | 5 | # Copyright (c) 2023 Nordic Semiconductor ASA |
David B. Kinder | ac74d8b | 2017-01-18 17:01:01 -0800 | [diff] [blame] | 6 | # SPDX-License-Identifier: Apache-2.0 |
Sebastian Bøe | 4b61bd1 | 2018-01-09 14:12:07 +0100 | [diff] [blame] | 7 | |
Pieter De Gendt | dfdebc9 | 2024-07-05 15:44:06 +0200 | [diff] [blame] | 8 | source "Kconfig.constants" |
| 9 | |
Torsten Rasmussen | 49389b5 | 2023-03-23 11:02:49 +0100 | [diff] [blame] | 10 | osource "${APPLICATION_SOURCE_DIR}/VERSION" |
Anas Nashif | 658f6bc | 2019-05-28 14:22:51 -0400 | [diff] [blame] | 11 | |
Ulf Magnusson | e63b652 | 2020-01-26 23:47:41 +0100 | [diff] [blame] | 12 | # Include Kconfig.defconfig files first so that they can override defaults and |
| 13 | # other symbol/choice properties by adding extra symbol/choice definitions. |
| 14 | # After merging all definitions for a symbol/choice, Kconfig picks the first |
| 15 | # property (e.g. the first default) with a satisfied condition. |
Ulf Magnusson | ec3eff5 | 2018-07-30 10:57:47 +0200 | [diff] [blame] | 16 | # |
Ulf Magnusson | e63b652 | 2020-01-26 23:47:41 +0100 | [diff] [blame] | 17 | # Shield defaults should have precedence over board defaults, which should have |
| 18 | # precedence over SoC defaults, so include them in that order. |
Ulf Magnusson | ec3eff5 | 2018-07-30 10:57:47 +0200 | [diff] [blame] | 19 | # |
Ulf Magnusson | e63b652 | 2020-01-26 23:47:41 +0100 | [diff] [blame] | 20 | # $ARCH and $BOARD_DIR will be glob patterns when building documentation. |
Torsten Rasmussen | 6be1b2a | 2021-06-02 08:47:21 +0200 | [diff] [blame] | 21 | # This loads custom shields defconfigs (from BOARD_ROOT) |
| 22 | osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig" |
| 23 | # This loads Zephyr base shield defconfigs |
| 24 | source "boards/shields/*/Kconfig.defconfig" |
| 25 | |
Torsten Rasmussen | 8dc3f85 | 2022-09-14 22:23:15 +0200 | [diff] [blame] | 26 | osource "$(BOARD_DIR)/Kconfig.defconfig" |
Torsten Rasmussen | 6be1b2a | 2021-06-02 08:47:21 +0200 | [diff] [blame] | 27 | |
Torsten Rasmussen | 8dc3f85 | 2022-09-14 22:23:15 +0200 | [diff] [blame] | 28 | # This loads Zephyr specific SoC root defconfigs |
| 29 | source "$(KCONFIG_BINARY_DIR)/soc/Kconfig.defconfig" |
| 30 | |
Torsten Rasmussen | 36bb00d | 2021-08-15 23:14:21 +0200 | [diff] [blame] | 31 | # This loads the toolchain defconfigs |
| 32 | osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig.defconfig" |
Krzysztof Chruscinski | 2735a3a | 2022-09-06 12:50:10 +0200 | [diff] [blame] | 33 | # This loads the testsuite defconfig |
| 34 | source "subsys/testsuite/Kconfig.defconfig" |
Ulf Magnusson | ec3eff5 | 2018-07-30 10:57:47 +0200 | [diff] [blame] | 35 | |
Kumar Gala | 52a3ec9 | 2022-08-12 10:00:38 -0500 | [diff] [blame] | 36 | # This should be early since the autogen Kconfig.dts symbols may get |
| 37 | # used by modules |
| 38 | source "dts/Kconfig" |
| 39 | |
Ioannis Glaropoulos | c520385 | 2020-12-07 18:42:52 +0100 | [diff] [blame] | 40 | menu "Modules" |
| 41 | |
Ioannis Glaropoulos | c520385 | 2020-12-07 18:42:52 +0100 | [diff] [blame] | 42 | source "modules/Kconfig" |
| 43 | |
| 44 | endmenu |
| 45 | |
Anas Nashif | abcf2ad | 2018-09-04 08:32:07 -0500 | [diff] [blame] | 46 | source "boards/Kconfig" |
Torsten Rasmussen | 5f7cc8d | 2020-07-06 12:53:39 +0200 | [diff] [blame] | 47 | source "soc/Kconfig" |
Anas Nashif | 77ba3c3 | 2015-10-09 06:20:52 -0400 | [diff] [blame] | 48 | source "arch/Kconfig" |
Anas Nashif | 77ba3c3 | 2015-10-09 06:20:52 -0400 | [diff] [blame] | 49 | source "kernel/Kconfig" |
Anas Nashif | 77ba3c3 | 2015-10-09 06:20:52 -0400 | [diff] [blame] | 50 | source "drivers/Kconfig" |
Anas Nashif | 0b2c44a | 2016-05-14 23:10:51 -0400 | [diff] [blame] | 51 | source "lib/Kconfig" |
Ramesh Thomas | e354ad2 | 2016-10-29 04:10:36 -0700 | [diff] [blame] | 52 | source "subsys/Kconfig" |
Kumar Gala | 7584a12 | 2016-05-24 14:23:26 -0500 | [diff] [blame] | 53 | |
Kumar Gala | 2630fba | 2020-01-24 09:39:40 -0600 | [diff] [blame] | 54 | osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig" |
Anas Nashif | 8017c59 | 2019-05-23 17:19:41 -0400 | [diff] [blame] | 55 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 56 | menu "Build and Link Features" |
| 57 | |
| 58 | menu "Linker Options" |
| 59 | |
Erwan Gouriou | 16d9d4d | 2023-03-22 15:09:48 +0100 | [diff] [blame] | 60 | choice LINKER_ORPHAN_CONFIGURATION |
Daniel Leung | 6600c64 | 2018-10-19 10:15:19 -0700 | [diff] [blame] | 61 | prompt "Linker Orphan Section Handling" |
| 62 | default LINKER_ORPHAN_SECTION_WARN |
| 63 | |
| 64 | config LINKER_ORPHAN_SECTION_PLACE |
| 65 | bool "Place" |
| 66 | help |
| 67 | Linker puts orphan sections in place without warnings |
| 68 | or errors. |
| 69 | |
| 70 | config LINKER_ORPHAN_SECTION_WARN |
| 71 | bool "Warn" |
| 72 | help |
Anas Nashif | f2cb20c | 2019-06-18 14:45:40 -0400 | [diff] [blame] | 73 | Linker places the orphan sections in output and issues |
Daniel Leung | 6600c64 | 2018-10-19 10:15:19 -0700 | [diff] [blame] | 74 | warning about those sections. |
| 75 | |
| 76 | config LINKER_ORPHAN_SECTION_ERROR |
| 77 | bool "Error" |
| 78 | help |
| 79 | Linker exits with error when an orphan section is found. |
| 80 | |
| 81 | endchoice |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 82 | |
| 83 | config HAS_FLASH_LOAD_OFFSET |
| 84 | bool |
| 85 | help |
| 86 | This option is selected by targets having a FLASH_LOAD_OFFSET |
| 87 | and FLASH_LOAD_SIZE. |
| 88 | |
Ulf Magnusson | fd9981a | 2019-11-16 01:33:09 +0100 | [diff] [blame] | 89 | if HAS_FLASH_LOAD_OFFSET |
| 90 | |
Ulf Magnusson | 90b9eb3 | 2019-11-16 01:22:16 +0100 | [diff] [blame] | 91 | config USE_DT_CODE_PARTITION |
Ulf Magnusson | 1f9c5f1 | 2019-11-16 01:16:57 +0100 | [diff] [blame] | 92 | bool "Link application into /chosen/zephyr,code-partition from devicetree" |
Andrzej Puzdrowski | 2b1227f | 2019-03-18 14:02:11 +0100 | [diff] [blame] | 93 | help |
Ulf Magnusson | 1f9c5f1 | 2019-11-16 01:16:57 +0100 | [diff] [blame] | 94 | When enabled, the application will be linked into the flash partition |
| 95 | selected by the zephyr,code-partition property in /chosen in devicetree. |
| 96 | When this is disabled, the flash load offset and size can be set manually |
| 97 | below. |
Andrzej Puzdrowski | 2b1227f | 2019-03-18 14:02:11 +0100 | [diff] [blame] | 98 | |
Kumar Gala | 8ce0cf0 | 2019-08-28 09:29:26 -0500 | [diff] [blame] | 99 | # Workaround for not being able to have commas in macro arguments |
| 100 | DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition |
| 101 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 102 | config FLASH_LOAD_OFFSET |
Ulf Magnusson | 90b9eb3 | 2019-11-16 01:22:16 +0100 | [diff] [blame] | 103 | # Only user-configurable when USE_DT_CODE_PARTITION is disabled |
| 104 | hex "Kernel load offset" if !USE_DT_CODE_PARTITION |
| 105 | default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 106 | default 0 |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 107 | help |
| 108 | This option specifies the byte offset from the beginning of flash that |
| 109 | the kernel should be loaded into. Changing this value from zero will |
| 110 | affect the Zephyr image's link, and will decrease the total amount of |
| 111 | flash available for use by application code. |
| 112 | |
| 113 | If unsure, leave at the default value 0. |
| 114 | |
| 115 | config FLASH_LOAD_SIZE |
Ulf Magnusson | 90b9eb3 | 2019-11-16 01:22:16 +0100 | [diff] [blame] | 116 | # Only user-configurable when USE_DT_CODE_PARTITION is disabled |
| 117 | hex "Kernel load size" if !USE_DT_CODE_PARTITION |
| 118 | default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 119 | default 0 |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 120 | help |
| 121 | If non-zero, this option specifies the size, in bytes, of the flash |
| 122 | area that the Zephyr image will be allowed to occupy. If zero, the |
| 123 | image will be able to occupy from the FLASH_LOAD_OFFSET to the end of |
| 124 | the device. |
| 125 | |
| 126 | If unsure, leave at the default value 0. |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 127 | |
Ulf Magnusson | fd9981a | 2019-11-16 01:33:09 +0100 | [diff] [blame] | 128 | endif # HAS_FLASH_LOAD_OFFSET |
| 129 | |
Stephanos Ioannidis | 3322489 | 2020-02-10 16:37:24 +0900 | [diff] [blame] | 130 | config ROM_START_OFFSET |
Ole Sæther | 985446a | 2019-01-23 14:13:03 +0100 | [diff] [blame] | 131 | hex |
Stephanos Ioannidis | 3322489 | 2020-02-10 16:37:24 +0900 | [diff] [blame] | 132 | prompt "ROM start offset" if !BOOTLOADER_MCUBOOT |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 133 | default 0x200 if BOOTLOADER_MCUBOOT |
| 134 | default 0 |
| 135 | help |
| 136 | If the application is built for chain-loading by a bootloader this |
| 137 | variable is required to be set to value that leaves sufficient |
Stephanos Ioannidis | 3322489 | 2020-02-10 16:37:24 +0900 | [diff] [blame] | 138 | space between the beginning of the image and the start of the first |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 139 | section to store an image header or any other metadata. |
| 140 | In the particular case of the MCUboot bootloader this reserves enough |
| 141 | space to store the image header, which should also meet vector table |
| 142 | alignment requirements on most ARM targets, although some targets |
| 143 | may require smaller or larger values. |
| 144 | |
Jamie McCrae | 7c631f0 | 2023-10-30 17:16:31 +0000 | [diff] [blame] | 145 | config ROM_END_OFFSET |
| 146 | hex "ROM end offset" |
| 147 | default 0 |
| 148 | help |
| 149 | If non-zero, this option reduces the maximum size that the Zephyr image is allowed to |
| 150 | occupy, this is to allow for additional image storage which can be created and used by |
| 151 | other systems such as bootloaders (for MCUboot, this would include the image swap |
| 152 | fields and TLV storage at the end of the image). |
| 153 | |
| 154 | If unsure, leave at the default value 0. |
| 155 | |
Torsten Rasmussen | 761eada | 2021-06-09 11:22:07 +0200 | [diff] [blame] | 156 | config LD_LINKER_SCRIPT_SUPPORTED |
| 157 | bool |
| 158 | default y |
| 159 | |
| 160 | choice LINKER_SCRIPT |
| 161 | prompt "Linker script" |
| 162 | default LD_LINKER_TEMPLATE if LD_LINKER_SCRIPT_SUPPORTED |
| 163 | |
| 164 | config LD_LINKER_TEMPLATE |
| 165 | bool "LD template" |
| 166 | depends on LD_LINKER_SCRIPT_SUPPORTED |
| 167 | help |
| 168 | Select this option to use the LD linker script templates. |
| 169 | The templates are pre-processed by the C pre-processor to create the |
| 170 | final LD linker script. |
| 171 | |
| 172 | config CMAKE_LINKER_GENERATOR |
| 173 | bool "CMake generator" |
| 174 | depends on ARM |
| 175 | help |
| 176 | Select this option to use the Zephyr CMake linker script generator. |
| 177 | The linker configuration is written in CMake and the final linker |
| 178 | script will be generated by the toolchain specific linker generator. |
| 179 | For LD based linkers, this will be the ld generator, for ARMClang / |
| 180 | armlink based linkers it will be the scatter generator. |
| 181 | |
| 182 | endchoice |
| 183 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 184 | config HAVE_CUSTOM_LINKER_SCRIPT |
Torsten Rasmussen | 761eada | 2021-06-09 11:22:07 +0200 | [diff] [blame] | 185 | bool "Custom linker script provided" |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 186 | help |
| 187 | Set this option if you have a custom linker script which needed to |
| 188 | be define in CUSTOM_LINKER_SCRIPT. |
| 189 | |
| 190 | config CUSTOM_LINKER_SCRIPT |
| 191 | string "Path to custom linker script" |
| 192 | depends on HAVE_CUSTOM_LINKER_SCRIPT |
| 193 | help |
| 194 | Path to the linker script to be used instead of the one define by the |
| 195 | board. |
| 196 | |
| 197 | The linker script must be based on a version provided by Zephyr since |
| 198 | the kernel can expect a certain layout/certain regions. |
| 199 | |
| 200 | This is useful when an application needs to add sections into the |
| 201 | linker script and avoid having to change the script provided by |
| 202 | Zephyr. |
| 203 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 204 | config KERNEL_ENTRY |
| 205 | string "Kernel entry symbol" |
| 206 | default "__start" |
| 207 | help |
| 208 | Code entry symbol, to be set at linking phase. |
| 209 | |
Sebastian Bøe | 3a0597f | 2019-03-15 14:05:09 +0100 | [diff] [blame] | 210 | config LINKER_SORT_BY_ALIGNMENT |
| 211 | bool "Sort input sections by alignment" |
| 212 | default y |
| 213 | help |
| 214 | This turns on the linker flag to sort sections by alignment |
| 215 | in decreasing size of symbols. This helps to minimize |
| 216 | padding between symbols. |
| 217 | |
Jordan Yates | 318ee97 | 2021-04-17 20:04:33 +1000 | [diff] [blame] | 218 | config SRAM_VECTOR_TABLE |
| 219 | bool "Place the vector table in SRAM instead of flash" |
| 220 | help |
| 221 | The option specifies that the vector table should be placed at the |
| 222 | start of SRAM instead of the start of flash. |
| 223 | |
Daniel Leung | ece9cad | 2021-02-20 11:02:17 -0800 | [diff] [blame] | 224 | config HAS_SRAM_OFFSET |
| 225 | bool |
| 226 | help |
| 227 | This option is selected by targets that require SRAM_OFFSET. |
| 228 | |
| 229 | config SRAM_OFFSET |
| 230 | hex "Kernel SRAM offset" if HAS_SRAM_OFFSET |
| 231 | default 0 |
| 232 | help |
| 233 | This option specifies the byte offset from the beginning of SRAM |
| 234 | where the kernel begins. Changing this value from zero will affect |
| 235 | the Zephyr image's link, and will decrease the total amount of |
| 236 | SRAM available for use by application code. |
| 237 | |
| 238 | If unsure, leave at the default value 0. |
| 239 | |
Daniel Leung | d812728 | 2021-02-24 10:18:34 -0800 | [diff] [blame] | 240 | menu "Linker Sections" |
| 241 | |
| 242 | config LINKER_USE_BOOT_SECTION |
Gerard Marull-Paretas | dffaf53 | 2022-03-09 12:31:16 +0100 | [diff] [blame] | 243 | bool "Use Boot Linker Section" |
Daniel Leung | d812728 | 2021-02-24 10:18:34 -0800 | [diff] [blame] | 244 | help |
| 245 | If enabled, the symbols which are needed for the boot process |
| 246 | will be put into another linker section reserved for these |
| 247 | symbols. |
| 248 | |
| 249 | Requires that boot sections exist in the architecture, SoC, |
| 250 | board or custom linker script. |
| 251 | |
Daniel Leung | 1310ad6 | 2021-02-23 13:33:38 -0800 | [diff] [blame] | 252 | config LINKER_USE_PINNED_SECTION |
Gerard Marull-Paretas | dffaf53 | 2022-03-09 12:31:16 +0100 | [diff] [blame] | 253 | bool "Use Pinned Linker Section" |
Daniel Leung | 1310ad6 | 2021-02-23 13:33:38 -0800 | [diff] [blame] | 254 | help |
| 255 | If enabled, the symbols which need to be pinned in memory |
| 256 | will be put into another linker section reserved for pinned |
| 257 | symbols. During boot, the corresponding memory will be marked |
| 258 | as pinned. |
| 259 | |
| 260 | Requires that pinned sections exist in the architecture, SoC, |
| 261 | board or custom linker script. |
| 262 | |
Daniel Leung | 6a006d7 | 2021-07-12 10:58:45 -0700 | [diff] [blame] | 263 | config LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT |
| 264 | bool "Generic sections are present at boot" if DEMAND_PAGING && LINKER_USE_PINNED_SECTION |
| 265 | default y |
| 266 | help |
| 267 | When disabled, the linker sections other than the boot and |
| 268 | pinned sections will be marked as not present in the page |
| 269 | tables. This allows kernel to pull in data pages on demand |
| 270 | as required by current execution context when demand paging |
| 271 | is enabled. There is no need to load all code and data into |
| 272 | memory at once. |
| 273 | |
| 274 | If unsure, say Y. |
| 275 | |
Torsten Rasmussen | c107827 | 2022-09-27 12:34:36 +0200 | [diff] [blame] | 276 | config LINKER_LAST_SECTION_ID |
| 277 | bool "Last section identifier" |
Nicolas Pitre | 87f68b4 | 2024-07-30 01:28:27 -0400 | [diff] [blame^] | 278 | default y if !ARM64 |
Torsten Rasmussen | c107827 | 2022-09-27 12:34:36 +0200 | [diff] [blame] | 279 | depends on ARM || ARM64 || RISCV |
| 280 | help |
| 281 | If enabled, the last section will contain an identifier. |
| 282 | This ensures that the '_flash_used' linker symbol will always be |
| 283 | correctly calculated, even in cases where the location counter may |
| 284 | have been incremented for alignment purposes but no data is placed |
| 285 | after alignment. |
| 286 | |
| 287 | Note: in cases where the flash is fully used, for example application |
| 288 | specific data is written at the end of the flash area, then writing a |
| 289 | last section identifier may cause rom region overflow. |
| 290 | In such cases this setting should be disabled. |
| 291 | |
| 292 | config LINKER_LAST_SECTION_ID_PATTERN |
| 293 | hex "Last section identifier pattern" |
| 294 | default "0xE015E015" |
| 295 | depends on LINKER_LAST_SECTION_ID |
| 296 | help |
| 297 | Pattern to fill into last section as identifier. |
| 298 | Default pattern is 0xE015 (end of last section), but any pattern can |
| 299 | be used. |
| 300 | The size of the pattern must not exceed 4 bytes. |
| 301 | |
Flavio Ceolin | 56ec06f | 2022-12-20 10:36:34 -0800 | [diff] [blame] | 302 | config LINKER_USE_NO_RELAX |
| 303 | bool |
| 304 | help |
| 305 | Hidden symbol to allow features to force the use of no relax. |
| 306 | |
| 307 | config LINKER_USE_RELAX |
| 308 | bool "Linker optimization of call addressing" |
| 309 | depends on !LINKER_USE_NO_RELAX |
| 310 | default y |
| 311 | help |
| 312 | This option performs global optimizations that become possible when the linker resolves |
| 313 | addressing in the program, such as relaxing address modes and synthesizing new |
| 314 | instructions in the output object file. For ld and lld, this enables `--relax`. |
| 315 | On platforms where this is not supported, `--relax' is accepted, but ignored. |
| 316 | Disabling it can reduce performance, as the linker is no longer able to substiture long / |
| 317 | in-effective jump calls to shorter / more effective instructions. |
| 318 | |
Daniel Leung | d812728 | 2021-02-24 10:18:34 -0800 | [diff] [blame] | 319 | endmenu # "Linker Sections" |
| 320 | |
Pieter De Gendt | a2b866e6 | 2024-05-06 16:29:43 +0200 | [diff] [blame] | 321 | config LINKER_ITERABLE_SUBALIGN |
| 322 | int |
| 323 | default 8 if 64BIT |
| 324 | default 4 |
| 325 | help |
| 326 | Hidden option for the default subalignment of iterable sections. |
| 327 | |
Krzysztof Chruscinski | dfb3674 | 2022-04-22 11:36:05 +0200 | [diff] [blame] | 328 | config LINKER_DEVNULL_SUPPORT |
| 329 | bool |
| 330 | default y if CPU_CORTEX_M || (RISCV && !64BIT) |
| 331 | |
| 332 | config LINKER_DEVNULL_MEMORY |
| 333 | bool "Devnull region" |
| 334 | depends on LINKER_DEVNULL_SUPPORT |
| 335 | help |
| 336 | Devnull region is created. It is stripped from final binary but remains |
| 337 | in byproduct elf file. |
| 338 | |
| 339 | config LINKER_DEVNULL_MEMORY_SIZE |
| 340 | int "Devnull region size" |
| 341 | depends on LINKER_DEVNULL_MEMORY |
| 342 | default 262144 |
| 343 | help |
| 344 | Size can be adjusted so it fits all data placed in that region. |
| 345 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 346 | endmenu |
| 347 | |
| 348 | menu "Compiler Options" |
| 349 | |
Pieter De Gendt | 86b721c | 2024-04-03 09:32:10 +0200 | [diff] [blame] | 350 | config REQUIRES_STD_C99 |
| 351 | bool |
| 352 | help |
| 353 | Hidden option to select compiler support C99 standard or higher. |
| 354 | |
| 355 | config REQUIRES_STD_C11 |
| 356 | bool |
| 357 | select REQUIRES_STD_C99 |
| 358 | help |
| 359 | Hidden option to select compiler support C11 standard or higher. |
| 360 | |
| 361 | config REQUIRES_STD_C17 |
| 362 | bool |
| 363 | select REQUIRES_STD_C11 |
| 364 | help |
| 365 | Hidden option to select compiler support C17 standard or higher. |
| 366 | |
| 367 | config REQUIRES_STD_C23 |
| 368 | bool |
| 369 | select REQUIRES_STD_C17 |
| 370 | help |
| 371 | Hidden option to select compiler support C23 standard or higher. |
| 372 | |
| 373 | choice STD_C |
| 374 | prompt "C Standard" |
| 375 | default STD_C23 if REQUIRES_STD_C23 |
| 376 | default STD_C17 if REQUIRES_STD_C17 |
| 377 | default STD_C11 if REQUIRES_STD_C11 |
| 378 | default STD_C99 |
| 379 | help |
| 380 | C Standards. |
| 381 | |
| 382 | config STD_C90 |
| 383 | bool "C90" |
| 384 | depends on !REQUIRES_STD_C99 |
| 385 | help |
| 386 | 1989 C standard as completed in 1989 and ratified by ISO/IEC |
| 387 | as ISO/IEC 9899:1990. This version is known as "ANSI C". |
| 388 | |
| 389 | config STD_C99 |
| 390 | bool "C99" |
| 391 | depends on !REQUIRES_STD_C11 |
| 392 | help |
| 393 | 1999 C standard. |
| 394 | |
| 395 | config STD_C11 |
| 396 | bool "C11" |
| 397 | depends on !REQUIRES_STD_C17 |
| 398 | help |
| 399 | 2011 C standard. |
| 400 | |
| 401 | config STD_C17 |
| 402 | bool "C17" |
| 403 | depends on !REQUIRES_STD_C23 |
| 404 | help |
| 405 | 2017 C standard, addresses defects in C11 without introducing |
| 406 | new language features. |
| 407 | |
| 408 | config STD_C23 |
| 409 | bool "C23" |
| 410 | help |
| 411 | 2023 C standard. |
| 412 | |
| 413 | endchoice |
| 414 | |
Pieter De Gendt | a599ed1 | 2024-04-15 19:28:45 +0200 | [diff] [blame] | 415 | config TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS |
| 416 | bool |
| 417 | default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr" |
| 418 | help |
| 419 | Hidden option to signal that toolchain supports GNU Extensions. |
| 420 | |
| 421 | config GNU_C_EXTENSIONS |
| 422 | bool "GNU C Extensions" |
| 423 | depends on TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS |
| 424 | help |
| 425 | Enable GNU C Extensions. GNU C provides several language features |
| 426 | not found in ISO standard C. |
| 427 | |
Flavio Ceolin | b587e8d | 2020-08-26 09:48:33 -0700 | [diff] [blame] | 428 | config CODING_GUIDELINE_CHECK |
| 429 | bool "Enforce coding guideline rules" |
| 430 | help |
| 431 | Use available compiler flags to check coding guideline rules during |
| 432 | the build. |
| 433 | |
Keith Packard | be4b76f | 2023-10-12 11:55:04 -0700 | [diff] [blame] | 434 | config NATIVE_LIBC |
Alberto Escolar Piedras | 2eb14f1 | 2023-05-26 13:15:09 +0200 | [diff] [blame] | 435 | bool |
Keith Packard | 214a3c5 | 2023-02-08 13:44:39 -0800 | [diff] [blame] | 436 | select FULL_LIBC_SUPPORTED |
Keith Packard | be4b76f | 2023-10-12 11:55:04 -0700 | [diff] [blame] | 437 | help |
| 438 | Zephyr will use the host system C library. |
| 439 | |
| 440 | config NATIVE_LIBCPP |
| 441 | bool |
| 442 | select FULL_LIBCPP_SUPPORTED |
| 443 | help |
| 444 | Zephyr will use the host system C++ library |
| 445 | |
| 446 | config NATIVE_BUILD |
| 447 | bool |
| 448 | select NATIVE_LIBC if EXTERNAL_LIBC |
| 449 | select NATIVE_LIBCPP if EXTERNAL_LIBCPP |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 450 | help |
Alberto Escolar Piedras | 2eb14f1 | 2023-05-26 13:15:09 +0200 | [diff] [blame] | 451 | Zephyr will be built targeting the host system for debug and |
| 452 | development purposes. |
| 453 | |
| 454 | config NATIVE_APPLICATION |
| 455 | bool |
| 456 | default y if ARCH_POSIX |
| 457 | depends on !NATIVE_LIBRARY |
| 458 | select NATIVE_BUILD |
| 459 | help |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 460 | Build as a native application that can run on the host and using |
| 461 | resources and libraries provided by the host. |
| 462 | |
Alberto Escolar Piedras | 2eb14f1 | 2023-05-26 13:15:09 +0200 | [diff] [blame] | 463 | config NATIVE_LIBRARY |
| 464 | bool |
| 465 | select NATIVE_BUILD |
| 466 | help |
| 467 | Build as a prelinked library for the native host target. |
| 468 | This library can later be built into an executable for the host. |
| 469 | |
Keith Packard | 6c5d806 | 2023-02-08 14:56:50 -0800 | [diff] [blame] | 470 | config COMPILER_FREESTANDING |
| 471 | bool "Build in a freestanding compiler mode" |
| 472 | help |
| 473 | Configure the compiler to operate in freestanding mode according to |
| 474 | the C and C++ language specifications. Freestanding mode reduces the |
| 475 | requirements of the compiler and language environment, which can |
| 476 | negatively impact the ability for the compiler to detect errors and |
| 477 | perform optimizations. |
| 478 | |
Emil Lindqvist | f7dad07 | 2021-09-03 13:52:33 +0200 | [diff] [blame] | 479 | choice COMPILER_OPTIMIZATIONS |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 480 | prompt "Optimization level" |
| 481 | default NO_OPTIMIZATIONS if COVERAGE |
| 482 | default DEBUG_OPTIMIZATIONS if DEBUG |
Jonathon Penix | eaa903d | 2024-03-20 10:45:29 -0700 | [diff] [blame] | 483 | default SIZE_OPTIMIZATIONS_AGGRESSIVE if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm" |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 484 | default SIZE_OPTIMIZATIONS |
| 485 | help |
| 486 | Note that these flags shall only control the compiler |
| 487 | optimization level, and that no extra debug code shall be |
| 488 | conditionally compiled based on them. |
| 489 | |
| 490 | config SIZE_OPTIMIZATIONS |
| 491 | bool "Optimize for size" |
| 492 | help |
| 493 | Compiler optimizations will be set to -Os independently of other |
| 494 | options. |
| 495 | |
Jonathon Penix | d6041d6 | 2024-03-20 10:29:51 -0700 | [diff] [blame] | 496 | config SIZE_OPTIMIZATIONS_AGGRESSIVE |
| 497 | bool "Aggressively optimize for size" |
| 498 | help |
| 499 | Compiler optimizations wil be set to -Oz independently of other |
| 500 | options. |
| 501 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 502 | config SPEED_OPTIMIZATIONS |
| 503 | bool "Optimize for speed" |
| 504 | help |
| 505 | Compiler optimizations will be set to -O2 independently of other |
| 506 | options. |
| 507 | |
| 508 | config DEBUG_OPTIMIZATIONS |
| 509 | bool "Optimize debugging experience" |
| 510 | help |
| 511 | Compiler optimizations will be set to -Og independently of other |
| 512 | options. |
| 513 | |
| 514 | config NO_OPTIMIZATIONS |
| 515 | bool "Optimize nothing" |
| 516 | help |
| 517 | Compiler optimizations will be set to -O0 independently of other |
| 518 | options. |
Henrik Brix Andersen | 26ebcee | 2023-03-22 10:19:40 +0100 | [diff] [blame] | 519 | |
| 520 | Selecting this option will likely require manual tuning of the |
| 521 | default stack sizes in order to avoid stack overflows. |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 522 | endchoice |
| 523 | |
Radoslaw Koppel | 26c8776 | 2024-01-30 12:32:32 +0100 | [diff] [blame] | 524 | config LTO |
| 525 | bool "Link Time Optimization [EXPERIMENTAL]" |
Reto Schneider | 75a3805 | 2024-03-19 12:22:48 +0100 | [diff] [blame] | 526 | depends on !(GEN_ISR_TABLES || GEN_IRQ_VECTOR_TABLE) || ISR_TABLES_LOCAL_DECLARATION |
| 527 | depends on !NATIVE_LIBRARY |
| 528 | depends on !CODE_DATA_RELOCATION |
Radoslaw Koppel | 26c8776 | 2024-01-30 12:32:32 +0100 | [diff] [blame] | 529 | select EXPERIMENTAL |
| 530 | help |
| 531 | This option enables Link Time Optimization. |
| 532 | |
Nikolay Agishev | 0dec4cf | 2022-12-22 15:46:04 +0400 | [diff] [blame] | 533 | config COMPILER_WARNINGS_AS_ERRORS |
| 534 | bool "Treat warnings as errors" |
| 535 | help |
| 536 | Turn on "warning as error" toolchain flags |
| 537 | |
Fabio Baltieri | 3f8f713 | 2023-03-29 10:11:46 +0100 | [diff] [blame] | 538 | config COMPILER_SAVE_TEMPS |
| 539 | bool "Save temporary object files" |
| 540 | help |
| 541 | Instruct the compiler to save the temporary intermediate files |
| 542 | permanently. These can be useful for troubleshooting build issues. |
| 543 | |
Gerard Marull-Paretas | 99ebe39 | 2023-05-05 09:58:12 +0200 | [diff] [blame] | 544 | config COMPILER_TRACK_MACRO_EXPANSION |
| 545 | bool "Track macro expansion" |
| 546 | default y |
| 547 | help |
| 548 | When enabled, locations of tokens across macro expansions will be |
| 549 | tracked. Disabling this option may be useful to debug long macro |
| 550 | expansion chains. |
| 551 | |
Arvin Farahmand | e430b7b | 2021-04-15 11:20:10 -0400 | [diff] [blame] | 552 | config COMPILER_COLOR_DIAGNOSTICS |
Gerard Marull-Paretas | 95fb0de | 2022-03-09 12:05:12 +0100 | [diff] [blame] | 553 | bool "Colored diagnostics" |
Arvin Farahmand | e430b7b | 2021-04-15 11:20:10 -0400 | [diff] [blame] | 554 | default y |
| 555 | help |
| 556 | Compiler diagnostic messages are colorized. |
| 557 | |
Keith Packard | 62bc9bf | 2022-04-26 19:24:11 -0700 | [diff] [blame] | 558 | choice COMPILER_SECURITY_FORTIFY |
| 559 | prompt "Detect buffer overflows in libc calls" |
Alberto Escolar Piedras | 56dc20e | 2023-05-26 13:23:43 +0200 | [diff] [blame] | 560 | default FORTIFY_SOURCE_NONE if NO_OPTIMIZATIONS || MINIMAL_LIBC || NATIVE_BUILD |
Keith Packard | 62bc9bf | 2022-04-26 19:24:11 -0700 | [diff] [blame] | 561 | default FORTIFY_SOURCE_COMPILE_TIME |
| 562 | help |
| 563 | Buffer overflow checking in libc calls. Supported by Clang and |
| 564 | GCC when using Picolibc or Newlib. Requires compiler optimization |
| 565 | to be enabled. |
| 566 | |
| 567 | config FORTIFY_SOURCE_NONE |
| 568 | bool "No detection" |
| 569 | help |
| 570 | Disables both compile-time and run-time checking. |
| 571 | |
| 572 | config FORTIFY_SOURCE_COMPILE_TIME |
| 573 | bool "Compile-time detection" |
| 574 | help |
| 575 | Enables only compile-time checking. Compile-time checking |
| 576 | doesn't increase executable size or reduce performance, it |
| 577 | limits checking to what can be done with information available |
| 578 | at compile time. |
| 579 | |
| 580 | config FORTIFY_SOURCE_RUN_TIME |
| 581 | bool "Compile-time and run-time detection" |
| 582 | help |
| 583 | Enables both compile-time and run-time checking. Run-time |
| 584 | checking increases coverage at the expense of additional code, |
| 585 | and means that applications will raise a runtime exception |
| 586 | when buffer overflow is detected. |
| 587 | |
| 588 | endchoice |
| 589 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 590 | config COMPILER_OPT |
| 591 | string "Custom compiler options" |
| 592 | help |
| 593 | This option is a free-form string that is passed to the compiler |
| 594 | when building all parts of a project (i.e. kernel). |
| 595 | The compiler options specified by this string supplement the |
| 596 | predefined set of compiler supplied by the build system, |
| 597 | and can be used to change compiler optimization, warning and error |
| 598 | messages, and so on. |
| 599 | |
Martí Bolívar | e5cc854 | 2021-05-21 10:56:23 -0700 | [diff] [blame] | 600 | config MISRA_SANE |
| 601 | bool "MISRA standards compliance features" |
| 602 | help |
| 603 | Causes the source code to build in "MISRA" mode, which |
| 604 | disallows some otherwise-permitted features of the C |
| 605 | standard for safety reasons. Specifically variable length |
| 606 | arrays are not permitted (and gcc will enforce this). |
| 607 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 608 | endmenu |
| 609 | |
Anas Nashif | 22b95a2 | 2019-11-24 11:28:38 -0500 | [diff] [blame] | 610 | choice |
| 611 | prompt "Error checking behavior for CHECK macro" |
| 612 | default RUNTIME_ERROR_CHECKS |
| 613 | |
| 614 | config ASSERT_ON_ERRORS |
| 615 | bool "Assert on all errors" |
| 616 | help |
Henrik Brix Andersen | 8261a4b | 2024-04-16 19:03:45 +0000 | [diff] [blame] | 617 | Assert on errors covered with the CHECKIF() macro. |
Anas Nashif | 22b95a2 | 2019-11-24 11:28:38 -0500 | [diff] [blame] | 618 | |
| 619 | config NO_RUNTIME_CHECKS |
| 620 | bool "No runtime error checks" |
| 621 | help |
Henrik Brix Andersen | 8261a4b | 2024-04-16 19:03:45 +0000 | [diff] [blame] | 622 | Do not do any runtime checks or asserts when using the CHECKIF() macro. |
Anas Nashif | 22b95a2 | 2019-11-24 11:28:38 -0500 | [diff] [blame] | 623 | |
| 624 | config RUNTIME_ERROR_CHECKS |
Gerard Marull-Paretas | 95fb0de | 2022-03-09 12:05:12 +0100 | [diff] [blame] | 625 | bool "Runtime error checks" |
Anas Nashif | 22b95a2 | 2019-11-24 11:28:38 -0500 | [diff] [blame] | 626 | help |
Henrik Brix Andersen | 8261a4b | 2024-04-16 19:03:45 +0000 | [diff] [blame] | 627 | Always perform runtime checks covered with the CHECKIF() macro. This |
Anas Nashif | 22b95a2 | 2019-11-24 11:28:38 -0500 | [diff] [blame] | 628 | option is the default and the only option used during testing. |
| 629 | |
| 630 | endchoice |
| 631 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 632 | menu "Build Options" |
| 633 | |
| 634 | config KERNEL_BIN_NAME |
| 635 | string "The kernel binary name" |
| 636 | default "zephyr" |
| 637 | help |
| 638 | This option sets the name of the generated kernel binary. |
| 639 | |
| 640 | config OUTPUT_STAT |
| 641 | bool "Create a statistics file" |
| 642 | default y |
| 643 | help |
| 644 | Create a stat file using readelf -e <elf> |
| 645 | |
Anas Nashif | 47a673f | 2022-06-27 10:08:37 -0400 | [diff] [blame] | 646 | config OUTPUT_SYMBOLS |
| 647 | bool "Create a symbol file" |
| 648 | help |
| 649 | Create a symbol file using nm <elf> |
| 650 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 651 | config OUTPUT_DISASSEMBLY |
| 652 | bool "Create a disassembly file" |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 653 | help |
| 654 | Create an .lst file with the assembly listing of the firmware. |
| 655 | |
Rohit Gujarathi | 35713f2 | 2020-05-07 10:08:37 +0530 | [diff] [blame] | 656 | config OUTPUT_DISASSEMBLE_ALL |
| 657 | bool "Disassemble all sections with source. Fill zeros." |
| 658 | default n |
| 659 | depends on OUTPUT_DISASSEMBLY |
| 660 | help |
| 661 | The .lst file will contain complete disassembly of the firmware |
| 662 | not just those expected to contain instructions including zeros |
| 663 | |
Laurentiu Mihalcea | fb7e937 | 2024-04-16 11:26:01 +0300 | [diff] [blame] | 664 | config OUTPUT_DISASSEMBLY_WITH_SOURCE |
| 665 | bool "Include source code in output disassembly file" |
| 666 | default y |
| 667 | depends on OUTPUT_DISASSEMBLY && !OUTPUT_DISASSEMBLE_ALL |
| 668 | help |
| 669 | The .lst file will also contain the source code. Having |
| 670 | control over this can be useful for reproducible builds |
| 671 | since it can be used to remove one of the elements of |
| 672 | the .lst file that can vary across platforms because |
| 673 | of reasons such as having ".." include paths. |
| 674 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 675 | config OUTPUT_PRINT_MEMORY_USAGE |
| 676 | bool "Print memory usage to stdout" |
| 677 | default y |
| 678 | help |
| 679 | If the toolchain supports it, this option will pass |
| 680 | --print-memory-region to the linker when it is doing it's first |
| 681 | linker pass. Note that the memory regions are symbolic concepts |
| 682 | defined by the linker scripts and do not necessarily map |
| 683 | directly to the real physical address space. Take also note that |
| 684 | some platforms do two passes of the linker so the results do not |
| 685 | match exactly to the final elf file. See also rom_report, |
| 686 | ram_report and |
| 687 | https://sourceware.org/binutils/docs/ld/MEMORY.html |
| 688 | |
Anas Nashif | fdbf2db | 2020-10-20 14:31:56 -0400 | [diff] [blame] | 689 | config CLEANUP_INTERMEDIATE_FILES |
| 690 | bool "Remove all intermediate files" |
| 691 | help |
| 692 | Delete intermediate files to save space and cleanup clutter resulting |
Filip Kokosinski | 7388a07 | 2023-07-19 15:40:55 +0200 | [diff] [blame] | 693 | from the build process. Note this breaks incremental builds, west spdx |
| 694 | (Software Bill of Material generation), and maybe others. |
Anas Nashif | fdbf2db | 2020-10-20 14:31:56 -0400 | [diff] [blame] | 695 | |
Martí Bolívar | f39fdc4 | 2020-08-06 14:57:17 -0700 | [diff] [blame] | 696 | config BUILD_NO_GAP_FILL |
| 697 | bool "Don't fill gaps in generated hex/bin/s19 files." |
| 698 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 699 | config BUILD_OUTPUT_HEX |
| 700 | bool "Build a binary in HEX format" |
| 701 | help |
Martí Bolívar | f39fdc4 | 2020-08-06 14:57:17 -0700 | [diff] [blame] | 702 | Build an Intel HEX binary zephyr/zephyr.hex in the build directory. |
| 703 | The name of this file can be customized with CONFIG_KERNEL_BIN_NAME. |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 704 | |
| 705 | config BUILD_OUTPUT_BIN |
| 706 | bool "Build a binary in BIN format" |
| 707 | default y |
| 708 | help |
Martí Bolívar | f39fdc4 | 2020-08-06 14:57:17 -0700 | [diff] [blame] | 709 | Build a "raw" binary zephyr/zephyr.bin in the build directory. |
| 710 | The name of this file can be customized with CONFIG_KERNEL_BIN_NAME. |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 711 | |
Anas Nashif | 51c34bb | 2021-01-26 06:58:30 -0500 | [diff] [blame] | 712 | config BUILD_OUTPUT_EFI |
| 713 | bool "Build as an EFI application" |
| 714 | default n |
| 715 | depends on X86_64 |
| 716 | help |
| 717 | Build as an EFI application. |
| 718 | |
| 719 | This works by creating a "zephyr.efi" EFI binary containing a zephyr |
| 720 | image extracted from a built zephyr.elf file. EFI applications are |
| 721 | relocatable, and cannot be placed at specific locations in memory. |
| 722 | Instead, the stub code will copy the embedded zephyr sections to the |
| 723 | appropriate locations at startup, clear any zero-filled (BSS, etc...) |
| 724 | areas, then jump into the 64 bit entry point. |
| 725 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 726 | config BUILD_OUTPUT_EXE |
| 727 | bool "Build a binary in ELF format with .exe extension" |
| 728 | help |
Martí Bolívar | f39fdc4 | 2020-08-06 14:57:17 -0700 | [diff] [blame] | 729 | Build an ELF binary that can run in the host system at |
| 730 | zephyr/zephyr.exe in the build directory. |
| 731 | The name of this file can be customized with CONFIG_KERNEL_BIN_NAME. |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 732 | |
| 733 | config BUILD_OUTPUT_S19 |
| 734 | bool "Build a binary in S19 format" |
| 735 | help |
Martí Bolívar | f39fdc4 | 2020-08-06 14:57:17 -0700 | [diff] [blame] | 736 | Build an S19 binary zephyr/zephyr.s19 in the build directory. |
| 737 | The name of this file can be customized with CONFIG_KERNEL_BIN_NAME. |
Håkon Øye Amundsen | c086b93 | 2018-11-26 09:47:16 +0000 | [diff] [blame] | 738 | |
Pete Johanson | 310a464 | 2020-12-31 16:51:52 -0500 | [diff] [blame] | 739 | config BUILD_OUTPUT_UF2 |
| 740 | bool "Build a binary in UF2 format" |
| 741 | depends on BUILD_OUTPUT_BIN |
| 742 | help |
| 743 | Build a UF2 binary zephyr/zephyr.uf2 in the build directory. |
| 744 | The name of this file can be customized with CONFIG_KERNEL_BIN_NAME. |
| 745 | |
| 746 | if BUILD_OUTPUT_UF2 |
| 747 | |
| 748 | config BUILD_OUTPUT_UF2_FAMILY_ID |
Pete Johanson | ff01a00 | 2021-02-16 09:35:11 -0500 | [diff] [blame] | 749 | string "UF2 device family ID" |
Marek Matej | 6b57b3b | 2023-07-20 18:24:09 +0200 | [diff] [blame] | 750 | default "0x1c5f21b0" if SOC_SERIES_ESP32 |
Xudong Zheng | 8db9869 | 2022-03-22 12:15:50 -0400 | [diff] [blame] | 751 | default "0x621e937a" if SOC_NRF52833_QIAA |
Pete Johanson | ff01a00 | 2021-02-16 09:35:11 -0500 | [diff] [blame] | 752 | default "0xada52840" if SOC_NRF52840_QIAA |
Torsten Rasmussen | 8dc3f85 | 2022-09-14 22:23:15 +0200 | [diff] [blame] | 753 | default "0x4fb2d5bd" if SOC_SERIES_IMXRT10XX || SOC_SERIES_IMXRT11XX |
Pete Johanson | ff01a00 | 2021-02-16 09:35:11 -0500 | [diff] [blame] | 754 | default "0x2abc77ec" if SOC_SERIES_LPC55XXX |
Yonatan Schachter | efa170f | 2022-02-01 23:05:04 +0200 | [diff] [blame] | 755 | default "0xe48bff56" if SOC_SERIES_RP2XXX |
Pete Johanson | ff01a00 | 2021-02-16 09:35:11 -0500 | [diff] [blame] | 756 | default "0x68ed2b88" if SOC_SERIES_SAMD21 |
| 757 | default "0x55114460" if SOC_SERIES_SAMD51 |
| 758 | default "0x647824b6" if SOC_SERIES_STM32F0X |
| 759 | default "0x5d1a0a2e" if SOC_SERIES_STM32F2X |
| 760 | default "0x6b846188" if SOC_SERIES_STM32F3X |
| 761 | default "0x53b80f00" if SOC_SERIES_STM32F7X |
| 762 | default "0x300f5633" if SOC_SERIES_STM32G0X |
| 763 | default "0x4c71240a" if SOC_SERIES_STM32G4X |
| 764 | default "0x6db66082" if SOC_SERIES_STM32H7X |
| 765 | default "0x202e3a91" if SOC_SERIES_STM32L0X |
| 766 | default "0x1e1f432d" if SOC_SERIES_STM32L1X |
| 767 | default "0x00ff6919" if SOC_SERIES_STM32L4X |
| 768 | default "0x04240bdf" if SOC_SERIES_STM32L5X |
| 769 | default "0x70d16653" if SOC_SERIES_STM32WBX |
| 770 | default "0x5ee21072" if SOC_STM32F103XE |
Guillaume Gautier | 3d42322 | 2022-12-21 14:44:45 +0100 | [diff] [blame] | 771 | default "0x57755a57" if SOC_SERIES_STM32F4X && (!SOC_STM32F407XE) && (!SOC_STM32F407XG) |
Pete Johanson | ff01a00 | 2021-02-16 09:35:11 -0500 | [diff] [blame] | 772 | default "0x6d0922fa" if SOC_STM32F407XE |
| 773 | default "0x8fb060fe" if SOC_STM32F407XG |
Pete Johanson | 310a464 | 2020-12-31 16:51:52 -0500 | [diff] [blame] | 774 | help |
| 775 | UF2 bootloaders only accept UF2 files with a matching family ID. |
| 776 | This can be either a hex, e.g. 0x68ed2b88, or well-known family |
Pete Johanson | ff01a00 | 2021-02-16 09:35:11 -0500 | [diff] [blame] | 777 | name string. If the SoC in use is known by UF2, the Family ID will |
| 778 | be pre-filled with the known value. |
Pete Johanson | 310a464 | 2020-12-31 16:51:52 -0500 | [diff] [blame] | 779 | |
Peter Johanson | 3f33207 | 2022-01-27 00:45:27 -0500 | [diff] [blame] | 780 | config BUILD_OUTPUT_UF2_USE_FLASH_BASE |
| 781 | bool |
| 782 | default n |
| 783 | |
| 784 | config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET |
| 785 | bool |
| 786 | default n |
| 787 | |
Pete Johanson | 310a464 | 2020-12-31 16:51:52 -0500 | [diff] [blame] | 788 | endif # BUILD_OUTPUT_UF2 |
| 789 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 790 | config BUILD_OUTPUT_STRIPPED |
| 791 | bool "Build a stripped binary" |
| 792 | help |
Martí Bolívar | f39fdc4 | 2020-08-06 14:57:17 -0700 | [diff] [blame] | 793 | Build a stripped binary zephyr/zephyr.strip in the build directory. |
| 794 | The name of this file can be customized with CONFIG_KERNEL_BIN_NAME. |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 795 | |
Noah Pendleton | 265da0d | 2024-05-08 06:21:52 -0400 | [diff] [blame] | 796 | config BUILD_OUTPUT_COMPRESS_DEBUG_SECTIONS |
| 797 | bool "Compress debug sections in the ELF file" |
| 798 | help |
| 799 | Compress debug sections in the ELF file to reduce the file size. |
| 800 | |
Torsten Rasmussen | d51a67b | 2022-01-12 14:21:07 +0100 | [diff] [blame] | 801 | config BUILD_OUTPUT_ADJUST_LMA |
| 802 | string |
| 803 | help |
| 804 | This will adjust the LMA address in the final ELF and hex files with |
| 805 | the value provided. |
| 806 | This will not affect the internal address symbols inside the image but |
| 807 | can be useful when adjusting the LMA address for flash tools or multi |
| 808 | stage loaders where a pre-loader may copy image to a second location |
| 809 | before booting a second core. |
| 810 | The value will be evaluated as a math expression, this means that |
| 811 | following are valid expression |
| 812 | - 1024 |
| 813 | - 0x1000 |
| 814 | - -0x1000 |
| 815 | - 0x20000000 - 0x10000000 |
| 816 | Note: negative numbers are valid. |
| 817 | To adjust according to a chosen flash partition one can specify a |
| 818 | default as: |
| 819 | DT_CHOSEN_IMAGE_<name> := <name>,<name>-partition |
| 820 | DT_CHOSEN_Z_FLASH := zephyr,flash |
| 821 | config BUILD_OUTPUT_ADJUST_LMA |
| 822 | default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_IMAGE_M4))-\ |
| 823 | $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))" |
| 824 | |
Grzegorz Swiderski | f2dc4a0 | 2024-01-24 09:41:20 +0100 | [diff] [blame] | 825 | config BUILD_OUTPUT_ADJUST_LMA_SECTIONS |
| 826 | def_string "*" |
| 827 | depends on BUILD_OUTPUT_ADJUST_LMA!="" |
| 828 | help |
| 829 | This determines the output sections to which the above LMA adjustment |
| 830 | will be applied. |
| 831 | The value can be the name of a section in the final ELF, like "text". |
| 832 | It can also be a pattern with wildcards, such as "*bss", which could |
| 833 | match more than one section name. Multiple such patterns can be given |
| 834 | as a ";"-separated list. It's possible to supply a 'negative' pattern |
| 835 | starting with "!", to exclude sections matched by a preceding pattern. |
| 836 | |
| 837 | By default, all sections will have their LMA adjusted. The following |
| 838 | example excludes one section produced by the code relocation feature: |
| 839 | config BUILD_OUTPUT_ADJUST_LMA_SECTIONS |
| 840 | default "*;!.extflash_text_reloc" |
| 841 | |
Torsten Rasmussen | c8ddc34 | 2022-01-10 11:02:26 +0100 | [diff] [blame] | 842 | config BUILD_OUTPUT_INFO_HEADER |
| 843 | bool "Create a image information header" |
| 844 | help |
| 845 | Create an image information header which will contain image |
| 846 | information from the Zephyr binary. |
| 847 | Example of information contained in the header file: |
| 848 | - Number of segments in the image |
| 849 | - LMA address of each segment |
| 850 | - VMA address of each segment |
| 851 | - Size of each segment |
| 852 | |
Daniel DeGrasse | d8bdddd | 2023-07-28 19:47:45 +0000 | [diff] [blame] | 853 | config BUILD_ALIGN_LMA |
| 854 | bool "Align LMA in output image" |
| 855 | default y if BUILD_OUTPUT_ADJUST_LMA!="" |
| 856 | help |
| 857 | Ensure that the LMA for each section in the output image respects |
| 858 | the alignment requirements of that section. This is required for |
| 859 | some tooling, such as objcopy, to be able to adjust the LMA of the |
| 860 | ELF file. |
| 861 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 862 | config APPLICATION_DEFINED_SYSCALL |
| 863 | bool "Scan application folder for any syscall definition" |
| 864 | help |
| 865 | Scan additional folders inside application source folder |
| 866 | for application defined syscalls. |
| 867 | |
Sebastian Bøe | d3a8fd4 | 2019-10-17 14:25:34 +0200 | [diff] [blame] | 868 | config MAKEFILE_EXPORTS |
| 869 | bool "Generate build metadata files named Makefile.exports" |
| 870 | help |
| 871 | Generates a file with build information that can be read by |
| 872 | third party Makefile-based build systems. |
| 873 | |
Torsten Rasmussen | fffaf05 | 2021-10-12 23:08:36 +0200 | [diff] [blame] | 874 | config BUILD_OUTPUT_META |
| 875 | bool "Create a build meta file" |
| 876 | help |
| 877 | Create a build meta file in the build directory containing lists of: |
| 878 | - Zephyr: path and revision (if git repo) |
| 879 | - Zephyr modules: name, path, and revision (if git repo) |
Torsten Rasmussen | 64ec6ee | 2021-11-04 14:28:21 +0100 | [diff] [blame] | 880 | - West: |
| 881 | - manifest: path and revision |
| 882 | - projects: path and revision |
| 883 | - Workspace: |
| 884 | - dirty: one or more repositories are marked dirty |
| 885 | - extra: extra Zephyr modules are manually included in the build |
| 886 | - off: the SHA of one or more west projects are not what the manifest |
| 887 | defined when `west update` was run the last time (`manifest-rev`). |
| 888 | The off state is only present if a west workspace is found. |
Torsten Rasmussen | fffaf05 | 2021-10-12 23:08:36 +0200 | [diff] [blame] | 889 | File extension is .meta |
| 890 | |
Torsten Rasmussen | 1a51993 | 2021-11-04 18:35:50 +0100 | [diff] [blame] | 891 | config BUILD_OUTPUT_META_STATE_PROPAGATE |
| 892 | bool "Propagate module and project state" |
| 893 | depends on BUILD_OUTPUT_META |
| 894 | help |
| 895 | Propagate to state of each module to the Zephyr revision field. |
| 896 | If west is used the state of each west project is also propagated to |
| 897 | the Zephyr revision field. |
| 898 | West manifest repo revision field will also |
| 899 | be marked with the same state as the Zephyr revision. |
| 900 | The final revision will become: <SHA>-<state1>-<state2>-<state3>... |
| 901 | If no states are appended to the SHA it means the build is of a clean |
| 902 | tree. |
| 903 | - dirty: one or more repositories are marked dirty |
| 904 | - extra: extra Zephyr modules are manually included in the build |
| 905 | - off: the SHA of one or more west projects are not what the manifest |
| 906 | defined when `west update` was run the last time (`manifest-rev`). |
| 907 | The off state is only present if a west workspace is found. |
| 908 | |
Martin Jäger | a0ffaa7 | 2023-03-29 16:06:30 +0200 | [diff] [blame] | 909 | config BUILD_OUTPUT_STRIP_PATHS |
| 910 | bool "Strip absolute paths from binaries" |
| 911 | default y |
| 912 | help |
| 913 | If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the |
| 914 | __FILE__ macro used in __ASSERT*, in the |
| 915 | .noinit."/home/joe/zephyr/fu/bar.c" section names and in any |
| 916 | application code. |
| 917 | This saves some memory, stops leaking user locations in binaries, makes |
| 918 | failure logs more deterministic and most importantly makes builds more |
| 919 | deterministic. |
| 920 | Debuggers usually have a path mapping feature to ensure the files are |
| 921 | still found. |
| 922 | |
Fabio Baltieri | 2264c14 | 2023-03-09 17:29:54 +0000 | [diff] [blame] | 923 | config CHECK_INIT_PRIORITIES |
| 924 | bool "Build time initialization priorities check" |
Fabio Baltieri | 058f256 | 2023-03-10 17:26:35 +0000 | [diff] [blame] | 925 | default y |
Alberto Escolar Piedras | 9bb708e | 2023-11-23 15:27:09 +0100 | [diff] [blame] | 926 | # If we are building a native_simulator target, we can only check the init priorities |
| 927 | # if we are building the final output but we are not assembling several images together |
| 928 | depends on !(NATIVE_LIBRARY && (!BUILD_OUTPUT_EXE || NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS != "")) |
Fabio Baltieri | 4a556a9 | 2023-09-18 11:35:35 +0000 | [diff] [blame] | 929 | depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "armclang" |
Fabio Baltieri | 2264c14 | 2023-03-09 17:29:54 +0000 | [diff] [blame] | 930 | help |
| 931 | Check the build for initialization priority issues by comparing the |
| 932 | initialization priority in the build with the device dependency |
| 933 | derived from the devicetree definition. |
| 934 | |
| 935 | Fails the build on priority errors (dependent devices, inverted |
Fabio Baltieri | 2a70c31 | 2023-10-27 09:27:48 +0000 | [diff] [blame] | 936 | priority). |
Fabio Baltieri | 2264c14 | 2023-03-09 17:29:54 +0000 | [diff] [blame] | 937 | |
Daniel Leung | 80e7820 | 2023-05-25 11:41:48 -0700 | [diff] [blame] | 938 | config EMIT_ALL_SYSCALLS |
| 939 | bool "Emit all possible syscalls in the tree" |
| 940 | help |
| 941 | This tells the build system to emit all possible syscalls found |
| 942 | in the tree, instead of only those syscalls associated with enabled |
| 943 | drivers and subsystems. |
| 944 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 945 | endmenu |
Torsten Rasmussen | 1c91129 | 2021-03-22 14:29:38 +0100 | [diff] [blame] | 946 | |
Torsten Rasmussen | 6066ab4 | 2022-07-15 12:05:04 +0200 | [diff] [blame] | 947 | config DEPRECATED |
| 948 | bool |
| 949 | help |
| 950 | Symbol that must be selected by a feature or module if it is |
| 951 | considered to be deprecated. |
Alberto Escolar Piedras | 50145bb | 2024-08-13 10:30:22 +0200 | [diff] [blame] | 952 | When adding this to an option, remember to follow the instructions in |
| 953 | https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html#deprecated |
Torsten Rasmussen | 6066ab4 | 2022-07-15 12:05:04 +0200 | [diff] [blame] | 954 | |
| 955 | config WARN_DEPRECATED |
| 956 | bool |
| 957 | default y |
| 958 | prompt "Warn on deprecated usage" |
| 959 | help |
| 960 | Print a warning when the Kconfig tree is parsed if any deprecated |
| 961 | features are enabled. |
| 962 | |
Torsten Rasmussen | 1c91129 | 2021-03-22 14:29:38 +0100 | [diff] [blame] | 963 | config EXPERIMENTAL |
| 964 | bool |
| 965 | help |
| 966 | Symbol that must be selected by a feature if it is considered to be |
| 967 | at an experimental implementation stage. |
| 968 | |
| 969 | config WARN_EXPERIMENTAL |
| 970 | bool |
| 971 | prompt "Warn on experimental usage" |
| 972 | help |
| 973 | Print a warning when the Kconfig tree is parsed if any experimental |
| 974 | features are enabled. |
| 975 | |
Carles Cufi | d800ccc | 2022-08-22 18:38:16 +0200 | [diff] [blame] | 976 | config TAINT |
| 977 | bool |
| 978 | help |
| 979 | Symbol that must be selected by a feature or module if the Zephyr |
| 980 | build is considered tainted. |
| 981 | |
Nicolas Pitre | 0a386db | 2022-06-20 13:18:14 -0400 | [diff] [blame] | 982 | config ENFORCE_ZEPHYR_STDINT |
| 983 | bool |
| 984 | prompt "Enforce Zephyr convention for stdint" |
| 985 | depends on !ARCH_POSIX |
| 986 | default y |
| 987 | help |
| 988 | This enforces the Zephyr stdint convention where int32_t = int, |
| 989 | int64_t = long long, and intptr_t = long so that short string |
| 990 | format length modifiers can be used universally across ILP32 |
| 991 | and LP64 architectures. Sometimes this is not possible e.g. when |
| 992 | linking against a binary-only C++ library whose type mangling |
| 993 | is incompatible with the Zephyr convention, or if the build |
| 994 | environment doesn't allow such enforcement, in which case this |
| 995 | should be turned off with the caveat that argument type validation |
| 996 | on Zephyr code will be skipped. |
| 997 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 998 | endmenu |
| 999 | |
| 1000 | |
| 1001 | menu "Boot Options" |
| 1002 | |
| 1003 | config IS_BOOTLOADER |
| 1004 | bool "Act as a bootloader" |
| 1005 | depends on XIP |
| 1006 | depends on ARM |
| 1007 | help |
| 1008 | This option indicates that Zephyr will act as a bootloader to execute |
| 1009 | a separate Zephyr image payload. |
| 1010 | |
| 1011 | config BOOTLOADER_SRAM_SIZE |
Jamie McCrae | d548a7f | 2023-11-14 07:50:48 +0000 | [diff] [blame] | 1012 | int "SRAM reserved for bootloader [DEPRECATED]" |
Kevin Townsend | f68cee9 | 2023-07-14 00:47:55 +0200 | [diff] [blame] | 1013 | default 0 |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 1014 | depends on !XIP || IS_BOOTLOADER |
Rajavardhan Gundi | e584b05 | 2018-12-14 16:55:43 +0530 | [diff] [blame] | 1015 | depends on ARM || XTENSA |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 1016 | help |
| 1017 | This option specifies the amount of SRAM (measure in kB) reserved for |
| 1018 | a bootloader image, when either: |
| 1019 | - the Zephyr image itself is to act as the bootloader, or |
| 1020 | - Zephyr is a !XIP image, which implicitly assumes existence of a |
| 1021 | bootloader that loads the Zephyr !XIP image onto SRAM. |
| 1022 | |
Jamie McCrae | d548a7f | 2023-11-14 07:50:48 +0000 | [diff] [blame] | 1023 | This option is deprecated, users should transition to using DTS to set this, if needed. |
| 1024 | To be removed after Zephyr 3.7 release. |
| 1025 | |
| 1026 | config BOOTLOADER_SRAM_SIZE_DEPRECATED |
| 1027 | bool |
| 1028 | default y |
| 1029 | select DEPRECATED |
| 1030 | depends on BOOTLOADER_SRAM_SIZE != 0 |
| 1031 | depends on !XIP || IS_BOOTLOADER |
| 1032 | depends on ARM || XTENSA |
| 1033 | help |
| 1034 | Non-prompt symbol to indicate that the deprecated BOOTLOADER_SRAM_SIZE Kconfig has a |
| 1035 | non-0 value. Please transition to using devicetree. |
| 1036 | |
Michael Hope | 8c1f186 | 2020-06-13 21:32:11 +0200 | [diff] [blame] | 1037 | config BOOTLOADER_BOSSA |
| 1038 | bool "BOSSA bootloader support" |
| 1039 | select USE_DT_CODE_PARTITION |
Michael Hope | 8c1f186 | 2020-06-13 21:32:11 +0200 | [diff] [blame] | 1040 | |
| 1041 | help |
| 1042 | Signifies that the target uses a BOSSA compatible bootloader. If CDC |
| 1043 | ACM USB support is also enabled then the board will reboot into the |
| 1044 | bootloader automatically when bossac is run. |
| 1045 | |
| 1046 | config BOOTLOADER_BOSSA_DEVICE_NAME |
| 1047 | string "BOSSA CDC ACM device name" |
| 1048 | depends on BOOTLOADER_BOSSA && CDC_ACM_DTE_RATE_CALLBACK_SUPPORT |
| 1049 | default "CDC_ACM_0" |
| 1050 | help |
| 1051 | Sets the CDC ACM port to watch for reboot commands. |
| 1052 | |
| 1053 | choice |
| 1054 | prompt "BOSSA bootloader variant" |
| 1055 | depends on BOOTLOADER_BOSSA |
| 1056 | |
Gerson Fernando Budke | f3a7f04 | 2021-05-06 21:20:11 -0300 | [diff] [blame] | 1057 | config BOOTLOADER_BOSSA_LEGACY |
| 1058 | bool "Legacy" |
| 1059 | help |
| 1060 | Select the Legacy variant of the BOSSA bootloader. This is defined |
| 1061 | for compatibility mode only. The recommendation is use newer |
| 1062 | versions like Arduino or Adafruit UF2. |
| 1063 | |
Michael Hope | 8c1f186 | 2020-06-13 21:32:11 +0200 | [diff] [blame] | 1064 | config BOOTLOADER_BOSSA_ARDUINO |
| 1065 | bool "Arduino" |
| 1066 | help |
| 1067 | Select the Arduino variant of the BOSSA bootloader. Uses 0x07738135 |
| 1068 | as the magic value to enter the bootloader. |
| 1069 | |
| 1070 | config BOOTLOADER_BOSSA_ADAFRUIT_UF2 |
| 1071 | bool "Adafruit UF2" |
| 1072 | help |
| 1073 | Select the Adafruit UF2 variant of the BOSSA bootloader. Uses |
| 1074 | 0xf01669ef as the magic value to enter the bootloader. |
| 1075 | |
| 1076 | endchoice |
| 1077 | |
Anas Nashif | 86ad37a | 2018-11-02 07:12:07 -0400 | [diff] [blame] | 1078 | endmenu |
Yong Cong Sin | bbe5e1e | 2024-01-24 17:35:04 +0800 | [diff] [blame] | 1079 | |
| 1080 | menu "Compatibility" |
| 1081 | |
| 1082 | config LEGACY_GENERATED_INCLUDE_PATH |
| 1083 | bool "Legacy include path for generated headers" |
| 1084 | default y |
| 1085 | help |
| 1086 | Allow applications and libraries to use the Zephyr legacy include |
| 1087 | path for the generated headers which does not use the `zephyr/` prefix. |
| 1088 | |
| 1089 | From now on, i.e., the preferred way to include the `version.h` header is to |
| 1090 | use <zephyr/version.h>, this Kconfig is currently enabled by default so that |
| 1091 | user applications won't immediately fail to compile. |
| 1092 | |
| 1093 | This Kconfig will be deprecated and eventually removed in the future releases. |
| 1094 | |
| 1095 | endmenu |