blob: eb4399c297f4e94cf1ec334df7bbb82f93bc1d42 [file] [log] [blame]
Ulf Magnussonbd6e0442019-11-01 13:45:29 +01001# General configuration options
Anas Nashif7d4163d2015-08-22 14:43:07 -04002
Anas Nashif7d4163d2015-08-22 14:43:07 -04003# Copyright (c) 2014-2015 Wind River Systems, Inc.
Daniel Leung8df10d42016-03-25 14:30:50 -07004# Copyright (c) 2016 Intel Corporation
Dominik Ermel865f8012023-05-11 11:47:21 +00005# Copyright (c) 2023 Nordic Semiconductor ASA
David B. Kinderac74d8b2017-01-18 17:01:01 -08006# SPDX-License-Identifier: Apache-2.0
Sebastian Bøe4b61bd12018-01-09 14:12:07 +01007
Torsten Rasmussen49389b52023-03-23 11:02:49 +01008osource "${APPLICATION_SOURCE_DIR}/VERSION"
Anas Nashif658f6bc2019-05-28 14:22:51 -04009
Ulf Magnussone63b6522020-01-26 23:47:41 +010010# Include Kconfig.defconfig files first so that they can override defaults and
11# other symbol/choice properties by adding extra symbol/choice definitions.
12# After merging all definitions for a symbol/choice, Kconfig picks the first
13# property (e.g. the first default) with a satisfied condition.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020014#
Ulf Magnussone63b6522020-01-26 23:47:41 +010015# Shield defaults should have precedence over board defaults, which should have
16# precedence over SoC defaults, so include them in that order.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020017#
Ulf Magnussone63b6522020-01-26 23:47:41 +010018# $ARCH and $BOARD_DIR will be glob patterns when building documentation.
Torsten Rasmussen6be1b2a2021-06-02 08:47:21 +020019# This loads custom shields defconfigs (from BOARD_ROOT)
20osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig"
21# This loads Zephyr base shield defconfigs
22source "boards/shields/*/Kconfig.defconfig"
23
Torsten Rasmussen8dc3f852022-09-14 22:23:15 +020024osource "$(BOARD_DIR)/Kconfig.defconfig"
Torsten Rasmussen6be1b2a2021-06-02 08:47:21 +020025
Torsten Rasmussen8dc3f852022-09-14 22:23:15 +020026# This loads Zephyr specific SoC root defconfigs
27source "$(KCONFIG_BINARY_DIR)/soc/Kconfig.defconfig"
28
Torsten Rasmussen36bb00d2021-08-15 23:14:21 +020029# This loads the toolchain defconfigs
30osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig.defconfig"
Krzysztof Chruscinski2735a3a2022-09-06 12:50:10 +020031# This loads the testsuite defconfig
32source "subsys/testsuite/Kconfig.defconfig"
Ulf Magnussonec3eff52018-07-30 10:57:47 +020033
Kumar Gala52a3ec92022-08-12 10:00:38 -050034# This should be early since the autogen Kconfig.dts symbols may get
35# used by modules
36source "dts/Kconfig"
37
Ioannis Glaropoulosc5203852020-12-07 18:42:52 +010038menu "Modules"
39
Ioannis Glaropoulosc5203852020-12-07 18:42:52 +010040source "modules/Kconfig"
41
42endmenu
43
Anas Nashifabcf2ad2018-09-04 08:32:07 -050044source "boards/Kconfig"
Torsten Rasmussen5f7cc8d2020-07-06 12:53:39 +020045source "soc/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040046source "arch/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040047source "kernel/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040048source "drivers/Kconfig"
Anas Nashif0b2c44a2016-05-14 23:10:51 -040049source "lib/Kconfig"
Ramesh Thomase354ad22016-10-29 04:10:36 -070050source "subsys/Kconfig"
Kumar Gala7584a122016-05-24 14:23:26 -050051
Kumar Gala2630fba2020-01-24 09:39:40 -060052osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig"
Anas Nashif8017c592019-05-23 17:19:41 -040053
Anas Nashif86ad37a2018-11-02 07:12:07 -040054menu "Build and Link Features"
55
56menu "Linker Options"
57
Erwan Gouriou16d9d4d2023-03-22 15:09:48 +010058choice LINKER_ORPHAN_CONFIGURATION
Daniel Leung6600c642018-10-19 10:15:19 -070059 prompt "Linker Orphan Section Handling"
60 default LINKER_ORPHAN_SECTION_WARN
61
62config LINKER_ORPHAN_SECTION_PLACE
63 bool "Place"
64 help
65 Linker puts orphan sections in place without warnings
66 or errors.
67
68config LINKER_ORPHAN_SECTION_WARN
69 bool "Warn"
70 help
Anas Nashiff2cb20c2019-06-18 14:45:40 -040071 Linker places the orphan sections in output and issues
Daniel Leung6600c642018-10-19 10:15:19 -070072 warning about those sections.
73
74config LINKER_ORPHAN_SECTION_ERROR
75 bool "Error"
76 help
77 Linker exits with error when an orphan section is found.
78
79endchoice
Anas Nashif86ad37a2018-11-02 07:12:07 -040080
81config HAS_FLASH_LOAD_OFFSET
82 bool
83 help
84 This option is selected by targets having a FLASH_LOAD_OFFSET
85 and FLASH_LOAD_SIZE.
86
Ulf Magnussonfd9981a2019-11-16 01:33:09 +010087if HAS_FLASH_LOAD_OFFSET
88
Ulf Magnusson90b9eb32019-11-16 01:22:16 +010089config USE_DT_CODE_PARTITION
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010090 bool "Link application into /chosen/zephyr,code-partition from devicetree"
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010091 help
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010092 When enabled, the application will be linked into the flash partition
93 selected by the zephyr,code-partition property in /chosen in devicetree.
94 When this is disabled, the flash load offset and size can be set manually
95 below.
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010096
Kumar Gala8ce0cf02019-08-28 09:29:26 -050097# Workaround for not being able to have commas in macro arguments
98DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
99
Anas Nashif86ad37a2018-11-02 07:12:07 -0400100config FLASH_LOAD_OFFSET
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100101 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
102 hex "Kernel load offset" if !USE_DT_CODE_PARTITION
103 default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400104 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400105 help
106 This option specifies the byte offset from the beginning of flash that
107 the kernel should be loaded into. Changing this value from zero will
108 affect the Zephyr image's link, and will decrease the total amount of
109 flash available for use by application code.
110
111 If unsure, leave at the default value 0.
112
113config FLASH_LOAD_SIZE
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100114 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
115 hex "Kernel load size" if !USE_DT_CODE_PARTITION
116 default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400117 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400118 help
119 If non-zero, this option specifies the size, in bytes, of the flash
120 area that the Zephyr image will be allowed to occupy. If zero, the
121 image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
122 the device.
123
124 If unsure, leave at the default value 0.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400125
Ulf Magnussonfd9981a2019-11-16 01:33:09 +0100126endif # HAS_FLASH_LOAD_OFFSET
127
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900128config ROM_START_OFFSET
Ole Sæther985446a2019-01-23 14:13:03 +0100129 hex
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900130 prompt "ROM start offset" if !BOOTLOADER_MCUBOOT
Anas Nashif86ad37a2018-11-02 07:12:07 -0400131 default 0x200 if BOOTLOADER_MCUBOOT
132 default 0
133 help
134 If the application is built for chain-loading by a bootloader this
135 variable is required to be set to value that leaves sufficient
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900136 space between the beginning of the image and the start of the first
Anas Nashif86ad37a2018-11-02 07:12:07 -0400137 section to store an image header or any other metadata.
138 In the particular case of the MCUboot bootloader this reserves enough
139 space to store the image header, which should also meet vector table
140 alignment requirements on most ARM targets, although some targets
141 may require smaller or larger values.
142
Jamie McCrae7c631f02023-10-30 17:16:31 +0000143config ROM_END_OFFSET
144 hex "ROM end offset"
145 default 0
146 help
147 If non-zero, this option reduces the maximum size that the Zephyr image is allowed to
148 occupy, this is to allow for additional image storage which can be created and used by
149 other systems such as bootloaders (for MCUboot, this would include the image swap
150 fields and TLV storage at the end of the image).
151
152 If unsure, leave at the default value 0.
153
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200154config LD_LINKER_SCRIPT_SUPPORTED
155 bool
156 default y
157
158choice LINKER_SCRIPT
159 prompt "Linker script"
160 default LD_LINKER_TEMPLATE if LD_LINKER_SCRIPT_SUPPORTED
161
162config LD_LINKER_TEMPLATE
163 bool "LD template"
164 depends on LD_LINKER_SCRIPT_SUPPORTED
165 help
166 Select this option to use the LD linker script templates.
167 The templates are pre-processed by the C pre-processor to create the
168 final LD linker script.
169
170config CMAKE_LINKER_GENERATOR
171 bool "CMake generator"
172 depends on ARM
173 help
174 Select this option to use the Zephyr CMake linker script generator.
175 The linker configuration is written in CMake and the final linker
176 script will be generated by the toolchain specific linker generator.
177 For LD based linkers, this will be the ld generator, for ARMClang /
178 armlink based linkers it will be the scatter generator.
179
180endchoice
181
Anas Nashif86ad37a2018-11-02 07:12:07 -0400182config HAVE_CUSTOM_LINKER_SCRIPT
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200183 bool "Custom linker script provided"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400184 help
185 Set this option if you have a custom linker script which needed to
186 be define in CUSTOM_LINKER_SCRIPT.
187
188config CUSTOM_LINKER_SCRIPT
189 string "Path to custom linker script"
190 depends on HAVE_CUSTOM_LINKER_SCRIPT
191 help
192 Path to the linker script to be used instead of the one define by the
193 board.
194
195 The linker script must be based on a version provided by Zephyr since
196 the kernel can expect a certain layout/certain regions.
197
198 This is useful when an application needs to add sections into the
199 linker script and avoid having to change the script provided by
200 Zephyr.
201
Anas Nashif86ad37a2018-11-02 07:12:07 -0400202config KERNEL_ENTRY
203 string "Kernel entry symbol"
204 default "__start"
205 help
206 Code entry symbol, to be set at linking phase.
207
Sebastian Bøe3a0597f2019-03-15 14:05:09 +0100208config LINKER_SORT_BY_ALIGNMENT
209 bool "Sort input sections by alignment"
210 default y
211 help
212 This turns on the linker flag to sort sections by alignment
213 in decreasing size of symbols. This helps to minimize
214 padding between symbols.
215
Jordan Yates318ee972021-04-17 20:04:33 +1000216config SRAM_VECTOR_TABLE
217 bool "Place the vector table in SRAM instead of flash"
218 help
219 The option specifies that the vector table should be placed at the
220 start of SRAM instead of the start of flash.
221
Daniel Leungece9cad2021-02-20 11:02:17 -0800222config HAS_SRAM_OFFSET
223 bool
224 help
225 This option is selected by targets that require SRAM_OFFSET.
226
227config SRAM_OFFSET
228 hex "Kernel SRAM offset" if HAS_SRAM_OFFSET
229 default 0
230 help
231 This option specifies the byte offset from the beginning of SRAM
232 where the kernel begins. Changing this value from zero will affect
233 the Zephyr image's link, and will decrease the total amount of
234 SRAM available for use by application code.
235
236 If unsure, leave at the default value 0.
237
Daniel Leungd8127282021-02-24 10:18:34 -0800238menu "Linker Sections"
239
240config LINKER_USE_BOOT_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100241 bool "Use Boot Linker Section"
Daniel Leungd8127282021-02-24 10:18:34 -0800242 help
243 If enabled, the symbols which are needed for the boot process
244 will be put into another linker section reserved for these
245 symbols.
246
247 Requires that boot sections exist in the architecture, SoC,
248 board or custom linker script.
249
Daniel Leung1310ad62021-02-23 13:33:38 -0800250config LINKER_USE_PINNED_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100251 bool "Use Pinned Linker Section"
Daniel Leung1310ad62021-02-23 13:33:38 -0800252 help
253 If enabled, the symbols which need to be pinned in memory
254 will be put into another linker section reserved for pinned
255 symbols. During boot, the corresponding memory will be marked
256 as pinned.
257
258 Requires that pinned sections exist in the architecture, SoC,
259 board or custom linker script.
260
Daniel Leung6a006d72021-07-12 10:58:45 -0700261config LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT
262 bool "Generic sections are present at boot" if DEMAND_PAGING && LINKER_USE_PINNED_SECTION
263 default y
264 help
265 When disabled, the linker sections other than the boot and
266 pinned sections will be marked as not present in the page
267 tables. This allows kernel to pull in data pages on demand
268 as required by current execution context when demand paging
269 is enabled. There is no need to load all code and data into
270 memory at once.
271
272 If unsure, say Y.
273
Torsten Rasmussenc1078272022-09-27 12:34:36 +0200274config LINKER_LAST_SECTION_ID
275 bool "Last section identifier"
276 default y
277 depends on ARM || ARM64 || RISCV
278 help
279 If enabled, the last section will contain an identifier.
280 This ensures that the '_flash_used' linker symbol will always be
281 correctly calculated, even in cases where the location counter may
282 have been incremented for alignment purposes but no data is placed
283 after alignment.
284
285 Note: in cases where the flash is fully used, for example application
286 specific data is written at the end of the flash area, then writing a
287 last section identifier may cause rom region overflow.
288 In such cases this setting should be disabled.
289
290config LINKER_LAST_SECTION_ID_PATTERN
291 hex "Last section identifier pattern"
292 default "0xE015E015"
293 depends on LINKER_LAST_SECTION_ID
294 help
295 Pattern to fill into last section as identifier.
296 Default pattern is 0xE015 (end of last section), but any pattern can
297 be used.
298 The size of the pattern must not exceed 4 bytes.
299
Flavio Ceolin56ec06f2022-12-20 10:36:34 -0800300config LINKER_USE_NO_RELAX
301 bool
302 help
303 Hidden symbol to allow features to force the use of no relax.
304
305config LINKER_USE_RELAX
306 bool "Linker optimization of call addressing"
307 depends on !LINKER_USE_NO_RELAX
308 default y
309 help
310 This option performs global optimizations that become possible when the linker resolves
311 addressing in the program, such as relaxing address modes and synthesizing new
312 instructions in the output object file. For ld and lld, this enables `--relax`.
313 On platforms where this is not supported, `--relax' is accepted, but ignored.
314 Disabling it can reduce performance, as the linker is no longer able to substiture long /
315 in-effective jump calls to shorter / more effective instructions.
316
Daniel Leungd8127282021-02-24 10:18:34 -0800317endmenu # "Linker Sections"
318
Krzysztof Chruscinskidfb36742022-04-22 11:36:05 +0200319config LINKER_DEVNULL_SUPPORT
320 bool
321 default y if CPU_CORTEX_M || (RISCV && !64BIT)
322
323config LINKER_DEVNULL_MEMORY
324 bool "Devnull region"
325 depends on LINKER_DEVNULL_SUPPORT
326 help
327 Devnull region is created. It is stripped from final binary but remains
328 in byproduct elf file.
329
330config LINKER_DEVNULL_MEMORY_SIZE
331 int "Devnull region size"
332 depends on LINKER_DEVNULL_MEMORY
333 default 262144
334 help
335 Size can be adjusted so it fits all data placed in that region.
336
Anas Nashif86ad37a2018-11-02 07:12:07 -0400337endmenu
338
339menu "Compiler Options"
340
Flavio Ceolinb587e8d2020-08-26 09:48:33 -0700341config CODING_GUIDELINE_CHECK
342 bool "Enforce coding guideline rules"
343 help
344 Use available compiler flags to check coding guideline rules during
345 the build.
346
Keith Packardbe4b76f2023-10-12 11:55:04 -0700347config NATIVE_LIBC
Alberto Escolar Piedras2eb14f12023-05-26 13:15:09 +0200348 bool
Keith Packard214a3c52023-02-08 13:44:39 -0800349 select FULL_LIBC_SUPPORTED
Keith Packardbe4b76f2023-10-12 11:55:04 -0700350 help
351 Zephyr will use the host system C library.
352
353config NATIVE_LIBCPP
354 bool
355 select FULL_LIBCPP_SUPPORTED
356 help
357 Zephyr will use the host system C++ library
358
359config NATIVE_BUILD
360 bool
361 select NATIVE_LIBC if EXTERNAL_LIBC
362 select NATIVE_LIBCPP if EXTERNAL_LIBCPP
Anas Nashif86ad37a2018-11-02 07:12:07 -0400363 help
Alberto Escolar Piedras2eb14f12023-05-26 13:15:09 +0200364 Zephyr will be built targeting the host system for debug and
365 development purposes.
366
367config NATIVE_APPLICATION
368 bool
369 default y if ARCH_POSIX
370 depends on !NATIVE_LIBRARY
371 select NATIVE_BUILD
372 help
Anas Nashif86ad37a2018-11-02 07:12:07 -0400373 Build as a native application that can run on the host and using
374 resources and libraries provided by the host.
375
Alberto Escolar Piedras2eb14f12023-05-26 13:15:09 +0200376config NATIVE_LIBRARY
377 bool
378 select NATIVE_BUILD
379 help
380 Build as a prelinked library for the native host target.
381 This library can later be built into an executable for the host.
382
Keith Packard6c5d8062023-02-08 14:56:50 -0800383config COMPILER_FREESTANDING
384 bool "Build in a freestanding compiler mode"
385 help
386 Configure the compiler to operate in freestanding mode according to
387 the C and C++ language specifications. Freestanding mode reduces the
388 requirements of the compiler and language environment, which can
389 negatively impact the ability for the compiler to detect errors and
390 perform optimizations.
391
Emil Lindqvistf7dad072021-09-03 13:52:33 +0200392choice COMPILER_OPTIMIZATIONS
Anas Nashif86ad37a2018-11-02 07:12:07 -0400393 prompt "Optimization level"
394 default NO_OPTIMIZATIONS if COVERAGE
395 default DEBUG_OPTIMIZATIONS if DEBUG
396 default SIZE_OPTIMIZATIONS
397 help
398 Note that these flags shall only control the compiler
399 optimization level, and that no extra debug code shall be
400 conditionally compiled based on them.
401
402config SIZE_OPTIMIZATIONS
403 bool "Optimize for size"
404 help
405 Compiler optimizations will be set to -Os independently of other
406 options.
407
408config SPEED_OPTIMIZATIONS
409 bool "Optimize for speed"
410 help
411 Compiler optimizations will be set to -O2 independently of other
412 options.
413
414config DEBUG_OPTIMIZATIONS
415 bool "Optimize debugging experience"
416 help
417 Compiler optimizations will be set to -Og independently of other
418 options.
419
420config NO_OPTIMIZATIONS
421 bool "Optimize nothing"
422 help
423 Compiler optimizations will be set to -O0 independently of other
424 options.
Henrik Brix Andersen26ebcee2023-03-22 10:19:40 +0100425
426 Selecting this option will likely require manual tuning of the
427 default stack sizes in order to avoid stack overflows.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400428endchoice
429
Radoslaw Koppel26c87762024-01-30 12:32:32 +0100430config LTO
431 bool "Link Time Optimization [EXPERIMENTAL]"
Alberto Escolar Piedras40b53d52024-02-08 11:23:09 +0100432 depends on (!(GEN_ISR_TABLES || GEN_IRQ_VECTOR_TABLE) || ISR_TABLES_LOCAL_DECLARATION) && !NATIVE_LIBRARY
Radoslaw Koppel26c87762024-01-30 12:32:32 +0100433 select EXPERIMENTAL
434 help
435 This option enables Link Time Optimization.
436
Nikolay Agishev0dec4cf2022-12-22 15:46:04 +0400437config COMPILER_WARNINGS_AS_ERRORS
438 bool "Treat warnings as errors"
439 help
440 Turn on "warning as error" toolchain flags
441
Fabio Baltieri3f8f7132023-03-29 10:11:46 +0100442config COMPILER_SAVE_TEMPS
443 bool "Save temporary object files"
444 help
445 Instruct the compiler to save the temporary intermediate files
446 permanently. These can be useful for troubleshooting build issues.
447
Gerard Marull-Paretas99ebe392023-05-05 09:58:12 +0200448config COMPILER_TRACK_MACRO_EXPANSION
449 bool "Track macro expansion"
450 default y
451 help
452 When enabled, locations of tokens across macro expansions will be
453 tracked. Disabling this option may be useful to debug long macro
454 expansion chains.
455
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400456config COMPILER_COLOR_DIAGNOSTICS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100457 bool "Colored diagnostics"
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400458 default y
459 help
460 Compiler diagnostic messages are colorized.
461
Keith Packard62bc9bf2022-04-26 19:24:11 -0700462choice COMPILER_SECURITY_FORTIFY
463 prompt "Detect buffer overflows in libc calls"
Alberto Escolar Piedras56dc20e2023-05-26 13:23:43 +0200464 default FORTIFY_SOURCE_NONE if NO_OPTIMIZATIONS || MINIMAL_LIBC || NATIVE_BUILD
Keith Packard62bc9bf2022-04-26 19:24:11 -0700465 default FORTIFY_SOURCE_COMPILE_TIME
466 help
467 Buffer overflow checking in libc calls. Supported by Clang and
468 GCC when using Picolibc or Newlib. Requires compiler optimization
469 to be enabled.
470
471config FORTIFY_SOURCE_NONE
472 bool "No detection"
473 help
474 Disables both compile-time and run-time checking.
475
476config FORTIFY_SOURCE_COMPILE_TIME
477 bool "Compile-time detection"
478 help
479 Enables only compile-time checking. Compile-time checking
480 doesn't increase executable size or reduce performance, it
481 limits checking to what can be done with information available
482 at compile time.
483
484config FORTIFY_SOURCE_RUN_TIME
485 bool "Compile-time and run-time detection"
486 help
487 Enables both compile-time and run-time checking. Run-time
488 checking increases coverage at the expense of additional code,
489 and means that applications will raise a runtime exception
490 when buffer overflow is detected.
491
492endchoice
493
Anas Nashif86ad37a2018-11-02 07:12:07 -0400494config COMPILER_OPT
495 string "Custom compiler options"
496 help
497 This option is a free-form string that is passed to the compiler
498 when building all parts of a project (i.e. kernel).
499 The compiler options specified by this string supplement the
500 predefined set of compiler supplied by the build system,
501 and can be used to change compiler optimization, warning and error
502 messages, and so on.
503
Martí Bolívare5cc8542021-05-21 10:56:23 -0700504config MISRA_SANE
505 bool "MISRA standards compliance features"
506 help
507 Causes the source code to build in "MISRA" mode, which
508 disallows some otherwise-permitted features of the C
509 standard for safety reasons. Specifically variable length
510 arrays are not permitted (and gcc will enforce this).
511
Anas Nashif86ad37a2018-11-02 07:12:07 -0400512endmenu
513
Anas Nashif22b95a22019-11-24 11:28:38 -0500514choice
515 prompt "Error checking behavior for CHECK macro"
516 default RUNTIME_ERROR_CHECKS
517
518config ASSERT_ON_ERRORS
519 bool "Assert on all errors"
520 help
521 Assert on errors covered with the CHECK macro.
522
523config NO_RUNTIME_CHECKS
524 bool "No runtime error checks"
525 help
526 Do not do any runtime checks or asserts when using the CHECK macro.
527
528config RUNTIME_ERROR_CHECKS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100529 bool "Runtime error checks"
Anas Nashif22b95a22019-11-24 11:28:38 -0500530 help
531 Always perform runtime checks covered with the CHECK macro. This
532 option is the default and the only option used during testing.
533
534endchoice
535
Anas Nashif86ad37a2018-11-02 07:12:07 -0400536menu "Build Options"
537
538config KERNEL_BIN_NAME
539 string "The kernel binary name"
540 default "zephyr"
541 help
542 This option sets the name of the generated kernel binary.
543
544config OUTPUT_STAT
545 bool "Create a statistics file"
546 default y
547 help
548 Create a stat file using readelf -e <elf>
549
Anas Nashif47a673f2022-06-27 10:08:37 -0400550config OUTPUT_SYMBOLS
551 bool "Create a symbol file"
552 help
553 Create a symbol file using nm <elf>
554
Anas Nashif86ad37a2018-11-02 07:12:07 -0400555config OUTPUT_DISASSEMBLY
556 bool "Create a disassembly file"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400557 help
558 Create an .lst file with the assembly listing of the firmware.
559
Rohit Gujarathi35713f22020-05-07 10:08:37 +0530560config OUTPUT_DISASSEMBLE_ALL
561 bool "Disassemble all sections with source. Fill zeros."
562 default n
563 depends on OUTPUT_DISASSEMBLY
564 help
565 The .lst file will contain complete disassembly of the firmware
566 not just those expected to contain instructions including zeros
567
Anas Nashif86ad37a2018-11-02 07:12:07 -0400568config OUTPUT_PRINT_MEMORY_USAGE
569 bool "Print memory usage to stdout"
570 default y
571 help
572 If the toolchain supports it, this option will pass
573 --print-memory-region to the linker when it is doing it's first
574 linker pass. Note that the memory regions are symbolic concepts
575 defined by the linker scripts and do not necessarily map
576 directly to the real physical address space. Take also note that
577 some platforms do two passes of the linker so the results do not
578 match exactly to the final elf file. See also rom_report,
579 ram_report and
580 https://sourceware.org/binutils/docs/ld/MEMORY.html
581
Anas Nashiffdbf2db2020-10-20 14:31:56 -0400582config CLEANUP_INTERMEDIATE_FILES
583 bool "Remove all intermediate files"
584 help
585 Delete intermediate files to save space and cleanup clutter resulting
Filip Kokosinski7388a072023-07-19 15:40:55 +0200586 from the build process. Note this breaks incremental builds, west spdx
587 (Software Bill of Material generation), and maybe others.
Anas Nashiffdbf2db2020-10-20 14:31:56 -0400588
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700589config BUILD_NO_GAP_FILL
590 bool "Don't fill gaps in generated hex/bin/s19 files."
591
Anas Nashif86ad37a2018-11-02 07:12:07 -0400592config BUILD_OUTPUT_HEX
593 bool "Build a binary in HEX format"
594 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700595 Build an Intel HEX binary zephyr/zephyr.hex in the build directory.
596 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400597
598config BUILD_OUTPUT_BIN
599 bool "Build a binary in BIN format"
600 default y
601 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700602 Build a "raw" binary zephyr/zephyr.bin in the build directory.
603 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400604
Anas Nashif51c34bb2021-01-26 06:58:30 -0500605config BUILD_OUTPUT_EFI
606 bool "Build as an EFI application"
607 default n
608 depends on X86_64
609 help
610 Build as an EFI application.
611
612 This works by creating a "zephyr.efi" EFI binary containing a zephyr
613 image extracted from a built zephyr.elf file. EFI applications are
614 relocatable, and cannot be placed at specific locations in memory.
615 Instead, the stub code will copy the embedded zephyr sections to the
616 appropriate locations at startup, clear any zero-filled (BSS, etc...)
617 areas, then jump into the 64 bit entry point.
618
Anas Nashif86ad37a2018-11-02 07:12:07 -0400619config BUILD_OUTPUT_EXE
620 bool "Build a binary in ELF format with .exe extension"
621 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700622 Build an ELF binary that can run in the host system at
623 zephyr/zephyr.exe in the build directory.
624 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400625
626config BUILD_OUTPUT_S19
627 bool "Build a binary in S19 format"
628 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700629 Build an S19 binary zephyr/zephyr.s19 in the build directory.
630 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Håkon Øye Amundsenc086b932018-11-26 09:47:16 +0000631
Pete Johanson310a4642020-12-31 16:51:52 -0500632config BUILD_OUTPUT_UF2
633 bool "Build a binary in UF2 format"
634 depends on BUILD_OUTPUT_BIN
635 help
636 Build a UF2 binary zephyr/zephyr.uf2 in the build directory.
637 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
638
639if BUILD_OUTPUT_UF2
640
641config BUILD_OUTPUT_UF2_FAMILY_ID
Pete Johansonff01a002021-02-16 09:35:11 -0500642 string "UF2 device family ID"
Marek Matej6b57b3b2023-07-20 18:24:09 +0200643 default "0x1c5f21b0" if SOC_SERIES_ESP32
Xudong Zheng8db98692022-03-22 12:15:50 -0400644 default "0x621e937a" if SOC_NRF52833_QIAA
Pete Johansonff01a002021-02-16 09:35:11 -0500645 default "0xada52840" if SOC_NRF52840_QIAA
Torsten Rasmussen8dc3f852022-09-14 22:23:15 +0200646 default "0x4fb2d5bd" if SOC_SERIES_IMXRT10XX || SOC_SERIES_IMXRT11XX
Pete Johansonff01a002021-02-16 09:35:11 -0500647 default "0x2abc77ec" if SOC_SERIES_LPC55XXX
Yonatan Schachterefa170f2022-02-01 23:05:04 +0200648 default "0xe48bff56" if SOC_SERIES_RP2XXX
Pete Johansonff01a002021-02-16 09:35:11 -0500649 default "0x68ed2b88" if SOC_SERIES_SAMD21
650 default "0x55114460" if SOC_SERIES_SAMD51
651 default "0x647824b6" if SOC_SERIES_STM32F0X
652 default "0x5d1a0a2e" if SOC_SERIES_STM32F2X
653 default "0x6b846188" if SOC_SERIES_STM32F3X
654 default "0x53b80f00" if SOC_SERIES_STM32F7X
655 default "0x300f5633" if SOC_SERIES_STM32G0X
656 default "0x4c71240a" if SOC_SERIES_STM32G4X
657 default "0x6db66082" if SOC_SERIES_STM32H7X
658 default "0x202e3a91" if SOC_SERIES_STM32L0X
659 default "0x1e1f432d" if SOC_SERIES_STM32L1X
660 default "0x00ff6919" if SOC_SERIES_STM32L4X
661 default "0x04240bdf" if SOC_SERIES_STM32L5X
662 default "0x70d16653" if SOC_SERIES_STM32WBX
663 default "0x5ee21072" if SOC_STM32F103XE
Guillaume Gautier3d423222022-12-21 14:44:45 +0100664 default "0x57755a57" if SOC_SERIES_STM32F4X && (!SOC_STM32F407XE) && (!SOC_STM32F407XG)
Pete Johansonff01a002021-02-16 09:35:11 -0500665 default "0x6d0922fa" if SOC_STM32F407XE
666 default "0x8fb060fe" if SOC_STM32F407XG
Pete Johanson310a4642020-12-31 16:51:52 -0500667 help
668 UF2 bootloaders only accept UF2 files with a matching family ID.
669 This can be either a hex, e.g. 0x68ed2b88, or well-known family
Pete Johansonff01a002021-02-16 09:35:11 -0500670 name string. If the SoC in use is known by UF2, the Family ID will
671 be pre-filled with the known value.
Pete Johanson310a4642020-12-31 16:51:52 -0500672
Peter Johanson3f332072022-01-27 00:45:27 -0500673config BUILD_OUTPUT_UF2_USE_FLASH_BASE
674 bool
675 default n
676
677config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET
678 bool
679 default n
680
Pete Johanson310a4642020-12-31 16:51:52 -0500681endif # BUILD_OUTPUT_UF2
682
Anas Nashif86ad37a2018-11-02 07:12:07 -0400683config BUILD_OUTPUT_STRIPPED
684 bool "Build a stripped binary"
685 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700686 Build a stripped binary zephyr/zephyr.strip in the build directory.
687 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400688
Torsten Rasmussend51a67b2022-01-12 14:21:07 +0100689config BUILD_OUTPUT_ADJUST_LMA
690 string
691 help
692 This will adjust the LMA address in the final ELF and hex files with
693 the value provided.
694 This will not affect the internal address symbols inside the image but
695 can be useful when adjusting the LMA address for flash tools or multi
696 stage loaders where a pre-loader may copy image to a second location
697 before booting a second core.
698 The value will be evaluated as a math expression, this means that
699 following are valid expression
700 - 1024
701 - 0x1000
702 - -0x1000
703 - 0x20000000 - 0x10000000
704 Note: negative numbers are valid.
705 To adjust according to a chosen flash partition one can specify a
706 default as:
707 DT_CHOSEN_IMAGE_<name> := <name>,<name>-partition
708 DT_CHOSEN_Z_FLASH := zephyr,flash
709 config BUILD_OUTPUT_ADJUST_LMA
710 default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_IMAGE_M4))-\
711 $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))"
712
Torsten Rasmussenc8ddc342022-01-10 11:02:26 +0100713config BUILD_OUTPUT_INFO_HEADER
714 bool "Create a image information header"
715 help
716 Create an image information header which will contain image
717 information from the Zephyr binary.
718 Example of information contained in the header file:
719 - Number of segments in the image
720 - LMA address of each segment
721 - VMA address of each segment
722 - Size of each segment
723
Daniel DeGrassed8bdddd2023-07-28 19:47:45 +0000724config BUILD_ALIGN_LMA
725 bool "Align LMA in output image"
726 default y if BUILD_OUTPUT_ADJUST_LMA!=""
727 help
728 Ensure that the LMA for each section in the output image respects
729 the alignment requirements of that section. This is required for
730 some tooling, such as objcopy, to be able to adjust the LMA of the
731 ELF file.
732
Anas Nashif86ad37a2018-11-02 07:12:07 -0400733config APPLICATION_DEFINED_SYSCALL
734 bool "Scan application folder for any syscall definition"
735 help
736 Scan additional folders inside application source folder
737 for application defined syscalls.
738
Sebastian Bøed3a8fd42019-10-17 14:25:34 +0200739config MAKEFILE_EXPORTS
740 bool "Generate build metadata files named Makefile.exports"
741 help
742 Generates a file with build information that can be read by
743 third party Makefile-based build systems.
744
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200745config BUILD_OUTPUT_META
746 bool "Create a build meta file"
747 help
748 Create a build meta file in the build directory containing lists of:
749 - Zephyr: path and revision (if git repo)
750 - Zephyr modules: name, path, and revision (if git repo)
Torsten Rasmussen64ec6ee2021-11-04 14:28:21 +0100751 - West:
752 - manifest: path and revision
753 - projects: path and revision
754 - Workspace:
755 - dirty: one or more repositories are marked dirty
756 - extra: extra Zephyr modules are manually included in the build
757 - off: the SHA of one or more west projects are not what the manifest
758 defined when `west update` was run the last time (`manifest-rev`).
759 The off state is only present if a west workspace is found.
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200760 File extension is .meta
761
Torsten Rasmussen1a519932021-11-04 18:35:50 +0100762config BUILD_OUTPUT_META_STATE_PROPAGATE
763 bool "Propagate module and project state"
764 depends on BUILD_OUTPUT_META
765 help
766 Propagate to state of each module to the Zephyr revision field.
767 If west is used the state of each west project is also propagated to
768 the Zephyr revision field.
769 West manifest repo revision field will also
770 be marked with the same state as the Zephyr revision.
771 The final revision will become: <SHA>-<state1>-<state2>-<state3>...
772 If no states are appended to the SHA it means the build is of a clean
773 tree.
774 - dirty: one or more repositories are marked dirty
775 - extra: extra Zephyr modules are manually included in the build
776 - off: the SHA of one or more west projects are not what the manifest
777 defined when `west update` was run the last time (`manifest-rev`).
778 The off state is only present if a west workspace is found.
779
Martin Jägera0ffaa72023-03-29 16:06:30 +0200780config BUILD_OUTPUT_STRIP_PATHS
781 bool "Strip absolute paths from binaries"
782 default y
783 help
784 If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the
785 __FILE__ macro used in __ASSERT*, in the
786 .noinit."/home/joe/zephyr/fu/bar.c" section names and in any
787 application code.
788 This saves some memory, stops leaking user locations in binaries, makes
789 failure logs more deterministic and most importantly makes builds more
790 deterministic.
791 Debuggers usually have a path mapping feature to ensure the files are
792 still found.
793
Fabio Baltieri2264c142023-03-09 17:29:54 +0000794config CHECK_INIT_PRIORITIES
795 bool "Build time initialization priorities check"
Fabio Baltieri058f2562023-03-10 17:26:35 +0000796 default y
Alberto Escolar Piedras9bb708e2023-11-23 15:27:09 +0100797 # If we are building a native_simulator target, we can only check the init priorities
798 # if we are building the final output but we are not assembling several images together
799 depends on !(NATIVE_LIBRARY && (!BUILD_OUTPUT_EXE || NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS != ""))
Fabio Baltieri4a556a92023-09-18 11:35:35 +0000800 depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "armclang"
Fabio Baltieri2264c142023-03-09 17:29:54 +0000801 help
802 Check the build for initialization priority issues by comparing the
803 initialization priority in the build with the device dependency
804 derived from the devicetree definition.
805
806 Fails the build on priority errors (dependent devices, inverted
Fabio Baltieri2a70c312023-10-27 09:27:48 +0000807 priority).
Fabio Baltieri2264c142023-03-09 17:29:54 +0000808
Daniel Leung80e78202023-05-25 11:41:48 -0700809config EMIT_ALL_SYSCALLS
810 bool "Emit all possible syscalls in the tree"
811 help
812 This tells the build system to emit all possible syscalls found
813 in the tree, instead of only those syscalls associated with enabled
814 drivers and subsystems.
815
Anas Nashif86ad37a2018-11-02 07:12:07 -0400816endmenu
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100817
Torsten Rasmussen6066ab42022-07-15 12:05:04 +0200818config DEPRECATED
819 bool
820 help
821 Symbol that must be selected by a feature or module if it is
822 considered to be deprecated.
823
824config WARN_DEPRECATED
825 bool
826 default y
827 prompt "Warn on deprecated usage"
828 help
829 Print a warning when the Kconfig tree is parsed if any deprecated
830 features are enabled.
831
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100832config EXPERIMENTAL
833 bool
834 help
835 Symbol that must be selected by a feature if it is considered to be
836 at an experimental implementation stage.
837
838config WARN_EXPERIMENTAL
839 bool
840 prompt "Warn on experimental usage"
841 help
842 Print a warning when the Kconfig tree is parsed if any experimental
843 features are enabled.
844
Carles Cufid800ccc2022-08-22 18:38:16 +0200845config TAINT
846 bool
847 help
848 Symbol that must be selected by a feature or module if the Zephyr
849 build is considered tainted.
850
Nicolas Pitre0a386db2022-06-20 13:18:14 -0400851config ENFORCE_ZEPHYR_STDINT
852 bool
853 prompt "Enforce Zephyr convention for stdint"
854 depends on !ARCH_POSIX
855 default y
856 help
857 This enforces the Zephyr stdint convention where int32_t = int,
858 int64_t = long long, and intptr_t = long so that short string
859 format length modifiers can be used universally across ILP32
860 and LP64 architectures. Sometimes this is not possible e.g. when
861 linking against a binary-only C++ library whose type mangling
862 is incompatible with the Zephyr convention, or if the build
863 environment doesn't allow such enforcement, in which case this
864 should be turned off with the caveat that argument type validation
865 on Zephyr code will be skipped.
866
Anas Nashif86ad37a2018-11-02 07:12:07 -0400867endmenu
868
869
870menu "Boot Options"
871
872config IS_BOOTLOADER
873 bool "Act as a bootloader"
874 depends on XIP
875 depends on ARM
876 help
877 This option indicates that Zephyr will act as a bootloader to execute
878 a separate Zephyr image payload.
879
880config BOOTLOADER_SRAM_SIZE
Jamie McCraed548a7f2023-11-14 07:50:48 +0000881 int "SRAM reserved for bootloader [DEPRECATED]"
Kevin Townsendf68cee92023-07-14 00:47:55 +0200882 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400883 depends on !XIP || IS_BOOTLOADER
Rajavardhan Gundie584b052018-12-14 16:55:43 +0530884 depends on ARM || XTENSA
Anas Nashif86ad37a2018-11-02 07:12:07 -0400885 help
886 This option specifies the amount of SRAM (measure in kB) reserved for
887 a bootloader image, when either:
888 - the Zephyr image itself is to act as the bootloader, or
889 - Zephyr is a !XIP image, which implicitly assumes existence of a
890 bootloader that loads the Zephyr !XIP image onto SRAM.
891
Jamie McCraed548a7f2023-11-14 07:50:48 +0000892 This option is deprecated, users should transition to using DTS to set this, if needed.
893 To be removed after Zephyr 3.7 release.
894
895config BOOTLOADER_SRAM_SIZE_DEPRECATED
896 bool
897 default y
898 select DEPRECATED
899 depends on BOOTLOADER_SRAM_SIZE != 0
900 depends on !XIP || IS_BOOTLOADER
901 depends on ARM || XTENSA
902 help
903 Non-prompt symbol to indicate that the deprecated BOOTLOADER_SRAM_SIZE Kconfig has a
904 non-0 value. Please transition to using devicetree.
905
Anas Nashif86ad37a2018-11-02 07:12:07 -0400906config BOOTLOADER_ESP_IDF
907 bool "ESP-IDF bootloader support"
Torsten Rasmussen8dc3f852022-09-14 22:23:15 +0200908 depends on SOC_FAMILY_ESPRESSIF_ESP32 && !BOOTLOADER_MCUBOOT && !MCUBOOT
Marek Matej47967462023-05-09 11:10:05 +0200909 default y
Anas Nashif86ad37a2018-11-02 07:12:07 -0400910 help
911 This option will trigger the compilation of the ESP-IDF bootloader
912 inside the build folder.
913 At flash time, the bootloader will be flashed with the zephyr image
914
Michael Hope8c1f1862020-06-13 21:32:11 +0200915config BOOTLOADER_BOSSA
916 bool "BOSSA bootloader support"
917 select USE_DT_CODE_PARTITION
Michael Hope8c1f1862020-06-13 21:32:11 +0200918
919 help
920 Signifies that the target uses a BOSSA compatible bootloader. If CDC
921 ACM USB support is also enabled then the board will reboot into the
922 bootloader automatically when bossac is run.
923
924config BOOTLOADER_BOSSA_DEVICE_NAME
925 string "BOSSA CDC ACM device name"
926 depends on BOOTLOADER_BOSSA && CDC_ACM_DTE_RATE_CALLBACK_SUPPORT
927 default "CDC_ACM_0"
928 help
929 Sets the CDC ACM port to watch for reboot commands.
930
931choice
932 prompt "BOSSA bootloader variant"
933 depends on BOOTLOADER_BOSSA
934
Gerson Fernando Budkef3a7f042021-05-06 21:20:11 -0300935config BOOTLOADER_BOSSA_LEGACY
936 bool "Legacy"
937 help
938 Select the Legacy variant of the BOSSA bootloader. This is defined
939 for compatibility mode only. The recommendation is use newer
940 versions like Arduino or Adafruit UF2.
941
Michael Hope8c1f1862020-06-13 21:32:11 +0200942config BOOTLOADER_BOSSA_ARDUINO
943 bool "Arduino"
944 help
945 Select the Arduino variant of the BOSSA bootloader. Uses 0x07738135
946 as the magic value to enter the bootloader.
947
948config BOOTLOADER_BOSSA_ADAFRUIT_UF2
949 bool "Adafruit UF2"
950 help
951 Select the Adafruit UF2 variant of the BOSSA bootloader. Uses
952 0xf01669ef as the magic value to enter the bootloader.
953
954endchoice
955
Anas Nashif86ad37a2018-11-02 07:12:07 -0400956endmenu