blob: fa25bb981b4e8f6a38dd590693252853e24014f3 [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
David B. Kinderac74d8b2017-01-18 17:01:01 -08005# SPDX-License-Identifier: Apache-2.0
Sebastian Bøe4b61bd12018-01-09 14:12:07 +01006
Anas Nashif658f6bc2019-05-28 14:22:51 -04007
Ulf Magnussone63b6522020-01-26 23:47:41 +01008# Include Kconfig.defconfig files first so that they can override defaults and
9# other symbol/choice properties by adding extra symbol/choice definitions.
10# After merging all definitions for a symbol/choice, Kconfig picks the first
11# property (e.g. the first default) with a satisfied condition.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020012#
Ulf Magnussone63b6522020-01-26 23:47:41 +010013# Shield defaults should have precedence over board defaults, which should have
14# precedence over SoC defaults, so include them in that order.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020015#
Ulf Magnussone63b6522020-01-26 23:47:41 +010016# $ARCH and $BOARD_DIR will be glob patterns when building documentation.
Torsten Rasmussen6be1b2a2021-06-02 08:47:21 +020017# This loads custom shields defconfigs (from BOARD_ROOT)
18osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig"
19# This loads Zephyr base shield defconfigs
20source "boards/shields/*/Kconfig.defconfig"
21
Ulf Magnussond7130332018-09-05 13:10:19 +020022source "$(BOARD_DIR)/Kconfig.defconfig"
Torsten Rasmussen6be1b2a2021-06-02 08:47:21 +020023
24# This loads custom SoC root defconfigs
25osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig"
26# This loads Zephyr base SoC root defconfigs
27osource "soc/$(ARCH)/*/Kconfig.defconfig"
Torsten Rasmussen36bb00d2021-08-15 23:14:21 +020028# This loads the toolchain defconfigs
29osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig.defconfig"
Krzysztof Chruscinski2735a3a2022-09-06 12:50:10 +020030# This loads the testsuite defconfig
31source "subsys/testsuite/Kconfig.defconfig"
Ulf Magnussonec3eff52018-07-30 10:57:47 +020032
Kumar Gala52a3ec92022-08-12 10:00:38 -050033# This should be early since the autogen Kconfig.dts symbols may get
34# used by modules
35source "dts/Kconfig"
36
Ioannis Glaropoulosc5203852020-12-07 18:42:52 +010037menu "Modules"
38
Ioannis Glaropoulosc5203852020-12-07 18:42:52 +010039source "modules/Kconfig"
40
41endmenu
42
Anas Nashifabcf2ad2018-09-04 08:32:07 -050043source "boards/Kconfig"
Torsten Rasmussen5f7cc8d2020-07-06 12:53:39 +020044source "soc/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040045source "arch/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040046source "kernel/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040047source "drivers/Kconfig"
Anas Nashif0b2c44a2016-05-14 23:10:51 -040048source "lib/Kconfig"
Ramesh Thomase354ad22016-10-29 04:10:36 -070049source "subsys/Kconfig"
Kumar Gala7584a122016-05-24 14:23:26 -050050
Kumar Gala2630fba2020-01-24 09:39:40 -060051osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig"
Anas Nashif8017c592019-05-23 17:19:41 -040052
Anas Nashif86ad37a2018-11-02 07:12:07 -040053menu "Build and Link Features"
54
55menu "Linker Options"
56
Daniel Leung6600c642018-10-19 10:15:19 -070057choice
58 prompt "Linker Orphan Section Handling"
59 default LINKER_ORPHAN_SECTION_WARN
60
61config LINKER_ORPHAN_SECTION_PLACE
62 bool "Place"
63 help
64 Linker puts orphan sections in place without warnings
65 or errors.
66
67config LINKER_ORPHAN_SECTION_WARN
68 bool "Warn"
69 help
Anas Nashiff2cb20c2019-06-18 14:45:40 -040070 Linker places the orphan sections in output and issues
Daniel Leung6600c642018-10-19 10:15:19 -070071 warning about those sections.
72
73config LINKER_ORPHAN_SECTION_ERROR
74 bool "Error"
75 help
76 Linker exits with error when an orphan section is found.
77
78endchoice
Anas Nashif86ad37a2018-11-02 07:12:07 -040079
80config HAS_FLASH_LOAD_OFFSET
81 bool
82 help
83 This option is selected by targets having a FLASH_LOAD_OFFSET
84 and FLASH_LOAD_SIZE.
85
Ulf Magnussonfd9981a2019-11-16 01:33:09 +010086if HAS_FLASH_LOAD_OFFSET
87
Ulf Magnusson90b9eb32019-11-16 01:22:16 +010088config USE_DT_CODE_PARTITION
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010089 bool "Link application into /chosen/zephyr,code-partition from devicetree"
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010090 help
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010091 When enabled, the application will be linked into the flash partition
92 selected by the zephyr,code-partition property in /chosen in devicetree.
93 When this is disabled, the flash load offset and size can be set manually
94 below.
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010095
Kumar Gala8ce0cf02019-08-28 09:29:26 -050096# Workaround for not being able to have commas in macro arguments
97DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
98
Anas Nashif86ad37a2018-11-02 07:12:07 -040099config FLASH_LOAD_OFFSET
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100100 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
101 hex "Kernel load offset" if !USE_DT_CODE_PARTITION
102 default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400103 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400104 help
105 This option specifies the byte offset from the beginning of flash that
106 the kernel should be loaded into. Changing this value from zero will
107 affect the Zephyr image's link, and will decrease the total amount of
108 flash available for use by application code.
109
110 If unsure, leave at the default value 0.
111
112config FLASH_LOAD_SIZE
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100113 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
114 hex "Kernel load size" if !USE_DT_CODE_PARTITION
115 default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400116 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400117 help
118 If non-zero, this option specifies the size, in bytes, of the flash
119 area that the Zephyr image will be allowed to occupy. If zero, the
120 image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
121 the device.
122
123 If unsure, leave at the default value 0.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400124
Ulf Magnussonfd9981a2019-11-16 01:33:09 +0100125endif # HAS_FLASH_LOAD_OFFSET
126
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900127config ROM_START_OFFSET
Ole Sæther985446a2019-01-23 14:13:03 +0100128 hex
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900129 prompt "ROM start offset" if !BOOTLOADER_MCUBOOT
Anas Nashif86ad37a2018-11-02 07:12:07 -0400130 default 0x200 if BOOTLOADER_MCUBOOT
131 default 0
132 help
133 If the application is built for chain-loading by a bootloader this
134 variable is required to be set to value that leaves sufficient
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900135 space between the beginning of the image and the start of the first
Anas Nashif86ad37a2018-11-02 07:12:07 -0400136 section to store an image header or any other metadata.
137 In the particular case of the MCUboot bootloader this reserves enough
138 space to store the image header, which should also meet vector table
139 alignment requirements on most ARM targets, although some targets
140 may require smaller or larger values.
141
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200142config LD_LINKER_SCRIPT_SUPPORTED
143 bool
144 default y
145
146choice LINKER_SCRIPT
147 prompt "Linker script"
148 default LD_LINKER_TEMPLATE if LD_LINKER_SCRIPT_SUPPORTED
149
150config LD_LINKER_TEMPLATE
151 bool "LD template"
152 depends on LD_LINKER_SCRIPT_SUPPORTED
153 help
154 Select this option to use the LD linker script templates.
155 The templates are pre-processed by the C pre-processor to create the
156 final LD linker script.
157
158config CMAKE_LINKER_GENERATOR
159 bool "CMake generator"
160 depends on ARM
161 help
162 Select this option to use the Zephyr CMake linker script generator.
163 The linker configuration is written in CMake and the final linker
164 script will be generated by the toolchain specific linker generator.
165 For LD based linkers, this will be the ld generator, for ARMClang /
166 armlink based linkers it will be the scatter generator.
167
168endchoice
169
Anas Nashif86ad37a2018-11-02 07:12:07 -0400170config HAVE_CUSTOM_LINKER_SCRIPT
Torsten Rasmussen761eada2021-06-09 11:22:07 +0200171 bool "Custom linker script provided"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400172 help
173 Set this option if you have a custom linker script which needed to
174 be define in CUSTOM_LINKER_SCRIPT.
175
176config CUSTOM_LINKER_SCRIPT
177 string "Path to custom linker script"
178 depends on HAVE_CUSTOM_LINKER_SCRIPT
179 help
180 Path to the linker script to be used instead of the one define by the
181 board.
182
183 The linker script must be based on a version provided by Zephyr since
184 the kernel can expect a certain layout/certain regions.
185
186 This is useful when an application needs to add sections into the
187 linker script and avoid having to change the script provided by
188 Zephyr.
189
Anas Nashif86ad37a2018-11-02 07:12:07 -0400190config KERNEL_ENTRY
191 string "Kernel entry symbol"
192 default "__start"
193 help
194 Code entry symbol, to be set at linking phase.
195
Sebastian Bøe3a0597f2019-03-15 14:05:09 +0100196config LINKER_SORT_BY_ALIGNMENT
197 bool "Sort input sections by alignment"
198 default y
199 help
200 This turns on the linker flag to sort sections by alignment
201 in decreasing size of symbols. This helps to minimize
202 padding between symbols.
203
Jordan Yates318ee972021-04-17 20:04:33 +1000204config SRAM_VECTOR_TABLE
205 bool "Place the vector table in SRAM instead of flash"
206 help
207 The option specifies that the vector table should be placed at the
208 start of SRAM instead of the start of flash.
209
Daniel Leungece9cad2021-02-20 11:02:17 -0800210config HAS_SRAM_OFFSET
211 bool
212 help
213 This option is selected by targets that require SRAM_OFFSET.
214
215config SRAM_OFFSET
216 hex "Kernel SRAM offset" if HAS_SRAM_OFFSET
217 default 0
218 help
219 This option specifies the byte offset from the beginning of SRAM
220 where the kernel begins. Changing this value from zero will affect
221 the Zephyr image's link, and will decrease the total amount of
222 SRAM available for use by application code.
223
224 If unsure, leave at the default value 0.
225
Daniel Leungd8127282021-02-24 10:18:34 -0800226menu "Linker Sections"
227
228config LINKER_USE_BOOT_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100229 bool "Use Boot Linker Section"
Daniel Leungd8127282021-02-24 10:18:34 -0800230 help
231 If enabled, the symbols which are needed for the boot process
232 will be put into another linker section reserved for these
233 symbols.
234
235 Requires that boot sections exist in the architecture, SoC,
236 board or custom linker script.
237
Daniel Leung1310ad62021-02-23 13:33:38 -0800238config LINKER_USE_PINNED_SECTION
Gerard Marull-Paretasdffaf532022-03-09 12:31:16 +0100239 bool "Use Pinned Linker Section"
Daniel Leung1310ad62021-02-23 13:33:38 -0800240 help
241 If enabled, the symbols which need to be pinned in memory
242 will be put into another linker section reserved for pinned
243 symbols. During boot, the corresponding memory will be marked
244 as pinned.
245
246 Requires that pinned sections exist in the architecture, SoC,
247 board or custom linker script.
248
Daniel Leung6a006d72021-07-12 10:58:45 -0700249config LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT
250 bool "Generic sections are present at boot" if DEMAND_PAGING && LINKER_USE_PINNED_SECTION
251 default y
252 help
253 When disabled, the linker sections other than the boot and
254 pinned sections will be marked as not present in the page
255 tables. This allows kernel to pull in data pages on demand
256 as required by current execution context when demand paging
257 is enabled. There is no need to load all code and data into
258 memory at once.
259
260 If unsure, say Y.
261
Torsten Rasmussenc1078272022-09-27 12:34:36 +0200262config LINKER_LAST_SECTION_ID
263 bool "Last section identifier"
264 default y
265 depends on ARM || ARM64 || RISCV
266 help
267 If enabled, the last section will contain an identifier.
268 This ensures that the '_flash_used' linker symbol will always be
269 correctly calculated, even in cases where the location counter may
270 have been incremented for alignment purposes but no data is placed
271 after alignment.
272
273 Note: in cases where the flash is fully used, for example application
274 specific data is written at the end of the flash area, then writing a
275 last section identifier may cause rom region overflow.
276 In such cases this setting should be disabled.
277
278config LINKER_LAST_SECTION_ID_PATTERN
279 hex "Last section identifier pattern"
280 default "0xE015E015"
281 depends on LINKER_LAST_SECTION_ID
282 help
283 Pattern to fill into last section as identifier.
284 Default pattern is 0xE015 (end of last section), but any pattern can
285 be used.
286 The size of the pattern must not exceed 4 bytes.
287
Flavio Ceolin56ec06f2022-12-20 10:36:34 -0800288config LINKER_USE_NO_RELAX
289 bool
290 help
291 Hidden symbol to allow features to force the use of no relax.
292
293config LINKER_USE_RELAX
294 bool "Linker optimization of call addressing"
295 depends on !LINKER_USE_NO_RELAX
296 default y
297 help
298 This option performs global optimizations that become possible when the linker resolves
299 addressing in the program, such as relaxing address modes and synthesizing new
300 instructions in the output object file. For ld and lld, this enables `--relax`.
301 On platforms where this is not supported, `--relax' is accepted, but ignored.
302 Disabling it can reduce performance, as the linker is no longer able to substiture long /
303 in-effective jump calls to shorter / more effective instructions.
304
Daniel Leungd8127282021-02-24 10:18:34 -0800305endmenu # "Linker Sections"
306
Anas Nashif86ad37a2018-11-02 07:12:07 -0400307endmenu
308
309menu "Compiler Options"
310
Flavio Ceolinb587e8d2020-08-26 09:48:33 -0700311config CODING_GUIDELINE_CHECK
312 bool "Enforce coding guideline rules"
313 help
314 Use available compiler flags to check coding guideline rules during
315 the build.
316
Anas Nashif86ad37a2018-11-02 07:12:07 -0400317config NATIVE_APPLICATION
318 bool "Build as a native host application"
Keith Packard214a3c52023-02-08 13:44:39 -0800319 select FULL_LIBC_SUPPORTED
Kumar Galae268f8e2023-05-01 10:59:35 -0500320 select FULL_LIBCPP_SUPPORTED if CPP
Anas Nashif86ad37a2018-11-02 07:12:07 -0400321 help
322 Build as a native application that can run on the host and using
323 resources and libraries provided by the host.
324
Keith Packard6c5d8062023-02-08 14:56:50 -0800325config COMPILER_FREESTANDING
326 bool "Build in a freestanding compiler mode"
327 help
328 Configure the compiler to operate in freestanding mode according to
329 the C and C++ language specifications. Freestanding mode reduces the
330 requirements of the compiler and language environment, which can
331 negatively impact the ability for the compiler to detect errors and
332 perform optimizations.
333
Emil Lindqvistf7dad072021-09-03 13:52:33 +0200334choice COMPILER_OPTIMIZATIONS
Anas Nashif86ad37a2018-11-02 07:12:07 -0400335 prompt "Optimization level"
336 default NO_OPTIMIZATIONS if COVERAGE
337 default DEBUG_OPTIMIZATIONS if DEBUG
338 default SIZE_OPTIMIZATIONS
339 help
340 Note that these flags shall only control the compiler
341 optimization level, and that no extra debug code shall be
342 conditionally compiled based on them.
343
344config SIZE_OPTIMIZATIONS
345 bool "Optimize for size"
346 help
347 Compiler optimizations will be set to -Os independently of other
348 options.
349
350config SPEED_OPTIMIZATIONS
351 bool "Optimize for speed"
352 help
353 Compiler optimizations will be set to -O2 independently of other
354 options.
355
356config DEBUG_OPTIMIZATIONS
357 bool "Optimize debugging experience"
358 help
359 Compiler optimizations will be set to -Og independently of other
360 options.
361
362config NO_OPTIMIZATIONS
363 bool "Optimize nothing"
364 help
365 Compiler optimizations will be set to -O0 independently of other
366 options.
Henrik Brix Andersen26ebcee2023-03-22 10:19:40 +0100367
368 Selecting this option will likely require manual tuning of the
369 default stack sizes in order to avoid stack overflows.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400370endchoice
371
Nikolay Agishev0dec4cf2022-12-22 15:46:04 +0400372config COMPILER_WARNINGS_AS_ERRORS
373 bool "Treat warnings as errors"
374 help
375 Turn on "warning as error" toolchain flags
376
Fabio Baltieri3f8f7132023-03-29 10:11:46 +0100377config COMPILER_SAVE_TEMPS
378 bool "Save temporary object files"
379 help
380 Instruct the compiler to save the temporary intermediate files
381 permanently. These can be useful for troubleshooting build issues.
382
Gerard Marull-Paretas99ebe392023-05-05 09:58:12 +0200383config COMPILER_TRACK_MACRO_EXPANSION
384 bool "Track macro expansion"
385 default y
386 help
387 When enabled, locations of tokens across macro expansions will be
388 tracked. Disabling this option may be useful to debug long macro
389 expansion chains.
390
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400391config COMPILER_COLOR_DIAGNOSTICS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100392 bool "Colored diagnostics"
Arvin Farahmande430b7b2021-04-15 11:20:10 -0400393 default y
394 help
395 Compiler diagnostic messages are colorized.
396
Keith Packard62bc9bf2022-04-26 19:24:11 -0700397choice COMPILER_SECURITY_FORTIFY
398 prompt "Detect buffer overflows in libc calls"
399 default FORTIFY_SOURCE_NONE if NO_OPTIMIZATIONS || MINIMAL_LIBC || NATIVE_APPLICATION
400 default FORTIFY_SOURCE_COMPILE_TIME
401 help
402 Buffer overflow checking in libc calls. Supported by Clang and
403 GCC when using Picolibc or Newlib. Requires compiler optimization
404 to be enabled.
405
406config FORTIFY_SOURCE_NONE
407 bool "No detection"
408 help
409 Disables both compile-time and run-time checking.
410
411config FORTIFY_SOURCE_COMPILE_TIME
412 bool "Compile-time detection"
413 help
414 Enables only compile-time checking. Compile-time checking
415 doesn't increase executable size or reduce performance, it
416 limits checking to what can be done with information available
417 at compile time.
418
419config FORTIFY_SOURCE_RUN_TIME
420 bool "Compile-time and run-time detection"
421 help
422 Enables both compile-time and run-time checking. Run-time
423 checking increases coverage at the expense of additional code,
424 and means that applications will raise a runtime exception
425 when buffer overflow is detected.
426
427endchoice
428
Anas Nashif86ad37a2018-11-02 07:12:07 -0400429config COMPILER_OPT
430 string "Custom compiler options"
431 help
432 This option is a free-form string that is passed to the compiler
433 when building all parts of a project (i.e. kernel).
434 The compiler options specified by this string supplement the
435 predefined set of compiler supplied by the build system,
436 and can be used to change compiler optimization, warning and error
437 messages, and so on.
438
Martí Bolívare5cc8542021-05-21 10:56:23 -0700439config MISRA_SANE
440 bool "MISRA standards compliance features"
441 help
442 Causes the source code to build in "MISRA" mode, which
443 disallows some otherwise-permitted features of the C
444 standard for safety reasons. Specifically variable length
445 arrays are not permitted (and gcc will enforce this).
446
Anas Nashif86ad37a2018-11-02 07:12:07 -0400447endmenu
448
Anas Nashif22b95a22019-11-24 11:28:38 -0500449choice
450 prompt "Error checking behavior for CHECK macro"
451 default RUNTIME_ERROR_CHECKS
452
453config ASSERT_ON_ERRORS
454 bool "Assert on all errors"
455 help
456 Assert on errors covered with the CHECK macro.
457
458config NO_RUNTIME_CHECKS
459 bool "No runtime error checks"
460 help
461 Do not do any runtime checks or asserts when using the CHECK macro.
462
463config RUNTIME_ERROR_CHECKS
Gerard Marull-Paretas95fb0de2022-03-09 12:05:12 +0100464 bool "Runtime error checks"
Anas Nashif22b95a22019-11-24 11:28:38 -0500465 help
466 Always perform runtime checks covered with the CHECK macro. This
467 option is the default and the only option used during testing.
468
469endchoice
470
Anas Nashif86ad37a2018-11-02 07:12:07 -0400471menu "Build Options"
472
473config KERNEL_BIN_NAME
474 string "The kernel binary name"
475 default "zephyr"
476 help
477 This option sets the name of the generated kernel binary.
478
479config OUTPUT_STAT
480 bool "Create a statistics file"
481 default y
482 help
483 Create a stat file using readelf -e <elf>
484
Anas Nashif47a673f2022-06-27 10:08:37 -0400485config OUTPUT_SYMBOLS
486 bool "Create a symbol file"
487 help
488 Create a symbol file using nm <elf>
489
Anas Nashif86ad37a2018-11-02 07:12:07 -0400490config OUTPUT_DISASSEMBLY
491 bool "Create a disassembly file"
492 default y
493 help
494 Create an .lst file with the assembly listing of the firmware.
495
Rohit Gujarathi35713f22020-05-07 10:08:37 +0530496config OUTPUT_DISASSEMBLE_ALL
497 bool "Disassemble all sections with source. Fill zeros."
498 default n
499 depends on OUTPUT_DISASSEMBLY
500 help
501 The .lst file will contain complete disassembly of the firmware
502 not just those expected to contain instructions including zeros
503
Anas Nashif86ad37a2018-11-02 07:12:07 -0400504config OUTPUT_PRINT_MEMORY_USAGE
505 bool "Print memory usage to stdout"
506 default y
507 help
508 If the toolchain supports it, this option will pass
509 --print-memory-region to the linker when it is doing it's first
510 linker pass. Note that the memory regions are symbolic concepts
511 defined by the linker scripts and do not necessarily map
512 directly to the real physical address space. Take also note that
513 some platforms do two passes of the linker so the results do not
514 match exactly to the final elf file. See also rom_report,
515 ram_report and
516 https://sourceware.org/binutils/docs/ld/MEMORY.html
517
Anas Nashiffdbf2db2020-10-20 14:31:56 -0400518config CLEANUP_INTERMEDIATE_FILES
519 bool "Remove all intermediate files"
520 help
521 Delete intermediate files to save space and cleanup clutter resulting
522 from the build process.
523
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700524config BUILD_NO_GAP_FILL
525 bool "Don't fill gaps in generated hex/bin/s19 files."
526
Anas Nashif86ad37a2018-11-02 07:12:07 -0400527config BUILD_OUTPUT_HEX
528 bool "Build a binary in HEX format"
529 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700530 Build an Intel HEX binary zephyr/zephyr.hex in the build directory.
531 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400532
533config BUILD_OUTPUT_BIN
534 bool "Build a binary in BIN format"
535 default y
536 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700537 Build a "raw" binary zephyr/zephyr.bin in the build directory.
538 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400539
Anas Nashif51c34bb2021-01-26 06:58:30 -0500540config BUILD_OUTPUT_EFI
541 bool "Build as an EFI application"
542 default n
543 depends on X86_64
544 help
545 Build as an EFI application.
546
547 This works by creating a "zephyr.efi" EFI binary containing a zephyr
548 image extracted from a built zephyr.elf file. EFI applications are
549 relocatable, and cannot be placed at specific locations in memory.
550 Instead, the stub code will copy the embedded zephyr sections to the
551 appropriate locations at startup, clear any zero-filled (BSS, etc...)
552 areas, then jump into the 64 bit entry point.
553
Anas Nashif86ad37a2018-11-02 07:12:07 -0400554config BUILD_OUTPUT_EXE
555 bool "Build a binary in ELF format with .exe extension"
556 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700557 Build an ELF binary that can run in the host system at
558 zephyr/zephyr.exe in the build directory.
559 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400560
561config BUILD_OUTPUT_S19
562 bool "Build a binary in S19 format"
563 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700564 Build an S19 binary zephyr/zephyr.s19 in the build directory.
565 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Håkon Øye Amundsenc086b932018-11-26 09:47:16 +0000566
Pete Johanson310a4642020-12-31 16:51:52 -0500567config BUILD_OUTPUT_UF2
568 bool "Build a binary in UF2 format"
569 depends on BUILD_OUTPUT_BIN
570 help
571 Build a UF2 binary zephyr/zephyr.uf2 in the build directory.
572 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
573
574if BUILD_OUTPUT_UF2
575
576config BUILD_OUTPUT_UF2_FAMILY_ID
Pete Johansonff01a002021-02-16 09:35:11 -0500577 string "UF2 device family ID"
578 default "0x1c5f21b0" if SOC_ESP32
Xudong Zheng8db98692022-03-22 12:15:50 -0400579 default "0x621e937a" if SOC_NRF52833_QIAA
Pete Johansonff01a002021-02-16 09:35:11 -0500580 default "0xada52840" if SOC_NRF52840_QIAA
581 default "0x4fb2d5bd" if SOC_SERIES_IMX_RT
582 default "0x2abc77ec" if SOC_SERIES_LPC55XXX
Yonatan Schachterefa170f2022-02-01 23:05:04 +0200583 default "0xe48bff56" if SOC_SERIES_RP2XXX
Pete Johansonff01a002021-02-16 09:35:11 -0500584 default "0x68ed2b88" if SOC_SERIES_SAMD21
585 default "0x55114460" if SOC_SERIES_SAMD51
586 default "0x647824b6" if SOC_SERIES_STM32F0X
587 default "0x5d1a0a2e" if SOC_SERIES_STM32F2X
588 default "0x6b846188" if SOC_SERIES_STM32F3X
589 default "0x53b80f00" if SOC_SERIES_STM32F7X
590 default "0x300f5633" if SOC_SERIES_STM32G0X
591 default "0x4c71240a" if SOC_SERIES_STM32G4X
592 default "0x6db66082" if SOC_SERIES_STM32H7X
593 default "0x202e3a91" if SOC_SERIES_STM32L0X
594 default "0x1e1f432d" if SOC_SERIES_STM32L1X
595 default "0x00ff6919" if SOC_SERIES_STM32L4X
596 default "0x04240bdf" if SOC_SERIES_STM32L5X
597 default "0x70d16653" if SOC_SERIES_STM32WBX
598 default "0x5ee21072" if SOC_STM32F103XE
Guillaume Gautier3d423222022-12-21 14:44:45 +0100599 default "0x57755a57" if SOC_SERIES_STM32F4X && (!SOC_STM32F407XE) && (!SOC_STM32F407XG)
Pete Johansonff01a002021-02-16 09:35:11 -0500600 default "0x6d0922fa" if SOC_STM32F407XE
601 default "0x8fb060fe" if SOC_STM32F407XG
Pete Johanson310a4642020-12-31 16:51:52 -0500602 help
603 UF2 bootloaders only accept UF2 files with a matching family ID.
604 This can be either a hex, e.g. 0x68ed2b88, or well-known family
Pete Johansonff01a002021-02-16 09:35:11 -0500605 name string. If the SoC in use is known by UF2, the Family ID will
606 be pre-filled with the known value.
Pete Johanson310a4642020-12-31 16:51:52 -0500607
Peter Johanson3f332072022-01-27 00:45:27 -0500608config BUILD_OUTPUT_UF2_USE_FLASH_BASE
609 bool
610 default n
611
612config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET
613 bool
614 default n
615
Pete Johanson310a4642020-12-31 16:51:52 -0500616endif # BUILD_OUTPUT_UF2
617
Anas Nashif86ad37a2018-11-02 07:12:07 -0400618config BUILD_OUTPUT_STRIPPED
619 bool "Build a stripped binary"
620 help
Martí Bolívarf39fdc42020-08-06 14:57:17 -0700621 Build a stripped binary zephyr/zephyr.strip in the build directory.
622 The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400623
Torsten Rasmussend51a67b2022-01-12 14:21:07 +0100624config BUILD_OUTPUT_ADJUST_LMA
625 string
626 help
627 This will adjust the LMA address in the final ELF and hex files with
628 the value provided.
629 This will not affect the internal address symbols inside the image but
630 can be useful when adjusting the LMA address for flash tools or multi
631 stage loaders where a pre-loader may copy image to a second location
632 before booting a second core.
633 The value will be evaluated as a math expression, this means that
634 following are valid expression
635 - 1024
636 - 0x1000
637 - -0x1000
638 - 0x20000000 - 0x10000000
639 Note: negative numbers are valid.
640 To adjust according to a chosen flash partition one can specify a
641 default as:
642 DT_CHOSEN_IMAGE_<name> := <name>,<name>-partition
643 DT_CHOSEN_Z_FLASH := zephyr,flash
644 config BUILD_OUTPUT_ADJUST_LMA
645 default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_IMAGE_M4))-\
646 $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))"
647
Torsten Rasmussenc8ddc342022-01-10 11:02:26 +0100648config BUILD_OUTPUT_INFO_HEADER
649 bool "Create a image information header"
650 help
651 Create an image information header which will contain image
652 information from the Zephyr binary.
653 Example of information contained in the header file:
654 - Number of segments in the image
655 - LMA address of each segment
656 - VMA address of each segment
657 - Size of each segment
658
Anas Nashif86ad37a2018-11-02 07:12:07 -0400659config APPLICATION_DEFINED_SYSCALL
660 bool "Scan application folder for any syscall definition"
661 help
662 Scan additional folders inside application source folder
663 for application defined syscalls.
664
Sebastian Bøed3a8fd42019-10-17 14:25:34 +0200665config MAKEFILE_EXPORTS
666 bool "Generate build metadata files named Makefile.exports"
667 help
668 Generates a file with build information that can be read by
669 third party Makefile-based build systems.
670
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200671config BUILD_OUTPUT_META
672 bool "Create a build meta file"
673 help
674 Create a build meta file in the build directory containing lists of:
675 - Zephyr: path and revision (if git repo)
676 - Zephyr modules: name, path, and revision (if git repo)
Torsten Rasmussen64ec6ee2021-11-04 14:28:21 +0100677 - West:
678 - manifest: path and revision
679 - projects: path and revision
680 - Workspace:
681 - dirty: one or more repositories are marked dirty
682 - extra: extra Zephyr modules are manually included in the build
683 - off: the SHA of one or more west projects are not what the manifest
684 defined when `west update` was run the last time (`manifest-rev`).
685 The off state is only present if a west workspace is found.
Torsten Rasmussenfffaf052021-10-12 23:08:36 +0200686 File extension is .meta
687
Torsten Rasmussen1a519932021-11-04 18:35:50 +0100688config BUILD_OUTPUT_META_STATE_PROPAGATE
689 bool "Propagate module and project state"
690 depends on BUILD_OUTPUT_META
691 help
692 Propagate to state of each module to the Zephyr revision field.
693 If west is used the state of each west project is also propagated to
694 the Zephyr revision field.
695 West manifest repo revision field will also
696 be marked with the same state as the Zephyr revision.
697 The final revision will become: <SHA>-<state1>-<state2>-<state3>...
698 If no states are appended to the SHA it means the build is of a clean
699 tree.
700 - dirty: one or more repositories are marked dirty
701 - extra: extra Zephyr modules are manually included in the build
702 - off: the SHA of one or more west projects are not what the manifest
703 defined when `west update` was run the last time (`manifest-rev`).
704 The off state is only present if a west workspace is found.
705
Martin Jägera0ffaa72023-03-29 16:06:30 +0200706config BUILD_OUTPUT_STRIP_PATHS
707 bool "Strip absolute paths from binaries"
708 default y
709 help
710 If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the
711 __FILE__ macro used in __ASSERT*, in the
712 .noinit."/home/joe/zephyr/fu/bar.c" section names and in any
713 application code.
714 This saves some memory, stops leaking user locations in binaries, makes
715 failure logs more deterministic and most importantly makes builds more
716 deterministic.
717 Debuggers usually have a path mapping feature to ensure the files are
718 still found.
719
Anas Nashif86ad37a2018-11-02 07:12:07 -0400720endmenu
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100721
Torsten Rasmussen6066ab42022-07-15 12:05:04 +0200722config DEPRECATED
723 bool
724 help
725 Symbol that must be selected by a feature or module if it is
726 considered to be deprecated.
727
728config WARN_DEPRECATED
729 bool
730 default y
731 prompt "Warn on deprecated usage"
732 help
733 Print a warning when the Kconfig tree is parsed if any deprecated
734 features are enabled.
735
Torsten Rasmussen1c911292021-03-22 14:29:38 +0100736config EXPERIMENTAL
737 bool
738 help
739 Symbol that must be selected by a feature if it is considered to be
740 at an experimental implementation stage.
741
742config WARN_EXPERIMENTAL
743 bool
744 prompt "Warn on experimental usage"
745 help
746 Print a warning when the Kconfig tree is parsed if any experimental
747 features are enabled.
748
Carles Cufid800ccc2022-08-22 18:38:16 +0200749config TAINT
750 bool
751 help
752 Symbol that must be selected by a feature or module if the Zephyr
753 build is considered tainted.
754
Nicolas Pitre0a386db2022-06-20 13:18:14 -0400755config ENFORCE_ZEPHYR_STDINT
756 bool
757 prompt "Enforce Zephyr convention for stdint"
758 depends on !ARCH_POSIX
759 default y
760 help
761 This enforces the Zephyr stdint convention where int32_t = int,
762 int64_t = long long, and intptr_t = long so that short string
763 format length modifiers can be used universally across ILP32
764 and LP64 architectures. Sometimes this is not possible e.g. when
765 linking against a binary-only C++ library whose type mangling
766 is incompatible with the Zephyr convention, or if the build
767 environment doesn't allow such enforcement, in which case this
768 should be turned off with the caveat that argument type validation
769 on Zephyr code will be skipped.
770
Anas Nashif86ad37a2018-11-02 07:12:07 -0400771endmenu
772
773
774menu "Boot Options"
775
776config IS_BOOTLOADER
777 bool "Act as a bootloader"
778 depends on XIP
779 depends on ARM
780 help
781 This option indicates that Zephyr will act as a bootloader to execute
782 a separate Zephyr image payload.
783
784config BOOTLOADER_SRAM_SIZE
785 int "SRAM reserved for bootloader"
786 default 16
787 depends on !XIP || IS_BOOTLOADER
Rajavardhan Gundie584b052018-12-14 16:55:43 +0530788 depends on ARM || XTENSA
Anas Nashif86ad37a2018-11-02 07:12:07 -0400789 help
790 This option specifies the amount of SRAM (measure in kB) reserved for
791 a bootloader image, when either:
792 - the Zephyr image itself is to act as the bootloader, or
793 - Zephyr is a !XIP image, which implicitly assumes existence of a
794 bootloader that loads the Zephyr !XIP image onto SRAM.
795
Håkon Øye Amundsenc92a60b2020-09-17 12:05:15 +0000796config MCUBOOT
797 bool
798 help
799 Hidden option used to indicate that the current image is MCUBoot
800
Anas Nashif86ad37a2018-11-02 07:12:07 -0400801config BOOTLOADER_MCUBOOT
802 bool "MCUboot bootloader support"
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100803 select USE_DT_CODE_PARTITION
Ioannis Glaropoulos071ab4a2020-10-21 15:56:38 +0200804 imply INIT_ARCH_HW_AT_BOOT if ARCH_SUPPORTS_ARCH_HW_INIT
Håkon Øye Amundsenc92a60b2020-09-17 12:05:15 +0000805 depends on !MCUBOOT
Anas Nashif86ad37a2018-11-02 07:12:07 -0400806 help
807 This option signifies that the target uses MCUboot as a bootloader,
808 or in other words that the image is to be chain-loaded by MCUboot.
809 This sets several required build system and Device Tree options in
810 order for the image generated to be bootable using the MCUboot open
811 source bootloader. Currently this includes:
812
Stephanos Ioannidis33224892020-02-10 16:37:24 +0900813 * Setting ROM_START_OFFSET to a default value that allows space
Anas Nashif86ad37a2018-11-02 07:12:07 -0400814 for the MCUboot image header
Andrzej Puzdrowskic7ab1a12020-07-03 16:01:33 +0200815 * Activating SW_VECTOR_RELAY_CLIENT on Cortex-M0
816 (or Armv8-M baseline) targets with no built-in vector relocation
817 mechanisms
Anas Nashif86ad37a2018-11-02 07:12:07 -0400818
Ioannis Glaropoulos071ab4a2020-10-21 15:56:38 +0200819 By default, this option instructs Zephyr to initialize the core
820 architecture HW registers during boot, when this is supported by
821 the application. This removes the need by MCUboot to reset
822 the core registers' state itself.
823
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700824if BOOTLOADER_MCUBOOT
825
Dominik Ermel1cc7e412023-03-22 10:28:05 +0000826config MCUBOOT_CMAKE_WEST_SIGN_PARAMS
827 string "Extra parameters to west sign"
828 default "--quiet"
829 help
830 Parameters that are passed by cmake to west sign, just after
831 the command, before all other parameters needed for image
832 signing.
833 By default this is set to "--quiet" to prevent extra, non-error,
834 diagnostic messages from west sign. This does not affect signing
835 tool for which extra parameters are passed with
836 MCUBOOT_EXTRA_IMGTOOL_ARGS.
837
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700838config MCUBOOT_SIGNATURE_KEY_FILE
839 string "Path to the mcuboot signing key file"
840 default ""
Shubham Kulkarnif9eaabb2021-08-30 17:14:49 +0530841 depends on !MCUBOOT_GENERATE_UNSIGNED_IMAGE
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700842 help
843 The file contains a key pair whose public half is verified
844 by your target's MCUboot image. The file is in PEM format.
845
846 If set to a non-empty value, the build system tries to
847 sign the final binaries using a 'west sign -t imgtool' command.
848 The signed binaries are placed in the build directory
849 at zephyr/zephyr.signed.bin and zephyr/zephyr.signed.hex.
850
851 The file names can be customized with CONFIG_KERNEL_BIN_NAME.
852 The existence of bin and hex files depends on CONFIG_BUILD_OUTPUT_BIN
853 and CONFIG_BUILD_OUTPUT_HEX.
854
Helge Juul8749cd42021-08-10 10:59:00 +0200855 This option should contain a path to the same file as the
856 BOOT_SIGNATURE_KEY_FILE option in your MCUboot .config. The path
857 may be absolute or relative to the west workspace topdir. (The MCUboot
858 config option is used for the MCUboot bootloader image; this option is
859 for your application which is to be loaded by MCUboot. The MCUboot
860 config option can be a relative path from the MCUboot repository
861 root.)
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700862
863 If left empty, you must sign the Zephyr binaries manually.
864
Helge Juul8749cd42021-08-10 10:59:00 +0200865config MCUBOOT_ENCRYPTION_KEY_FILE
866 string "Path to the mcuboot encryption key file"
867 default ""
868 depends on MCUBOOT_SIGNATURE_KEY_FILE != ""
869 help
870 The file contains the public key that is used to encrypt the
871 ephemeral key that encrypts the image. The corresponding
872 private key is hard coded in the MCUboot source code and is
873 used to decrypt the ephemeral key that is embedded in the
874 image. The file is in PEM format.
875
876 If set to a non-empty value, the build system tries to
877 sign and encrypt the final binaries using a 'west sign -t imgtool'
878 command. The binaries are placed in the build directory at
879 zephyr/zephyr.signed.encrypted.bin and
880 zephyr/zephyr.signed.encrypted.hex.
881
882 The file names can be customized with CONFIG_KERNEL_BIN_NAME.
883 The existence of bin and hex files depends on CONFIG_BUILD_OUTPUT_BIN
884 and CONFIG_BUILD_OUTPUT_HEX.
885
886 This option should either be an absolute path or a path relative to
887 the west workspace topdir.
888 Example: './bootloader/mcuboot/enc-rsa2048-pub.pem'
889
890 If left empty, you must encrypt the Zephyr binaries manually.
891
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700892config MCUBOOT_EXTRA_IMGTOOL_ARGS
Sebastian Bøe02b83892022-12-13 13:46:05 +0100893 string "Extra arguments to pass to imgtool when signing"
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700894 default ""
895 help
Sebastian Bøe02b83892022-12-13 13:46:05 +0100896 When signing (CONFIG_MCUBOOT_SIGNATURE_KEY_FILE is a non-empty
897 string) you can use this option to pass extra options to
898 imgtool. For example, you could set this to "--version 1.2".
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700899
Shubham Kulkarnif9eaabb2021-08-30 17:14:49 +0530900config MCUBOOT_GENERATE_UNSIGNED_IMAGE
901 bool "Generate unsigned binary image bootable with MCUboot"
902 help
903 Enabling this configuration allows automatic unsigned binary image
904 generation when MCUboot signing key is not provided,
905 i.e., MCUBOOT_SIGNATURE_KEY_FILE is left empty.
906
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700907config MCUBOOT_GENERATE_CONFIRMED_IMAGE
Henrik Brix Andersen7e39e1d2020-09-03 20:37:31 +0200908 bool "Also generate a padded, confirmed image"
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700909 help
Henrik Brix Andersen7e39e1d2020-09-03 20:37:31 +0200910 The signed, padded, and confirmed binaries are placed in the build
911 directory at zephyr/zephyr.signed.confirmed.bin and
Martí Bolívarf66a0c32020-08-18 11:28:04 -0700912 zephyr/zephyr.signed.confirmed.hex.
913
914 The file names can be customized with CONFIG_KERNEL_BIN_NAME.
915 The existence of bin and hex files depends on CONFIG_BUILD_OUTPUT_BIN
916 and CONFIG_BUILD_OUTPUT_HEX.
917
918endif # BOOTLOADER_MCUBOOT
919
Anas Nashif86ad37a2018-11-02 07:12:07 -0400920config BOOTLOADER_ESP_IDF
921 bool "ESP-IDF bootloader support"
Sylvio Alves839b97e2023-01-02 09:16:46 -0300922 depends on (SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3 || SOC_ESP32S3) && !BOOTLOADER_MCUBOOT
Sylvio Alves16571db2021-11-27 16:32:00 -0300923 default y
Anas Nashif86ad37a2018-11-02 07:12:07 -0400924 help
925 This option will trigger the compilation of the ESP-IDF bootloader
926 inside the build folder.
927 At flash time, the bootloader will be flashed with the zephyr image
928
Michael Hope8c1f1862020-06-13 21:32:11 +0200929config BOOTLOADER_BOSSA
930 bool "BOSSA bootloader support"
931 select USE_DT_CODE_PARTITION
Michael Hope8c1f1862020-06-13 21:32:11 +0200932
933 help
934 Signifies that the target uses a BOSSA compatible bootloader. If CDC
935 ACM USB support is also enabled then the board will reboot into the
936 bootloader automatically when bossac is run.
937
938config BOOTLOADER_BOSSA_DEVICE_NAME
939 string "BOSSA CDC ACM device name"
940 depends on BOOTLOADER_BOSSA && CDC_ACM_DTE_RATE_CALLBACK_SUPPORT
941 default "CDC_ACM_0"
942 help
943 Sets the CDC ACM port to watch for reboot commands.
944
945choice
946 prompt "BOSSA bootloader variant"
947 depends on BOOTLOADER_BOSSA
948
Gerson Fernando Budkef3a7f042021-05-06 21:20:11 -0300949config BOOTLOADER_BOSSA_LEGACY
950 bool "Legacy"
951 help
952 Select the Legacy variant of the BOSSA bootloader. This is defined
953 for compatibility mode only. The recommendation is use newer
954 versions like Arduino or Adafruit UF2.
955
Michael Hope8c1f1862020-06-13 21:32:11 +0200956config BOOTLOADER_BOSSA_ARDUINO
957 bool "Arduino"
958 help
959 Select the Arduino variant of the BOSSA bootloader. Uses 0x07738135
960 as the magic value to enter the bootloader.
961
962config BOOTLOADER_BOSSA_ADAFRUIT_UF2
963 bool "Adafruit UF2"
964 help
965 Select the Adafruit UF2 variant of the BOSSA bootloader. Uses
966 0xf01669ef as the magic value to enter the bootloader.
967
968endchoice
969
Anas Nashif86ad37a2018-11-02 07:12:07 -0400970endmenu
Carlo Caioned048faa2019-12-17 17:13:47 +0000971
972menu "Compatibility"
973
974config COMPAT_INCLUDES
975 bool "Suppress warnings when using header shims"
976 default y
977 help
978 Suppress any warnings from the pre-processor when including
979 deprecated header files.
980
981endmenu