blob: c484898206b713b8658ea51e0daa1098278e72df [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
Ulf Magnussond7130332018-09-05 13:10:19 +020024source "$(BOARD_DIR)/Kconfig.defconfig"
Torsten Rasmussen6be1b2a2021-06-02 08:47:21 +020025
26# This loads custom SoC root defconfigs
27osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig"
28# This loads Zephyr base SoC root defconfigs
29osource "soc/$(ARCH)/*/Kconfig.defconfig"
Torsten Rasmussen36bb00d2021-08-15 23:14:21 +020030# This loads the toolchain defconfigs
31osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig.defconfig"
Krzysztof Chruscinski2735a3a2022-09-06 12:50:10 +020032# This loads the testsuite defconfig
33source "subsys/testsuite/Kconfig.defconfig"
Ulf Magnussonec3eff52018-07-30 10:57:47 +020034
Kumar Gala52a3ec92022-08-12 10:00:38 -050035# This should be early since the autogen Kconfig.dts symbols may get
36# used by modules
37source "dts/Kconfig"
38
Ioannis Glaropoulosc5203852020-12-07 18:42:52 +010039menu "Modules"
40
Ioannis Glaropoulosc5203852020-12-07 18:42:52 +010041source "modules/Kconfig"
42
43endmenu
44
Anas Nashifabcf2ad2018-09-04 08:32:07 -050045source "boards/Kconfig"
Torsten Rasmussen5f7cc8d2020-07-06 12:53:39 +020046source "soc/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040047source "arch/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040048source "kernel/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040049source "drivers/Kconfig"
Anas Nashif0b2c44a2016-05-14 23:10:51 -040050source "lib/Kconfig"
Ramesh Thomase354ad22016-10-29 04:10:36 -070051source "subsys/Kconfig"
Kumar Gala7584a122016-05-24 14:23:26 -050052
Kumar Gala2630fba2020-01-24 09:39:40 -060053osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig"
Anas Nashif8017c592019-05-23 17:19:41 -040054
Anas Nashif86ad37a2018-11-02 07:12:07 -040055menu "Build and Link Features"
56
57menu "Linker Options"
58
Erwan Gouriou16d9d4d2023-03-22 15:09:48 +010059choice LINKER_ORPHAN_CONFIGURATION
Daniel Leung6600c642018-10-19 10:15:19 -070060 prompt "Linker Orphan Section Handling"
61 default LINKER_ORPHAN_SECTION_WARN
62
63config LINKER_ORPHAN_SECTION_PLACE
64 bool "Place"
65 help
66 Linker puts orphan sections in place without warnings
67 or errors.
68
69config LINKER_ORPHAN_SECTION_WARN
70 bool "Warn"
71 help
Anas Nashiff2cb20c2019-06-18 14:45:40 -040072 Linker places the orphan sections in output and issues
Daniel Leung6600c642018-10-19 10:15:19 -070073 warning about those sections.
74
75config LINKER_ORPHAN_SECTION_ERROR
76 bool "Error"
77 help
78 Linker exits with error when an orphan section is found.
79
80endchoice
Anas Nashif86ad37a2018-11-02 07:12:07 -040081
82config HAS_FLASH_LOAD_OFFSET
83 bool
84 help
85 This option is selected by targets having a FLASH_LOAD_OFFSET
86 and FLASH_LOAD_SIZE.
87
Ulf Magnussonfd9981a2019-11-16 01:33:09 +010088if HAS_FLASH_LOAD_OFFSET
89
Ulf Magnusson90b9eb32019-11-16 01:22:16 +010090config USE_DT_CODE_PARTITION
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010091 bool "Link application into /chosen/zephyr,code-partition from devicetree"
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010092 help
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010093 When enabled, the application will be linked into the flash partition
94 selected by the zephyr,code-partition property in /chosen in devicetree.
95 When this is disabled, the flash load offset and size can be set manually
96 below.
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010097
Kumar Gala8ce0cf02019-08-28 09:29:26 -050098# Workaround for not being able to have commas in macro arguments
99DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
100
Anas Nashif86ad37a2018-11-02 07:12:07 -0400101config FLASH_LOAD_OFFSET
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100102 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
103 hex "Kernel load offset" if !USE_DT_CODE_PARTITION
104 default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400105 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400106 help
107 This option specifies the byte offset from the beginning of flash that
108 the kernel should be loaded into. Changing this value from zero will
109 affect the Zephyr image's link, and will decrease the total amount of
110 flash available for use by application code.
111
112 If unsure, leave at the default value 0.
113
114config FLASH_LOAD_SIZE
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100115 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
116 hex "Kernel load size" if !USE_DT_CODE_PARTITION
117 default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400118 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400119 help
120 If non-zero, this option specifies the size, in bytes, of the flash
121 area that the Zephyr image will be allowed to occupy. If zero, the
122 image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
123 the device.
124
125 If unsure, leave at the default value 0.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400126
Ulf Magnussonfd9981a2019-11-16 01:33:09 +0100127endif # HAS_FLASH_LOAD_OFFSET
128
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900129config ROM_START_OFFSET
Ole Sæther985446a2019-01-23 14:13:03 +0100130 hex
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900131 prompt "ROM start offset" if !BOOTLOADER_MCUBOOT
Anas Nashif86ad37a2018-11-02 07:12:07 -0400132 default 0x200 if BOOTLOADER_MCUBOOT
133 default 0
134 help
135 If the application is built for chain-loading by a bootloader this
136 variable is required to be set to value that leaves sufficient
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900137 space between the beginning of the image and the start of the first
Anas Nashif86ad37a2018-11-02 07:12:07 -0400138 section to store an image header or any other metadata.
139 In the particular case of the MCUboot bootloader this reserves enough
140 space to store the image header, which should also meet vector table
141 alignment requirements on most ARM targets, although some targets
142 may require smaller or larger values.
143
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200144config LD_LINKER_SCRIPT_SUPPORTED
145 bool
146 default y
147
148choice LINKER_SCRIPT
149 prompt "Linker script"
150 default LD_LINKER_TEMPLATE if LD_LINKER_SCRIPT_SUPPORTED
151
152config LD_LINKER_TEMPLATE
153 bool "LD template"
154 depends on LD_LINKER_SCRIPT_SUPPORTED
155 help
156 Select this option to use the LD linker script templates.
157 The templates are pre-processed by the C pre-processor to create the
158 final LD linker script.
159
160config CMAKE_LINKER_GENERATOR
161 bool "CMake generator"
162 depends on ARM
163 help
164 Select this option to use the Zephyr CMake linker script generator.
165 The linker configuration is written in CMake and the final linker
166 script will be generated by the toolchain specific linker generator.
167 For LD based linkers, this will be the ld generator, for ARMClang /
168 armlink based linkers it will be the scatter generator.
169
170endchoice
171
Anas Nashif86ad37a2018-11-02 07:12:07 -0400172config HAVE_CUSTOM_LINKER_SCRIPT
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200173 bool "Custom linker script provided"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400174 help
175 Set this option if you have a custom linker script which needed to
176 be define in CUSTOM_LINKER_SCRIPT.
177
178config CUSTOM_LINKER_SCRIPT
179 string "Path to custom linker script"
180 depends on HAVE_CUSTOM_LINKER_SCRIPT
181 help
182 Path to the linker script to be used instead of the one define by the
183 board.
184
185 The linker script must be based on a version provided by Zephyr since
186 the kernel can expect a certain layout/certain regions.
187
188 This is useful when an application needs to add sections into the
189 linker script and avoid having to change the script provided by
190 Zephyr.
191
Anas Nashif86ad37a2018-11-02 07:12:07 -0400192config KERNEL_ENTRY
193 string "Kernel entry symbol"
194 default "__start"
195 help
196 Code entry symbol, to be set at linking phase.
197
Sebastian Bøe3a0597f2019-03-15 14:05:09 +0100198config LINKER_SORT_BY_ALIGNMENT
199 bool "Sort input sections by alignment"
200 default y
201 help
202 This turns on the linker flag to sort sections by alignment
203 in decreasing size of symbols. This helps to minimize
204 padding between symbols.
205
Jordan Yates318ee972021-04-17 20:04:33 +1000206config SRAM_VECTOR_TABLE
207 bool "Place the vector table in SRAM instead of flash"
208 help
209 The option specifies that the vector table should be placed at the
210 start of SRAM instead of the start of flash.
211
Daniel Leungece9cad2021-02-20 11:02:17 -0800212config HAS_SRAM_OFFSET
213 bool
214 help
215 This option is selected by targets that require SRAM_OFFSET.
216
217config SRAM_OFFSET
218 hex "Kernel SRAM offset" if HAS_SRAM_OFFSET
219 default 0
220 help
221 This option specifies the byte offset from the beginning of SRAM
222 where the kernel begins. Changing this value from zero will affect
223 the Zephyr image's link, and will decrease the total amount of
224 SRAM available for use by application code.
225
226 If unsure, leave at the default value 0.
227
Daniel Leungd8127282021-02-24 10:18:34 -0800228menu "Linker Sections"
229
230config LINKER_USE_BOOT_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100231 bool "Use Boot Linker Section"
Daniel Leungd8127282021-02-24 10:18:34 -0800232 help
233 If enabled, the symbols which are needed for the boot process
234 will be put into another linker section reserved for these
235 symbols.
236
237 Requires that boot sections exist in the architecture, SoC,
238 board or custom linker script.
239
Daniel Leung1310ad62021-02-23 13:33:38 -0800240config LINKER_USE_PINNED_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100241 bool "Use Pinned Linker Section"
Daniel Leung1310ad62021-02-23 13:33:38 -0800242 help
243 If enabled, the symbols which need to be pinned in memory
244 will be put into another linker section reserved for pinned
245 symbols. During boot, the corresponding memory will be marked
246 as pinned.
247
248 Requires that pinned sections exist in the architecture, SoC,
249 board or custom linker script.
250
Daniel Leung6a006d72021-07-12 10:58:45 -0700251config LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT
252 bool "Generic sections are present at boot" if DEMAND_PAGING && LINKER_USE_PINNED_SECTION
253 default y
254 help
255 When disabled, the linker sections other than the boot and
256 pinned sections will be marked as not present in the page
257 tables. This allows kernel to pull in data pages on demand
258 as required by current execution context when demand paging
259 is enabled. There is no need to load all code and data into
260 memory at once.
261
262 If unsure, say Y.
263
Torsten Rasmussenc1078272022-09-27 12:34:36 +0200264config LINKER_LAST_SECTION_ID
265 bool "Last section identifier"
266 default y
267 depends on ARM || ARM64 || RISCV
268 help
269 If enabled, the last section will contain an identifier.
270 This ensures that the '_flash_used' linker symbol will always be
271 correctly calculated, even in cases where the location counter may
272 have been incremented for alignment purposes but no data is placed
273 after alignment.
274
275 Note: in cases where the flash is fully used, for example application
276 specific data is written at the end of the flash area, then writing a
277 last section identifier may cause rom region overflow.
278 In such cases this setting should be disabled.
279
280config LINKER_LAST_SECTION_ID_PATTERN
281 hex "Last section identifier pattern"
282 default "0xE015E015"
283 depends on LINKER_LAST_SECTION_ID
284 help
285 Pattern to fill into last section as identifier.
286 Default pattern is 0xE015 (end of last section), but any pattern can
287 be used.
288 The size of the pattern must not exceed 4 bytes.
289
Flavio Ceolin56ec06f2022-12-20 10:36:34 -0800290config LINKER_USE_NO_RELAX
291 bool
292 help
293 Hidden symbol to allow features to force the use of no relax.
294
295config LINKER_USE_RELAX
296 bool "Linker optimization of call addressing"
297 depends on !LINKER_USE_NO_RELAX
298 default y
299 help
300 This option performs global optimizations that become possible when the linker resolves
301 addressing in the program, such as relaxing address modes and synthesizing new
302 instructions in the output object file. For ld and lld, this enables `--relax`.
303 On platforms where this is not supported, `--relax' is accepted, but ignored.
304 Disabling it can reduce performance, as the linker is no longer able to substiture long /
305 in-effective jump calls to shorter / more effective instructions.
306
Daniel Leungd8127282021-02-24 10:18:34 -0800307endmenu # "Linker Sections"
308
Krzysztof Chruscinskidfb36742022-04-22 11:36:05 +0200309config LINKER_DEVNULL_SUPPORT
310 bool
311 default y if CPU_CORTEX_M || (RISCV && !64BIT)
312
313config LINKER_DEVNULL_MEMORY
314 bool "Devnull region"
315 depends on LINKER_DEVNULL_SUPPORT
316 help
317 Devnull region is created. It is stripped from final binary but remains
318 in byproduct elf file.
319
320config LINKER_DEVNULL_MEMORY_SIZE
321 int "Devnull region size"
322 depends on LINKER_DEVNULL_MEMORY
323 default 262144
324 help
325 Size can be adjusted so it fits all data placed in that region.
326
Anas Nashif86ad37a2018-11-02 07:12:07 -0400327endmenu
328
329menu "Compiler Options"
330
Flavio Ceolinb587e8d2020-08-26 09:48:33 -0700331config CODING_GUIDELINE_CHECK
332 bool "Enforce coding guideline rules"
333 help
334 Use available compiler flags to check coding guideline rules during
335 the build.
336
Keith Packardbe4b76f2023-10-12 11:55:04 -0700337config NATIVE_LIBC
Alberto Escolar Piedras2eb14f12023-05-26 13:15:09 +0200338 bool
Keith Packard214a3c52023-02-08 13:44:39 -0800339 select FULL_LIBC_SUPPORTED
Keith Packardbe4b76f2023-10-12 11:55:04 -0700340 help
341 Zephyr will use the host system C library.
342
343config NATIVE_LIBCPP
344 bool
345 select FULL_LIBCPP_SUPPORTED
346 help
347 Zephyr will use the host system C++ library
348
349config NATIVE_BUILD
350 bool
351 select NATIVE_LIBC if EXTERNAL_LIBC
352 select NATIVE_LIBCPP if EXTERNAL_LIBCPP
Anas Nashif86ad37a2018-11-02 07:12:07 -0400353 help
Alberto Escolar Piedras2eb14f12023-05-26 13:15:09 +0200354 Zephyr will be built targeting the host system for debug and
355 development purposes.
356
357config NATIVE_APPLICATION
358 bool
359 default y if ARCH_POSIX
360 depends on !NATIVE_LIBRARY
361 select NATIVE_BUILD
362 help
Anas Nashif86ad37a2018-11-02 07:12:07 -0400363 Build as a native application that can run on the host and using
364 resources and libraries provided by the host.
365
Alberto Escolar Piedras2eb14f12023-05-26 13:15:09 +0200366config NATIVE_LIBRARY
367 bool
368 select NATIVE_BUILD
369 help
370 Build as a prelinked library for the native host target.
371 This library can later be built into an executable for the host.
372
Keith Packard6c5d8062023-02-08 14:56:50 -0800373config COMPILER_FREESTANDING
374 bool "Build in a freestanding compiler mode"
375 help
376 Configure the compiler to operate in freestanding mode according to
377 the C and C++ language specifications. Freestanding mode reduces the
378 requirements of the compiler and language environment, which can
379 negatively impact the ability for the compiler to detect errors and
380 perform optimizations.
381
Emil Lindqvistf7dad072021-09-03 13:52:33 +0200382choice COMPILER_OPTIMIZATIONS
Anas Nashif86ad37a2018-11-02 07:12:07 -0400383 prompt "Optimization level"
384 default NO_OPTIMIZATIONS if COVERAGE
385 default DEBUG_OPTIMIZATIONS if DEBUG
386 default SIZE_OPTIMIZATIONS
387 help
388 Note that these flags shall only control the compiler
389 optimization level, and that no extra debug code shall be
390 conditionally compiled based on them.
391
392config SIZE_OPTIMIZATIONS
393 bool "Optimize for size"
394 help
395 Compiler optimizations will be set to -Os independently of other
396 options.
397
398config SPEED_OPTIMIZATIONS
399 bool "Optimize for speed"
400 help
401 Compiler optimizations will be set to -O2 independently of other
402 options.
403
404config DEBUG_OPTIMIZATIONS
405 bool "Optimize debugging experience"
406 help
407 Compiler optimizations will be set to -Og independently of other
408 options.
409
410config NO_OPTIMIZATIONS
411 bool "Optimize nothing"
412 help
413 Compiler optimizations will be set to -O0 independently of other
414 options.
Henrik Brix Andersen26ebcee2023-03-22 10:19:40 +0100415
416 Selecting this option will likely require manual tuning of the
417 default stack sizes in order to avoid stack overflows.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400418endchoice
419
Nikolay Agishev0dec4cf2022-12-22 15:46:04 +0400420config COMPILER_WARNINGS_AS_ERRORS
421 bool "Treat warnings as errors"
422 help
423 Turn on "warning as error" toolchain flags
424
Fabio Baltieri3f8f7132023-03-29 10:11:46 +0100425config COMPILER_SAVE_TEMPS
426 bool "Save temporary object files"
427 help
428 Instruct the compiler to save the temporary intermediate files
429 permanently. These can be useful for troubleshooting build issues.
430
Gerard Marull-Paretas99ebe392023-05-05 09:58:12 +0200431config COMPILER_TRACK_MACRO_EXPANSION
432 bool "Track macro expansion"
433 default y
434 help
435 When enabled, locations of tokens across macro expansions will be
436 tracked. Disabling this option may be useful to debug long macro
437 expansion chains.
438
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400439config COMPILER_COLOR_DIAGNOSTICS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100440 bool "Colored diagnostics"
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400441 default y
442 help
443 Compiler diagnostic messages are colorized.
444
Keith Packard62bc9bf2022-04-26 19:24:11 -0700445choice COMPILER_SECURITY_FORTIFY
446 prompt "Detect buffer overflows in libc calls"
Alberto Escolar Piedras56dc20e2023-05-26 13:23:43 +0200447 default FORTIFY_SOURCE_NONE if NO_OPTIMIZATIONS || MINIMAL_LIBC || NATIVE_BUILD
Keith Packard62bc9bf2022-04-26 19:24:11 -0700448 default FORTIFY_SOURCE_COMPILE_TIME
449 help
450 Buffer overflow checking in libc calls. Supported by Clang and
451 GCC when using Picolibc or Newlib. Requires compiler optimization
452 to be enabled.
453
454config FORTIFY_SOURCE_NONE
455 bool "No detection"
456 help
457 Disables both compile-time and run-time checking.
458
459config FORTIFY_SOURCE_COMPILE_TIME
460 bool "Compile-time detection"
461 help
462 Enables only compile-time checking. Compile-time checking
463 doesn't increase executable size or reduce performance, it
464 limits checking to what can be done with information available
465 at compile time.
466
467config FORTIFY_SOURCE_RUN_TIME
468 bool "Compile-time and run-time detection"
469 help
470 Enables both compile-time and run-time checking. Run-time
471 checking increases coverage at the expense of additional code,
472 and means that applications will raise a runtime exception
473 when buffer overflow is detected.
474
475endchoice
476
Anas Nashif86ad37a2018-11-02 07:12:07 -0400477config COMPILER_OPT
478 string "Custom compiler options"
479 help
480 This option is a free-form string that is passed to the compiler
481 when building all parts of a project (i.e. kernel).
482 The compiler options specified by this string supplement the
483 predefined set of compiler supplied by the build system,
484 and can be used to change compiler optimization, warning and error
485 messages, and so on.
486
Martí Bolívare5cc8542021-05-21 10:56:23 -0700487config MISRA_SANE
488 bool "MISRA standards compliance features"
489 help
490 Causes the source code to build in "MISRA" mode, which
491 disallows some otherwise-permitted features of the C
492 standard for safety reasons. Specifically variable length
493 arrays are not permitted (and gcc will enforce this).
494
Anas Nashif86ad37a2018-11-02 07:12:07 -0400495endmenu
496
Anas Nashif22b95a22019-11-24 11:28:38 -0500497choice
498 prompt "Error checking behavior for CHECK macro"
499 default RUNTIME_ERROR_CHECKS
500
501config ASSERT_ON_ERRORS
502 bool "Assert on all errors"
503 help
504 Assert on errors covered with the CHECK macro.
505
506config NO_RUNTIME_CHECKS
507 bool "No runtime error checks"
508 help
509 Do not do any runtime checks or asserts when using the CHECK macro.
510
511config RUNTIME_ERROR_CHECKS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100512 bool "Runtime error checks"
Anas Nashif22b95a22019-11-24 11:28:38 -0500513 help
514 Always perform runtime checks covered with the CHECK macro. This
515 option is the default and the only option used during testing.
516
517endchoice
518
Anas Nashif86ad37a2018-11-02 07:12:07 -0400519menu "Build Options"
520
521config KERNEL_BIN_NAME
522 string "The kernel binary name"
523 default "zephyr"
524 help
525 This option sets the name of the generated kernel binary.
526
527config OUTPUT_STAT
528 bool "Create a statistics file"
529 default y
530 help
531 Create a stat file using readelf -e <elf>
532
Anas Nashif47a673f2022-06-27 10:08:37 -0400533config OUTPUT_SYMBOLS
534 bool "Create a symbol file"
535 help
536 Create a symbol file using nm <elf>
537
Anas Nashif86ad37a2018-11-02 07:12:07 -0400538config OUTPUT_DISASSEMBLY
539 bool "Create a disassembly file"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400540 help
541 Create an .lst file with the assembly listing of the firmware.
542
Rohit Gujarathi35713f22020-05-07 10:08:37 +0530543config OUTPUT_DISASSEMBLE_ALL
544 bool "Disassemble all sections with source. Fill zeros."
545 default n
546 depends on OUTPUT_DISASSEMBLY
547 help
548 The .lst file will contain complete disassembly of the firmware
549 not just those expected to contain instructions including zeros
550
Anas Nashif86ad37a2018-11-02 07:12:07 -0400551config OUTPUT_PRINT_MEMORY_USAGE
552 bool "Print memory usage to stdout"
553 default y
554 help
555 If the toolchain supports it, this option will pass
556 --print-memory-region to the linker when it is doing it's first
557 linker pass. Note that the memory regions are symbolic concepts
558 defined by the linker scripts and do not necessarily map
559 directly to the real physical address space. Take also note that
560 some platforms do two passes of the linker so the results do not
561 match exactly to the final elf file. See also rom_report,
562 ram_report and
563 https://sourceware.org/binutils/docs/ld/MEMORY.html
564
Anas Nashiffdbf2db2020-10-20 14:31:56 -0400565config CLEANUP_INTERMEDIATE_FILES
566 bool "Remove all intermediate files"
567 help
568 Delete intermediate files to save space and cleanup clutter resulting
Filip Kokosinski7388a072023-07-19 15:40:55 +0200569 from the build process. Note this breaks incremental builds, west spdx
570 (Software Bill of Material generation), and maybe others.
Anas Nashiffdbf2db2020-10-20 14:31:56 -0400571
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700572config BUILD_NO_GAP_FILL
573 bool "Don't fill gaps in generated hex/bin/s19 files."
574
Anas Nashif86ad37a2018-11-02 07:12:07 -0400575config BUILD_OUTPUT_HEX
576 bool "Build a binary in HEX format"
577 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700578 Build an Intel HEX binary zephyr/zephyr.hex in the build directory.
579 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400580
581config BUILD_OUTPUT_BIN
582 bool "Build a binary in BIN format"
583 default y
584 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700585 Build a "raw" binary zephyr/zephyr.bin in the build directory.
586 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400587
Anas Nashif51c34bb2021-01-26 06:58:30 -0500588config BUILD_OUTPUT_EFI
589 bool "Build as an EFI application"
590 default n
591 depends on X86_64
592 help
593 Build as an EFI application.
594
595 This works by creating a "zephyr.efi" EFI binary containing a zephyr
596 image extracted from a built zephyr.elf file. EFI applications are
597 relocatable, and cannot be placed at specific locations in memory.
598 Instead, the stub code will copy the embedded zephyr sections to the
599 appropriate locations at startup, clear any zero-filled (BSS, etc...)
600 areas, then jump into the 64 bit entry point.
601
Anas Nashif86ad37a2018-11-02 07:12:07 -0400602config BUILD_OUTPUT_EXE
603 bool "Build a binary in ELF format with .exe extension"
604 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700605 Build an ELF binary that can run in the host system at
606 zephyr/zephyr.exe in the build directory.
607 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400608
609config BUILD_OUTPUT_S19
610 bool "Build a binary in S19 format"
611 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700612 Build an S19 binary zephyr/zephyr.s19 in the build directory.
613 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Håkon Øye Amundsenc086b932018-11-26 09:47:16 +0000614
Pete Johanson310a4642020-12-31 16:51:52 -0500615config BUILD_OUTPUT_UF2
616 bool "Build a binary in UF2 format"
617 depends on BUILD_OUTPUT_BIN
618 help
619 Build a UF2 binary zephyr/zephyr.uf2 in the build directory.
620 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
621
622if BUILD_OUTPUT_UF2
623
624config BUILD_OUTPUT_UF2_FAMILY_ID
Pete Johansonff01a002021-02-16 09:35:11 -0500625 string "UF2 device family ID"
Marek Matej6b57b3b2023-07-20 18:24:09 +0200626 default "0x1c5f21b0" if SOC_SERIES_ESP32
Xudong Zheng8db98692022-03-22 12:15:50 -0400627 default "0x621e937a" if SOC_NRF52833_QIAA
Pete Johansonff01a002021-02-16 09:35:11 -0500628 default "0xada52840" if SOC_NRF52840_QIAA
629 default "0x4fb2d5bd" if SOC_SERIES_IMX_RT
630 default "0x2abc77ec" if SOC_SERIES_LPC55XXX
Yonatan Schachterefa170f2022-02-01 23:05:04 +0200631 default "0xe48bff56" if SOC_SERIES_RP2XXX
Pete Johansonff01a002021-02-16 09:35:11 -0500632 default "0x68ed2b88" if SOC_SERIES_SAMD21
633 default "0x55114460" if SOC_SERIES_SAMD51
634 default "0x647824b6" if SOC_SERIES_STM32F0X
635 default "0x5d1a0a2e" if SOC_SERIES_STM32F2X
636 default "0x6b846188" if SOC_SERIES_STM32F3X
637 default "0x53b80f00" if SOC_SERIES_STM32F7X
638 default "0x300f5633" if SOC_SERIES_STM32G0X
639 default "0x4c71240a" if SOC_SERIES_STM32G4X
640 default "0x6db66082" if SOC_SERIES_STM32H7X
641 default "0x202e3a91" if SOC_SERIES_STM32L0X
642 default "0x1e1f432d" if SOC_SERIES_STM32L1X
643 default "0x00ff6919" if SOC_SERIES_STM32L4X
644 default "0x04240bdf" if SOC_SERIES_STM32L5X
645 default "0x70d16653" if SOC_SERIES_STM32WBX
646 default "0x5ee21072" if SOC_STM32F103XE
Guillaume Gautier3d423222022-12-21 14:44:45 +0100647 default "0x57755a57" if SOC_SERIES_STM32F4X && (!SOC_STM32F407XE) && (!SOC_STM32F407XG)
Pete Johansonff01a002021-02-16 09:35:11 -0500648 default "0x6d0922fa" if SOC_STM32F407XE
649 default "0x8fb060fe" if SOC_STM32F407XG
Pete Johanson310a4642020-12-31 16:51:52 -0500650 help
651 UF2 bootloaders only accept UF2 files with a matching family ID.
652 This can be either a hex, e.g. 0x68ed2b88, or well-known family
Pete Johansonff01a002021-02-16 09:35:11 -0500653 name string. If the SoC in use is known by UF2, the Family ID will
654 be pre-filled with the known value.
Pete Johanson310a4642020-12-31 16:51:52 -0500655
Peter Johanson3f332072022-01-27 00:45:27 -0500656config BUILD_OUTPUT_UF2_USE_FLASH_BASE
657 bool
658 default n
659
660config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET
661 bool
662 default n
663
Pete Johanson310a4642020-12-31 16:51:52 -0500664endif # BUILD_OUTPUT_UF2
665
Anas Nashif86ad37a2018-11-02 07:12:07 -0400666config BUILD_OUTPUT_STRIPPED
667 bool "Build a stripped binary"
668 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700669 Build a stripped binary zephyr/zephyr.strip in the build directory.
670 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400671
Torsten Rasmussend51a67b2022-01-12 14:21:07 +0100672config BUILD_OUTPUT_ADJUST_LMA
673 string
674 help
675 This will adjust the LMA address in the final ELF and hex files with
676 the value provided.
677 This will not affect the internal address symbols inside the image but
678 can be useful when adjusting the LMA address for flash tools or multi
679 stage loaders where a pre-loader may copy image to a second location
680 before booting a second core.
681 The value will be evaluated as a math expression, this means that
682 following are valid expression
683 - 1024
684 - 0x1000
685 - -0x1000
686 - 0x20000000 - 0x10000000
687 Note: negative numbers are valid.
688 To adjust according to a chosen flash partition one can specify a
689 default as:
690 DT_CHOSEN_IMAGE_<name> := <name>,<name>-partition
691 DT_CHOSEN_Z_FLASH := zephyr,flash
692 config BUILD_OUTPUT_ADJUST_LMA
693 default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_IMAGE_M4))-\
694 $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))"
695
Torsten Rasmussenc8ddc342022-01-10 11:02:26 +0100696config BUILD_OUTPUT_INFO_HEADER
697 bool "Create a image information header"
698 help
699 Create an image information header which will contain image
700 information from the Zephyr binary.
701 Example of information contained in the header file:
702 - Number of segments in the image
703 - LMA address of each segment
704 - VMA address of each segment
705 - Size of each segment
706
Daniel DeGrassed8bdddd2023-07-28 19:47:45 +0000707config BUILD_ALIGN_LMA
708 bool "Align LMA in output image"
709 default y if BUILD_OUTPUT_ADJUST_LMA!=""
710 help
711 Ensure that the LMA for each section in the output image respects
712 the alignment requirements of that section. This is required for
713 some tooling, such as objcopy, to be able to adjust the LMA of the
714 ELF file.
715
Anas Nashif86ad37a2018-11-02 07:12:07 -0400716config APPLICATION_DEFINED_SYSCALL
717 bool "Scan application folder for any syscall definition"
718 help
719 Scan additional folders inside application source folder
720 for application defined syscalls.
721
Sebastian Bøed3a8fd42019-10-17 14:25:34 +0200722config MAKEFILE_EXPORTS
723 bool "Generate build metadata files named Makefile.exports"
724 help
725 Generates a file with build information that can be read by
726 third party Makefile-based build systems.
727
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200728config BUILD_OUTPUT_META
729 bool "Create a build meta file"
730 help
731 Create a build meta file in the build directory containing lists of:
732 - Zephyr: path and revision (if git repo)
733 - Zephyr modules: name, path, and revision (if git repo)
Torsten Rasmussen64ec6ee2021-11-04 14:28:21 +0100734 - West:
735 - manifest: path and revision
736 - projects: path and revision
737 - Workspace:
738 - dirty: one or more repositories are marked dirty
739 - extra: extra Zephyr modules are manually included in the build
740 - off: the SHA of one or more west projects are not what the manifest
741 defined when `west update` was run the last time (`manifest-rev`).
742 The off state is only present if a west workspace is found.
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200743 File extension is .meta
744
Torsten Rasmussen1a519932021-11-04 18:35:50 +0100745config BUILD_OUTPUT_META_STATE_PROPAGATE
746 bool "Propagate module and project state"
747 depends on BUILD_OUTPUT_META
748 help
749 Propagate to state of each module to the Zephyr revision field.
750 If west is used the state of each west project is also propagated to
751 the Zephyr revision field.
752 West manifest repo revision field will also
753 be marked with the same state as the Zephyr revision.
754 The final revision will become: <SHA>-<state1>-<state2>-<state3>...
755 If no states are appended to the SHA it means the build is of a clean
756 tree.
757 - dirty: one or more repositories are marked dirty
758 - extra: extra Zephyr modules are manually included in the build
759 - off: the SHA of one or more west projects are not what the manifest
760 defined when `west update` was run the last time (`manifest-rev`).
761 The off state is only present if a west workspace is found.
762
Martin Jägera0ffaa72023-03-29 16:06:30 +0200763config BUILD_OUTPUT_STRIP_PATHS
764 bool "Strip absolute paths from binaries"
765 default y
766 help
767 If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the
768 __FILE__ macro used in __ASSERT*, in the
769 .noinit."/home/joe/zephyr/fu/bar.c" section names and in any
770 application code.
771 This saves some memory, stops leaking user locations in binaries, makes
772 failure logs more deterministic and most importantly makes builds more
773 deterministic.
774 Debuggers usually have a path mapping feature to ensure the files are
775 still found.
776
Fabio Baltieri2264c142023-03-09 17:29:54 +0000777config CHECK_INIT_PRIORITIES
778 bool "Build time initialization priorities check"
Fabio Baltieri058f2562023-03-10 17:26:35 +0000779 default y
Fabio Baltieri5212a4c2023-09-08 18:10:13 +0000780 depends on !NATIVE_LIBRARY
Fabio Baltieri4a556a92023-09-18 11:35:35 +0000781 depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "armclang"
Fabio Baltieri2264c142023-03-09 17:29:54 +0000782 help
783 Check the build for initialization priority issues by comparing the
784 initialization priority in the build with the device dependency
785 derived from the devicetree definition.
786
787 Fails the build on priority errors (dependent devices, inverted
Fabio Baltieri2a70c312023-10-27 09:27:48 +0000788 priority).
Fabio Baltieri2264c142023-03-09 17:29:54 +0000789
Daniel Leung80e78202023-05-25 11:41:48 -0700790config EMIT_ALL_SYSCALLS
791 bool "Emit all possible syscalls in the tree"
792 help
793 This tells the build system to emit all possible syscalls found
794 in the tree, instead of only those syscalls associated with enabled
795 drivers and subsystems.
796
Anas Nashif86ad37a2018-11-02 07:12:07 -0400797endmenu
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100798
Torsten Rasmussen6066ab42022-07-15 12:05:04 +0200799config DEPRECATED
800 bool
801 help
802 Symbol that must be selected by a feature or module if it is
803 considered to be deprecated.
804
805config WARN_DEPRECATED
806 bool
807 default y
808 prompt "Warn on deprecated usage"
809 help
810 Print a warning when the Kconfig tree is parsed if any deprecated
811 features are enabled.
812
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100813config EXPERIMENTAL
814 bool
815 help
816 Symbol that must be selected by a feature if it is considered to be
817 at an experimental implementation stage.
818
819config WARN_EXPERIMENTAL
820 bool
821 prompt "Warn on experimental usage"
822 help
823 Print a warning when the Kconfig tree is parsed if any experimental
824 features are enabled.
825
Carles Cufid800ccc2022-08-22 18:38:16 +0200826config TAINT
827 bool
828 help
829 Symbol that must be selected by a feature or module if the Zephyr
830 build is considered tainted.
831
Nicolas Pitre0a386db2022-06-20 13:18:14 -0400832config ENFORCE_ZEPHYR_STDINT
833 bool
834 prompt "Enforce Zephyr convention for stdint"
835 depends on !ARCH_POSIX
836 default y
837 help
838 This enforces the Zephyr stdint convention where int32_t = int,
839 int64_t = long long, and intptr_t = long so that short string
840 format length modifiers can be used universally across ILP32
841 and LP64 architectures. Sometimes this is not possible e.g. when
842 linking against a binary-only C++ library whose type mangling
843 is incompatible with the Zephyr convention, or if the build
844 environment doesn't allow such enforcement, in which case this
845 should be turned off with the caveat that argument type validation
846 on Zephyr code will be skipped.
847
Anas Nashif86ad37a2018-11-02 07:12:07 -0400848endmenu
849
850
851menu "Boot Options"
852
853config IS_BOOTLOADER
854 bool "Act as a bootloader"
855 depends on XIP
856 depends on ARM
857 help
858 This option indicates that Zephyr will act as a bootloader to execute
859 a separate Zephyr image payload.
860
861config BOOTLOADER_SRAM_SIZE
862 int "SRAM reserved for bootloader"
Kevin Townsendf68cee92023-07-14 00:47:55 +0200863 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400864 depends on !XIP || IS_BOOTLOADER
Rajavardhan Gundie584b052018-12-14 16:55:43 +0530865 depends on ARM || XTENSA
Anas Nashif86ad37a2018-11-02 07:12:07 -0400866 help
867 This option specifies the amount of SRAM (measure in kB) reserved for
868 a bootloader image, when either:
869 - the Zephyr image itself is to act as the bootloader, or
870 - Zephyr is a !XIP image, which implicitly assumes existence of a
871 bootloader that loads the Zephyr !XIP image onto SRAM.
872
Anas Nashif86ad37a2018-11-02 07:12:07 -0400873config BOOTLOADER_ESP_IDF
874 bool "ESP-IDF bootloader support"
Marek Matej47967462023-05-09 11:10:05 +0200875 depends on SOC_FAMILY_ESP32 && !BOOTLOADER_MCUBOOT && !MCUBOOT
876 default y
Anas Nashif86ad37a2018-11-02 07:12:07 -0400877 help
878 This option will trigger the compilation of the ESP-IDF bootloader
879 inside the build folder.
880 At flash time, the bootloader will be flashed with the zephyr image
881
Michael Hope8c1f1862020-06-13 21:32:11 +0200882config BOOTLOADER_BOSSA
883 bool "BOSSA bootloader support"
884 select USE_DT_CODE_PARTITION
Michael Hope8c1f1862020-06-13 21:32:11 +0200885
886 help
887 Signifies that the target uses a BOSSA compatible bootloader. If CDC
888 ACM USB support is also enabled then the board will reboot into the
889 bootloader automatically when bossac is run.
890
891config BOOTLOADER_BOSSA_DEVICE_NAME
892 string "BOSSA CDC ACM device name"
893 depends on BOOTLOADER_BOSSA && CDC_ACM_DTE_RATE_CALLBACK_SUPPORT
894 default "CDC_ACM_0"
895 help
896 Sets the CDC ACM port to watch for reboot commands.
897
898choice
899 prompt "BOSSA bootloader variant"
900 depends on BOOTLOADER_BOSSA
901
Gerson Fernando Budkef3a7f042021-05-06 21:20:11 -0300902config BOOTLOADER_BOSSA_LEGACY
903 bool "Legacy"
904 help
905 Select the Legacy variant of the BOSSA bootloader. This is defined
906 for compatibility mode only. The recommendation is use newer
907 versions like Arduino or Adafruit UF2.
908
Michael Hope8c1f1862020-06-13 21:32:11 +0200909config BOOTLOADER_BOSSA_ARDUINO
910 bool "Arduino"
911 help
912 Select the Arduino variant of the BOSSA bootloader. Uses 0x07738135
913 as the magic value to enter the bootloader.
914
915config BOOTLOADER_BOSSA_ADAFRUIT_UF2
916 bool "Adafruit UF2"
917 help
918 Select the Adafruit UF2 variant of the BOSSA bootloader. Uses
919 0xf01669ef as the magic value to enter the bootloader.
920
921endchoice
922
Anas Nashif86ad37a2018-11-02 07:12:07 -0400923endmenu