blob: ff664b99d2725f0343329cf81c3bb18a2abe8ebb [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
Anas Nashif658f6bc2019-05-28 14:22:51 -04008
Ulf Magnussone63b6522020-01-26 23:47:41 +01009# Include Kconfig.defconfig files first so that they can override defaults and
10# other symbol/choice properties by adding extra symbol/choice definitions.
11# After merging all definitions for a symbol/choice, Kconfig picks the first
12# property (e.g. the first default) with a satisfied condition.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020013#
Ulf Magnussone63b6522020-01-26 23:47:41 +010014# Shield defaults should have precedence over board defaults, which should have
15# precedence over SoC defaults, so include them in that order.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020016#
Ulf Magnussone63b6522020-01-26 23:47:41 +010017# $ARCH and $BOARD_DIR will be glob patterns when building documentation.
Torsten Rasmussen6be1b2a2021-06-02 08:47:21 +020018# This loads custom shields defconfigs (from BOARD_ROOT)
19osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig"
20# This loads Zephyr base shield defconfigs
21source "boards/shields/*/Kconfig.defconfig"
22
Ulf Magnussond7130332018-09-05 13:10:19 +020023source "$(BOARD_DIR)/Kconfig.defconfig"
Torsten Rasmussen6be1b2a2021-06-02 08:47:21 +020024
25# This loads custom SoC root defconfigs
26osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig"
27# This loads Zephyr base SoC root defconfigs
28osource "soc/$(ARCH)/*/Kconfig.defconfig"
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
Daniel Leung6600c642018-10-19 10:15:19 -070058choice
59 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
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200143config LD_LINKER_SCRIPT_SUPPORTED
144 bool
145 default y
146
147choice LINKER_SCRIPT
148 prompt "Linker script"
149 default LD_LINKER_TEMPLATE if LD_LINKER_SCRIPT_SUPPORTED
150
151config LD_LINKER_TEMPLATE
152 bool "LD template"
153 depends on LD_LINKER_SCRIPT_SUPPORTED
154 help
155 Select this option to use the LD linker script templates.
156 The templates are pre-processed by the C pre-processor to create the
157 final LD linker script.
158
159config CMAKE_LINKER_GENERATOR
160 bool "CMake generator"
161 depends on ARM
162 help
163 Select this option to use the Zephyr CMake linker script generator.
164 The linker configuration is written in CMake and the final linker
165 script will be generated by the toolchain specific linker generator.
166 For LD based linkers, this will be the ld generator, for ARMClang /
167 armlink based linkers it will be the scatter generator.
168
169endchoice
170
Anas Nashif86ad37a2018-11-02 07:12:07 -0400171config HAVE_CUSTOM_LINKER_SCRIPT
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200172 bool "Custom linker script provided"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400173 help
174 Set this option if you have a custom linker script which needed to
175 be define in CUSTOM_LINKER_SCRIPT.
176
177config CUSTOM_LINKER_SCRIPT
178 string "Path to custom linker script"
179 depends on HAVE_CUSTOM_LINKER_SCRIPT
180 help
181 Path to the linker script to be used instead of the one define by the
182 board.
183
184 The linker script must be based on a version provided by Zephyr since
185 the kernel can expect a certain layout/certain regions.
186
187 This is useful when an application needs to add sections into the
188 linker script and avoid having to change the script provided by
189 Zephyr.
190
Anas Nashif86ad37a2018-11-02 07:12:07 -0400191config KERNEL_ENTRY
192 string "Kernel entry symbol"
193 default "__start"
194 help
195 Code entry symbol, to be set at linking phase.
196
Sebastian Bøe3a0597f2019-03-15 14:05:09 +0100197config LINKER_SORT_BY_ALIGNMENT
198 bool "Sort input sections by alignment"
199 default y
200 help
201 This turns on the linker flag to sort sections by alignment
202 in decreasing size of symbols. This helps to minimize
203 padding between symbols.
204
Jordan Yates318ee972021-04-17 20:04:33 +1000205config SRAM_VECTOR_TABLE
206 bool "Place the vector table in SRAM instead of flash"
207 help
208 The option specifies that the vector table should be placed at the
209 start of SRAM instead of the start of flash.
210
Daniel Leungece9cad2021-02-20 11:02:17 -0800211config HAS_SRAM_OFFSET
212 bool
213 help
214 This option is selected by targets that require SRAM_OFFSET.
215
216config SRAM_OFFSET
217 hex "Kernel SRAM offset" if HAS_SRAM_OFFSET
218 default 0
219 help
220 This option specifies the byte offset from the beginning of SRAM
221 where the kernel begins. Changing this value from zero will affect
222 the Zephyr image's link, and will decrease the total amount of
223 SRAM available for use by application code.
224
225 If unsure, leave at the default value 0.
226
Daniel Leungd8127282021-02-24 10:18:34 -0800227menu "Linker Sections"
228
229config LINKER_USE_BOOT_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100230 bool "Use Boot Linker Section"
Daniel Leungd8127282021-02-24 10:18:34 -0800231 help
232 If enabled, the symbols which are needed for the boot process
233 will be put into another linker section reserved for these
234 symbols.
235
236 Requires that boot sections exist in the architecture, SoC,
237 board or custom linker script.
238
Daniel Leung1310ad62021-02-23 13:33:38 -0800239config LINKER_USE_PINNED_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100240 bool "Use Pinned Linker Section"
Daniel Leung1310ad62021-02-23 13:33:38 -0800241 help
242 If enabled, the symbols which need to be pinned in memory
243 will be put into another linker section reserved for pinned
244 symbols. During boot, the corresponding memory will be marked
245 as pinned.
246
247 Requires that pinned sections exist in the architecture, SoC,
248 board or custom linker script.
249
Daniel Leung6a006d72021-07-12 10:58:45 -0700250config LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT
251 bool "Generic sections are present at boot" if DEMAND_PAGING && LINKER_USE_PINNED_SECTION
252 default y
253 help
254 When disabled, the linker sections other than the boot and
255 pinned sections will be marked as not present in the page
256 tables. This allows kernel to pull in data pages on demand
257 as required by current execution context when demand paging
258 is enabled. There is no need to load all code and data into
259 memory at once.
260
261 If unsure, say Y.
262
Torsten Rasmussenc1078272022-09-27 12:34:36 +0200263config LINKER_LAST_SECTION_ID
264 bool "Last section identifier"
265 default y
266 depends on ARM || ARM64 || RISCV
267 help
268 If enabled, the last section will contain an identifier.
269 This ensures that the '_flash_used' linker symbol will always be
270 correctly calculated, even in cases where the location counter may
271 have been incremented for alignment purposes but no data is placed
272 after alignment.
273
274 Note: in cases where the flash is fully used, for example application
275 specific data is written at the end of the flash area, then writing a
276 last section identifier may cause rom region overflow.
277 In such cases this setting should be disabled.
278
279config LINKER_LAST_SECTION_ID_PATTERN
280 hex "Last section identifier pattern"
281 default "0xE015E015"
282 depends on LINKER_LAST_SECTION_ID
283 help
284 Pattern to fill into last section as identifier.
285 Default pattern is 0xE015 (end of last section), but any pattern can
286 be used.
287 The size of the pattern must not exceed 4 bytes.
288
Flavio Ceolin56ec06f2022-12-20 10:36:34 -0800289config LINKER_USE_NO_RELAX
290 bool
291 help
292 Hidden symbol to allow features to force the use of no relax.
293
294config LINKER_USE_RELAX
295 bool "Linker optimization of call addressing"
296 depends on !LINKER_USE_NO_RELAX
297 default y
298 help
299 This option performs global optimizations that become possible when the linker resolves
300 addressing in the program, such as relaxing address modes and synthesizing new
301 instructions in the output object file. For ld and lld, this enables `--relax`.
302 On platforms where this is not supported, `--relax' is accepted, but ignored.
303 Disabling it can reduce performance, as the linker is no longer able to substiture long /
304 in-effective jump calls to shorter / more effective instructions.
305
Daniel Leungd8127282021-02-24 10:18:34 -0800306endmenu # "Linker Sections"
307
Anas Nashif86ad37a2018-11-02 07:12:07 -0400308endmenu
309
310menu "Compiler Options"
311
Flavio Ceolinb587e8d2020-08-26 09:48:33 -0700312config CODING_GUIDELINE_CHECK
313 bool "Enforce coding guideline rules"
314 help
315 Use available compiler flags to check coding guideline rules during
316 the build.
317
Anas Nashif86ad37a2018-11-02 07:12:07 -0400318config NATIVE_APPLICATION
319 bool "Build as a native host application"
Keith Packard214a3c52023-02-08 13:44:39 -0800320 select FULL_LIBC_SUPPORTED
Kumar Galae268f8e2023-05-01 10:59:35 -0500321 select FULL_LIBCPP_SUPPORTED if CPP
Anas Nashif86ad37a2018-11-02 07:12:07 -0400322 help
323 Build as a native application that can run on the host and using
324 resources and libraries provided by the host.
325
Keith Packard6c5d8062023-02-08 14:56:50 -0800326config COMPILER_FREESTANDING
327 bool "Build in a freestanding compiler mode"
328 help
329 Configure the compiler to operate in freestanding mode according to
330 the C and C++ language specifications. Freestanding mode reduces the
331 requirements of the compiler and language environment, which can
332 negatively impact the ability for the compiler to detect errors and
333 perform optimizations.
334
Emil Lindqvistf7dad072021-09-03 13:52:33 +0200335choice COMPILER_OPTIMIZATIONS
Anas Nashif86ad37a2018-11-02 07:12:07 -0400336 prompt "Optimization level"
337 default NO_OPTIMIZATIONS if COVERAGE
338 default DEBUG_OPTIMIZATIONS if DEBUG
339 default SIZE_OPTIMIZATIONS
340 help
341 Note that these flags shall only control the compiler
342 optimization level, and that no extra debug code shall be
343 conditionally compiled based on them.
344
345config SIZE_OPTIMIZATIONS
346 bool "Optimize for size"
347 help
348 Compiler optimizations will be set to -Os independently of other
349 options.
350
351config SPEED_OPTIMIZATIONS
352 bool "Optimize for speed"
353 help
354 Compiler optimizations will be set to -O2 independently of other
355 options.
356
357config DEBUG_OPTIMIZATIONS
358 bool "Optimize debugging experience"
359 help
360 Compiler optimizations will be set to -Og independently of other
361 options.
362
363config NO_OPTIMIZATIONS
364 bool "Optimize nothing"
365 help
366 Compiler optimizations will be set to -O0 independently of other
367 options.
Henrik Brix Andersen26ebcee2023-03-22 10:19:40 +0100368
369 Selecting this option will likely require manual tuning of the
370 default stack sizes in order to avoid stack overflows.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400371endchoice
372
Nikolay Agishev0dec4cf2022-12-22 15:46:04 +0400373config COMPILER_WARNINGS_AS_ERRORS
374 bool "Treat warnings as errors"
375 help
376 Turn on "warning as error" toolchain flags
377
Fabio Baltieri3f8f7132023-03-29 10:11:46 +0100378config COMPILER_SAVE_TEMPS
379 bool "Save temporary object files"
380 help
381 Instruct the compiler to save the temporary intermediate files
382 permanently. These can be useful for troubleshooting build issues.
383
Gerard Marull-Paretas99ebe392023-05-05 09:58:12 +0200384config COMPILER_TRACK_MACRO_EXPANSION
385 bool "Track macro expansion"
386 default y
387 help
388 When enabled, locations of tokens across macro expansions will be
389 tracked. Disabling this option may be useful to debug long macro
390 expansion chains.
391
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400392config COMPILER_COLOR_DIAGNOSTICS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100393 bool "Colored diagnostics"
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400394 default y
395 help
396 Compiler diagnostic messages are colorized.
397
Keith Packard62bc9bf2022-04-26 19:24:11 -0700398choice COMPILER_SECURITY_FORTIFY
399 prompt "Detect buffer overflows in libc calls"
400 default FORTIFY_SOURCE_NONE if NO_OPTIMIZATIONS || MINIMAL_LIBC || NATIVE_APPLICATION
401 default FORTIFY_SOURCE_COMPILE_TIME
402 help
403 Buffer overflow checking in libc calls. Supported by Clang and
404 GCC when using Picolibc or Newlib. Requires compiler optimization
405 to be enabled.
406
407config FORTIFY_SOURCE_NONE
408 bool "No detection"
409 help
410 Disables both compile-time and run-time checking.
411
412config FORTIFY_SOURCE_COMPILE_TIME
413 bool "Compile-time detection"
414 help
415 Enables only compile-time checking. Compile-time checking
416 doesn't increase executable size or reduce performance, it
417 limits checking to what can be done with information available
418 at compile time.
419
420config FORTIFY_SOURCE_RUN_TIME
421 bool "Compile-time and run-time detection"
422 help
423 Enables both compile-time and run-time checking. Run-time
424 checking increases coverage at the expense of additional code,
425 and means that applications will raise a runtime exception
426 when buffer overflow is detected.
427
428endchoice
429
Anas Nashif86ad37a2018-11-02 07:12:07 -0400430config COMPILER_OPT
431 string "Custom compiler options"
432 help
433 This option is a free-form string that is passed to the compiler
434 when building all parts of a project (i.e. kernel).
435 The compiler options specified by this string supplement the
436 predefined set of compiler supplied by the build system,
437 and can be used to change compiler optimization, warning and error
438 messages, and so on.
439
Martí Bolívare5cc8542021-05-21 10:56:23 -0700440config MISRA_SANE
441 bool "MISRA standards compliance features"
442 help
443 Causes the source code to build in "MISRA" mode, which
444 disallows some otherwise-permitted features of the C
445 standard for safety reasons. Specifically variable length
446 arrays are not permitted (and gcc will enforce this).
447
Anas Nashif86ad37a2018-11-02 07:12:07 -0400448endmenu
449
Anas Nashif22b95a22019-11-24 11:28:38 -0500450choice
451 prompt "Error checking behavior for CHECK macro"
452 default RUNTIME_ERROR_CHECKS
453
454config ASSERT_ON_ERRORS
455 bool "Assert on all errors"
456 help
457 Assert on errors covered with the CHECK macro.
458
459config NO_RUNTIME_CHECKS
460 bool "No runtime error checks"
461 help
462 Do not do any runtime checks or asserts when using the CHECK macro.
463
464config RUNTIME_ERROR_CHECKS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100465 bool "Runtime error checks"
Anas Nashif22b95a22019-11-24 11:28:38 -0500466 help
467 Always perform runtime checks covered with the CHECK macro. This
468 option is the default and the only option used during testing.
469
470endchoice
471
Anas Nashif86ad37a2018-11-02 07:12:07 -0400472menu "Build Options"
473
474config KERNEL_BIN_NAME
475 string "The kernel binary name"
476 default "zephyr"
477 help
478 This option sets the name of the generated kernel binary.
479
480config OUTPUT_STAT
481 bool "Create a statistics file"
482 default y
483 help
484 Create a stat file using readelf -e <elf>
485
Anas Nashif47a673f2022-06-27 10:08:37 -0400486config OUTPUT_SYMBOLS
487 bool "Create a symbol file"
488 help
489 Create a symbol file using nm <elf>
490
Anas Nashif86ad37a2018-11-02 07:12:07 -0400491config OUTPUT_DISASSEMBLY
492 bool "Create a disassembly file"
493 default y
494 help
495 Create an .lst file with the assembly listing of the firmware.
496
Rohit Gujarathi35713f22020-05-07 10:08:37 +0530497config OUTPUT_DISASSEMBLE_ALL
498 bool "Disassemble all sections with source. Fill zeros."
499 default n
500 depends on OUTPUT_DISASSEMBLY
501 help
502 The .lst file will contain complete disassembly of the firmware
503 not just those expected to contain instructions including zeros
504
Anas Nashif86ad37a2018-11-02 07:12:07 -0400505config OUTPUT_PRINT_MEMORY_USAGE
506 bool "Print memory usage to stdout"
507 default y
508 help
509 If the toolchain supports it, this option will pass
510 --print-memory-region to the linker when it is doing it's first
511 linker pass. Note that the memory regions are symbolic concepts
512 defined by the linker scripts and do not necessarily map
513 directly to the real physical address space. Take also note that
514 some platforms do two passes of the linker so the results do not
515 match exactly to the final elf file. See also rom_report,
516 ram_report and
517 https://sourceware.org/binutils/docs/ld/MEMORY.html
518
Anas Nashiffdbf2db2020-10-20 14:31:56 -0400519config CLEANUP_INTERMEDIATE_FILES
520 bool "Remove all intermediate files"
521 help
522 Delete intermediate files to save space and cleanup clutter resulting
523 from the build process.
524
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700525config BUILD_NO_GAP_FILL
526 bool "Don't fill gaps in generated hex/bin/s19 files."
527
Anas Nashif86ad37a2018-11-02 07:12:07 -0400528config BUILD_OUTPUT_HEX
529 bool "Build a binary in HEX format"
530 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700531 Build an Intel HEX binary zephyr/zephyr.hex in the build directory.
532 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400533
534config BUILD_OUTPUT_BIN
535 bool "Build a binary in BIN format"
536 default y
537 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700538 Build a "raw" binary zephyr/zephyr.bin in the build directory.
539 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400540
Anas Nashif51c34bb2021-01-26 06:58:30 -0500541config BUILD_OUTPUT_EFI
542 bool "Build as an EFI application"
543 default n
544 depends on X86_64
545 help
546 Build as an EFI application.
547
548 This works by creating a "zephyr.efi" EFI binary containing a zephyr
549 image extracted from a built zephyr.elf file. EFI applications are
550 relocatable, and cannot be placed at specific locations in memory.
551 Instead, the stub code will copy the embedded zephyr sections to the
552 appropriate locations at startup, clear any zero-filled (BSS, etc...)
553 areas, then jump into the 64 bit entry point.
554
Anas Nashif86ad37a2018-11-02 07:12:07 -0400555config BUILD_OUTPUT_EXE
556 bool "Build a binary in ELF format with .exe extension"
557 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700558 Build an ELF binary that can run in the host system at
559 zephyr/zephyr.exe in the build directory.
560 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400561
562config BUILD_OUTPUT_S19
563 bool "Build a binary in S19 format"
564 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700565 Build an S19 binary zephyr/zephyr.s19 in the build directory.
566 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Håkon Øye Amundsenc086b932018-11-26 09:47:16 +0000567
Pete Johanson310a4642020-12-31 16:51:52 -0500568config BUILD_OUTPUT_UF2
569 bool "Build a binary in UF2 format"
570 depends on BUILD_OUTPUT_BIN
571 help
572 Build a UF2 binary zephyr/zephyr.uf2 in the build directory.
573 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
574
575if BUILD_OUTPUT_UF2
576
577config BUILD_OUTPUT_UF2_FAMILY_ID
Pete Johansonff01a002021-02-16 09:35:11 -0500578 string "UF2 device family ID"
579 default "0x1c5f21b0" if SOC_ESP32
Xudong Zheng8db98692022-03-22 12:15:50 -0400580 default "0x621e937a" if SOC_NRF52833_QIAA
Pete Johansonff01a002021-02-16 09:35:11 -0500581 default "0xada52840" if SOC_NRF52840_QIAA
582 default "0x4fb2d5bd" if SOC_SERIES_IMX_RT
583 default "0x2abc77ec" if SOC_SERIES_LPC55XXX
Yonatan Schachterefa170f2022-02-01 23:05:04 +0200584 default "0xe48bff56" if SOC_SERIES_RP2XXX
Pete Johansonff01a002021-02-16 09:35:11 -0500585 default "0x68ed2b88" if SOC_SERIES_SAMD21
586 default "0x55114460" if SOC_SERIES_SAMD51
587 default "0x647824b6" if SOC_SERIES_STM32F0X
588 default "0x5d1a0a2e" if SOC_SERIES_STM32F2X
589 default "0x6b846188" if SOC_SERIES_STM32F3X
590 default "0x53b80f00" if SOC_SERIES_STM32F7X
591 default "0x300f5633" if SOC_SERIES_STM32G0X
592 default "0x4c71240a" if SOC_SERIES_STM32G4X
593 default "0x6db66082" if SOC_SERIES_STM32H7X
594 default "0x202e3a91" if SOC_SERIES_STM32L0X
595 default "0x1e1f432d" if SOC_SERIES_STM32L1X
596 default "0x00ff6919" if SOC_SERIES_STM32L4X
597 default "0x04240bdf" if SOC_SERIES_STM32L5X
598 default "0x70d16653" if SOC_SERIES_STM32WBX
599 default "0x5ee21072" if SOC_STM32F103XE
Guillaume Gautier3d423222022-12-21 14:44:45 +0100600 default "0x57755a57" if SOC_SERIES_STM32F4X && (!SOC_STM32F407XE) && (!SOC_STM32F407XG)
Pete Johansonff01a002021-02-16 09:35:11 -0500601 default "0x6d0922fa" if SOC_STM32F407XE
602 default "0x8fb060fe" if SOC_STM32F407XG
Pete Johanson310a4642020-12-31 16:51:52 -0500603 help
604 UF2 bootloaders only accept UF2 files with a matching family ID.
605 This can be either a hex, e.g. 0x68ed2b88, or well-known family
Pete Johansonff01a002021-02-16 09:35:11 -0500606 name string. If the SoC in use is known by UF2, the Family ID will
607 be pre-filled with the known value.
Pete Johanson310a4642020-12-31 16:51:52 -0500608
Peter Johanson3f332072022-01-27 00:45:27 -0500609config BUILD_OUTPUT_UF2_USE_FLASH_BASE
610 bool
611 default n
612
613config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET
614 bool
615 default n
616
Pete Johanson310a4642020-12-31 16:51:52 -0500617endif # BUILD_OUTPUT_UF2
618
Anas Nashif86ad37a2018-11-02 07:12:07 -0400619config BUILD_OUTPUT_STRIPPED
620 bool "Build a stripped binary"
621 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700622 Build a stripped binary zephyr/zephyr.strip in the build directory.
623 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400624
Torsten Rasmussend51a67b2022-01-12 14:21:07 +0100625config BUILD_OUTPUT_ADJUST_LMA
626 string
627 help
628 This will adjust the LMA address in the final ELF and hex files with
629 the value provided.
630 This will not affect the internal address symbols inside the image but
631 can be useful when adjusting the LMA address for flash tools or multi
632 stage loaders where a pre-loader may copy image to a second location
633 before booting a second core.
634 The value will be evaluated as a math expression, this means that
635 following are valid expression
636 - 1024
637 - 0x1000
638 - -0x1000
639 - 0x20000000 - 0x10000000
640 Note: negative numbers are valid.
641 To adjust according to a chosen flash partition one can specify a
642 default as:
643 DT_CHOSEN_IMAGE_<name> := <name>,<name>-partition
644 DT_CHOSEN_Z_FLASH := zephyr,flash
645 config BUILD_OUTPUT_ADJUST_LMA
646 default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_IMAGE_M4))-\
647 $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))"
648
Torsten Rasmussenc8ddc342022-01-10 11:02:26 +0100649config BUILD_OUTPUT_INFO_HEADER
650 bool "Create a image information header"
651 help
652 Create an image information header which will contain image
653 information from the Zephyr binary.
654 Example of information contained in the header file:
655 - Number of segments in the image
656 - LMA address of each segment
657 - VMA address of each segment
658 - Size of each segment
659
Anas Nashif86ad37a2018-11-02 07:12:07 -0400660config APPLICATION_DEFINED_SYSCALL
661 bool "Scan application folder for any syscall definition"
662 help
663 Scan additional folders inside application source folder
664 for application defined syscalls.
665
Sebastian Bøed3a8fd42019-10-17 14:25:34 +0200666config MAKEFILE_EXPORTS
667 bool "Generate build metadata files named Makefile.exports"
668 help
669 Generates a file with build information that can be read by
670 third party Makefile-based build systems.
671
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200672config BUILD_OUTPUT_META
673 bool "Create a build meta file"
674 help
675 Create a build meta file in the build directory containing lists of:
676 - Zephyr: path and revision (if git repo)
677 - Zephyr modules: name, path, and revision (if git repo)
Torsten Rasmussen64ec6ee2021-11-04 14:28:21 +0100678 - West:
679 - manifest: path and revision
680 - projects: path and revision
681 - Workspace:
682 - dirty: one or more repositories are marked dirty
683 - extra: extra Zephyr modules are manually included in the build
684 - off: the SHA of one or more west projects are not what the manifest
685 defined when `west update` was run the last time (`manifest-rev`).
686 The off state is only present if a west workspace is found.
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200687 File extension is .meta
688
Torsten Rasmussen1a519932021-11-04 18:35:50 +0100689config BUILD_OUTPUT_META_STATE_PROPAGATE
690 bool "Propagate module and project state"
691 depends on BUILD_OUTPUT_META
692 help
693 Propagate to state of each module to the Zephyr revision field.
694 If west is used the state of each west project is also propagated to
695 the Zephyr revision field.
696 West manifest repo revision field will also
697 be marked with the same state as the Zephyr revision.
698 The final revision will become: <SHA>-<state1>-<state2>-<state3>...
699 If no states are appended to the SHA it means the build is of a clean
700 tree.
701 - dirty: one or more repositories are marked dirty
702 - extra: extra Zephyr modules are manually included in the build
703 - off: the SHA of one or more west projects are not what the manifest
704 defined when `west update` was run the last time (`manifest-rev`).
705 The off state is only present if a west workspace is found.
706
Martin Jägera0ffaa72023-03-29 16:06:30 +0200707config BUILD_OUTPUT_STRIP_PATHS
708 bool "Strip absolute paths from binaries"
709 default y
710 help
711 If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the
712 __FILE__ macro used in __ASSERT*, in the
713 .noinit."/home/joe/zephyr/fu/bar.c" section names and in any
714 application code.
715 This saves some memory, stops leaking user locations in binaries, makes
716 failure logs more deterministic and most importantly makes builds more
717 deterministic.
718 Debuggers usually have a path mapping feature to ensure the files are
719 still found.
720
Anas Nashif86ad37a2018-11-02 07:12:07 -0400721endmenu
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100722
Torsten Rasmussen6066ab42022-07-15 12:05:04 +0200723config DEPRECATED
724 bool
725 help
726 Symbol that must be selected by a feature or module if it is
727 considered to be deprecated.
728
729config WARN_DEPRECATED
730 bool
731 default y
732 prompt "Warn on deprecated usage"
733 help
734 Print a warning when the Kconfig tree is parsed if any deprecated
735 features are enabled.
736
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100737config EXPERIMENTAL
738 bool
739 help
740 Symbol that must be selected by a feature if it is considered to be
741 at an experimental implementation stage.
742
743config WARN_EXPERIMENTAL
744 bool
745 prompt "Warn on experimental usage"
746 help
747 Print a warning when the Kconfig tree is parsed if any experimental
748 features are enabled.
749
Carles Cufid800ccc2022-08-22 18:38:16 +0200750config TAINT
751 bool
752 help
753 Symbol that must be selected by a feature or module if the Zephyr
754 build is considered tainted.
755
Nicolas Pitre0a386db2022-06-20 13:18:14 -0400756config ENFORCE_ZEPHYR_STDINT
757 bool
758 prompt "Enforce Zephyr convention for stdint"
759 depends on !ARCH_POSIX
760 default y
761 help
762 This enforces the Zephyr stdint convention where int32_t = int,
763 int64_t = long long, and intptr_t = long so that short string
764 format length modifiers can be used universally across ILP32
765 and LP64 architectures. Sometimes this is not possible e.g. when
766 linking against a binary-only C++ library whose type mangling
767 is incompatible with the Zephyr convention, or if the build
768 environment doesn't allow such enforcement, in which case this
769 should be turned off with the caveat that argument type validation
770 on Zephyr code will be skipped.
771
Anas Nashif86ad37a2018-11-02 07:12:07 -0400772endmenu
773
774
775menu "Boot Options"
776
777config IS_BOOTLOADER
778 bool "Act as a bootloader"
779 depends on XIP
780 depends on ARM
781 help
782 This option indicates that Zephyr will act as a bootloader to execute
783 a separate Zephyr image payload.
784
785config BOOTLOADER_SRAM_SIZE
786 int "SRAM reserved for bootloader"
787 default 16
788 depends on !XIP || IS_BOOTLOADER
Rajavardhan Gundie584b052018-12-14 16:55:43 +0530789 depends on ARM || XTENSA
Anas Nashif86ad37a2018-11-02 07:12:07 -0400790 help
791 This option specifies the amount of SRAM (measure in kB) reserved for
792 a bootloader image, when either:
793 - the Zephyr image itself is to act as the bootloader, or
794 - Zephyr is a !XIP image, which implicitly assumes existence of a
795 bootloader that loads the Zephyr !XIP image onto SRAM.
796
Dominik Ermel865f8012023-05-11 11:47:21 +0000797source "Kconfig.mcuboot"
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700798
Anas Nashif86ad37a2018-11-02 07:12:07 -0400799config BOOTLOADER_ESP_IDF
800 bool "ESP-IDF bootloader support"
Sylvio Alves839b97e2023-01-02 09:16:46 -0300801 depends on (SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3 || SOC_ESP32S3) && !BOOTLOADER_MCUBOOT
Sylvio Alves16571db2021-11-27 16:32:00 -0300802 default y
Anas Nashif86ad37a2018-11-02 07:12:07 -0400803 help
804 This option will trigger the compilation of the ESP-IDF bootloader
805 inside the build folder.
806 At flash time, the bootloader will be flashed with the zephyr image
807
Michael Hope8c1f1862020-06-13 21:32:11 +0200808config BOOTLOADER_BOSSA
809 bool "BOSSA bootloader support"
810 select USE_DT_CODE_PARTITION
Michael Hope8c1f1862020-06-13 21:32:11 +0200811
812 help
813 Signifies that the target uses a BOSSA compatible bootloader. If CDC
814 ACM USB support is also enabled then the board will reboot into the
815 bootloader automatically when bossac is run.
816
817config BOOTLOADER_BOSSA_DEVICE_NAME
818 string "BOSSA CDC ACM device name"
819 depends on BOOTLOADER_BOSSA && CDC_ACM_DTE_RATE_CALLBACK_SUPPORT
820 default "CDC_ACM_0"
821 help
822 Sets the CDC ACM port to watch for reboot commands.
823
824choice
825 prompt "BOSSA bootloader variant"
826 depends on BOOTLOADER_BOSSA
827
Gerson Fernando Budkef3a7f042021-05-06 21:20:11 -0300828config BOOTLOADER_BOSSA_LEGACY
829 bool "Legacy"
830 help
831 Select the Legacy variant of the BOSSA bootloader. This is defined
832 for compatibility mode only. The recommendation is use newer
833 versions like Arduino or Adafruit UF2.
834
Michael Hope8c1f1862020-06-13 21:32:11 +0200835config BOOTLOADER_BOSSA_ARDUINO
836 bool "Arduino"
837 help
838 Select the Arduino variant of the BOSSA bootloader. Uses 0x07738135
839 as the magic value to enter the bootloader.
840
841config BOOTLOADER_BOSSA_ADAFRUIT_UF2
842 bool "Adafruit UF2"
843 help
844 Select the Adafruit UF2 variant of the BOSSA bootloader. Uses
845 0xf01669ef as the magic value to enter the bootloader.
846
847endchoice
848
Anas Nashif86ad37a2018-11-02 07:12:07 -0400849endmenu
Carlo Caioned048faa2019-12-17 17:13:47 +0000850
851menu "Compatibility"
852
853config COMPAT_INCLUDES
854 bool "Suppress warnings when using header shims"
855 default y
856 help
857 Suppress any warnings from the pre-processor when including
858 deprecated header files.
859
860endmenu