blob: 294fbbfe784df3d6442ac1979f8bb20b5c91ec20 [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 -04007menu "Modules"
8
Sebastian Bøe7061c032019-03-01 12:57:11 +01009source "$(CMAKE_BINARY_DIR)/Kconfig.modules"
Anas Nashif8017c592019-05-23 17:19:41 -040010source "modules/Kconfig"
Emanuele Di Santo9acb6432019-03-13 15:30:55 +010011
Anas Nashif658f6bc2019-05-28 14:22:51 -040012endmenu
13
Ulf Magnussone63b6522020-01-26 23:47:41 +010014# Include Kconfig.defconfig files first so that they can override defaults and
15# other symbol/choice properties by adding extra symbol/choice definitions.
16# After merging all definitions for a symbol/choice, Kconfig picks the first
17# property (e.g. the first default) with a satisfied condition.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020018#
Ulf Magnussone63b6522020-01-26 23:47:41 +010019# Shield defaults should have precedence over board defaults, which should have
20# precedence over SoC defaults, so include them in that order.
Ulf Magnussonec3eff52018-07-30 10:57:47 +020021#
Ulf Magnussone63b6522020-01-26 23:47:41 +010022# $ARCH and $BOARD_DIR will be glob patterns when building documentation.
Erwan Gourioue3bed1f2019-11-22 10:37:01 +010023source "boards/shields/*/Kconfig.defconfig"
Ulf Magnussond7130332018-09-05 13:10:19 +020024source "$(BOARD_DIR)/Kconfig.defconfig"
Anas Nashif96455d52018-09-04 14:34:06 -050025source "$(SOC_DIR)/$(ARCH)/*/Kconfig.defconfig"
Ulf Magnussonec3eff52018-07-30 10:57:47 +020026
Anas Nashifabcf2ad2018-09-04 08:32:07 -050027source "boards/Kconfig"
Anas Nashif96455d52018-09-04 14:34:06 -050028source "$(SOC_DIR)/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040029source "arch/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040030source "kernel/Kconfig"
Anas Nashifc6ba67f2017-08-03 07:47:44 -040031source "dts/Kconfig"
Anas Nashif77ba3c32015-10-09 06:20:52 -040032source "drivers/Kconfig"
Anas Nashif0b2c44a2016-05-14 23:10:51 -040033source "lib/Kconfig"
Ramesh Thomase354ad22016-10-29 04:10:36 -070034source "subsys/Kconfig"
Kumar Gala7584a122016-05-24 14:23:26 -050035source "ext/Kconfig"
36
Kumar Gala2630fba2020-01-24 09:39:40 -060037osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig"
Anas Nashif8017c592019-05-23 17:19:41 -040038
Anas Nashif86ad37a2018-11-02 07:12:07 -040039menu "Build and Link Features"
40
41menu "Linker Options"
42
Daniel Leung6600c642018-10-19 10:15:19 -070043choice
44 prompt "Linker Orphan Section Handling"
45 default LINKER_ORPHAN_SECTION_WARN
46
47config LINKER_ORPHAN_SECTION_PLACE
48 bool "Place"
49 help
50 Linker puts orphan sections in place without warnings
51 or errors.
52
53config LINKER_ORPHAN_SECTION_WARN
54 bool "Warn"
55 help
Anas Nashiff2cb20c2019-06-18 14:45:40 -040056 Linker places the orphan sections in output and issues
Daniel Leung6600c642018-10-19 10:15:19 -070057 warning about those sections.
58
59config LINKER_ORPHAN_SECTION_ERROR
60 bool "Error"
61 help
62 Linker exits with error when an orphan section is found.
63
64endchoice
Anas Nashif86ad37a2018-11-02 07:12:07 -040065
Adithya Baglody91c5b842018-11-13 16:57:45 +053066config CODE_DATA_RELOCATION
Ulf Magnusson975de212019-11-01 10:24:07 +010067 bool "Relocate code/data sections"
68 depends on ARM
69 help
Adithya Baglody91c5b842018-11-13 16:57:45 +053070 When selected this will relocate .text, data and .bss sections from
71 the specified files and places it in the required memory region. The
72 files should be specified in the CMakeList.txt file with
Håkon Øye Amundsend3aa6192019-08-15 09:03:26 +000073 a cmake API zephyr_code_relocate().
Adithya Baglody91c5b842018-11-13 16:57:45 +053074
Anas Nashif86ad37a2018-11-02 07:12:07 -040075config HAS_FLASH_LOAD_OFFSET
76 bool
77 help
78 This option is selected by targets having a FLASH_LOAD_OFFSET
79 and FLASH_LOAD_SIZE.
80
Ulf Magnussonfd9981a2019-11-16 01:33:09 +010081if HAS_FLASH_LOAD_OFFSET
82
Ulf Magnusson90b9eb32019-11-16 01:22:16 +010083config USE_DT_CODE_PARTITION
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010084 bool "Link application into /chosen/zephyr,code-partition from devicetree"
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010085 help
Ulf Magnusson1f9c5f12019-11-16 01:16:57 +010086 When enabled, the application will be linked into the flash partition
87 selected by the zephyr,code-partition property in /chosen in devicetree.
88 When this is disabled, the flash load offset and size can be set manually
89 below.
Andrzej Puzdrowski2b1227f2019-03-18 14:02:11 +010090
Kumar Gala8ce0cf02019-08-28 09:29:26 -050091# Workaround for not being able to have commas in macro arguments
92DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
93
Anas Nashif86ad37a2018-11-02 07:12:07 -040094config FLASH_LOAD_OFFSET
Ulf Magnusson90b9eb32019-11-16 01:22:16 +010095 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
96 hex "Kernel load offset" if !USE_DT_CODE_PARTITION
97 default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -040098 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -040099 help
100 This option specifies the byte offset from the beginning of flash that
101 the kernel should be loaded into. Changing this value from zero will
102 affect the Zephyr image's link, and will decrease the total amount of
103 flash available for use by application code.
104
105 If unsure, leave at the default value 0.
106
107config FLASH_LOAD_SIZE
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100108 # Only user-configurable when USE_DT_CODE_PARTITION is disabled
109 hex "Kernel load size" if !USE_DT_CODE_PARTITION
110 default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400111 default 0
Anas Nashif86ad37a2018-11-02 07:12:07 -0400112 help
113 If non-zero, this option specifies the size, in bytes, of the flash
114 area that the Zephyr image will be allowed to occupy. If zero, the
115 image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
116 the device.
117
118 If unsure, leave at the default value 0.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400119
Ulf Magnussonfd9981a2019-11-16 01:33:09 +0100120endif # HAS_FLASH_LOAD_OFFSET
121
Anas Nashif86ad37a2018-11-02 07:12:07 -0400122config TEXT_SECTION_OFFSET
Ole Sæther985446a2019-01-23 14:13:03 +0100123 hex
124 prompt "TEXT section offset" if !BOOTLOADER_MCUBOOT
Anas Nashif86ad37a2018-11-02 07:12:07 -0400125 default 0x200 if BOOTLOADER_MCUBOOT
126 default 0
127 help
128 If the application is built for chain-loading by a bootloader this
129 variable is required to be set to value that leaves sufficient
130 space between the beginning of the image and the start of the .text
131 section to store an image header or any other metadata.
132 In the particular case of the MCUboot bootloader this reserves enough
133 space to store the image header, which should also meet vector table
134 alignment requirements on most ARM targets, although some targets
135 may require smaller or larger values.
136
137config HAVE_CUSTOM_LINKER_SCRIPT
138 bool "Custom linker scripts provided"
139 help
140 Set this option if you have a custom linker script which needed to
141 be define in CUSTOM_LINKER_SCRIPT.
142
143config CUSTOM_LINKER_SCRIPT
144 string "Path to custom linker script"
145 depends on HAVE_CUSTOM_LINKER_SCRIPT
146 help
147 Path to the linker script to be used instead of the one define by the
148 board.
149
150 The linker script must be based on a version provided by Zephyr since
151 the kernel can expect a certain layout/certain regions.
152
153 This is useful when an application needs to add sections into the
154 linker script and avoid having to change the script provided by
155 Zephyr.
156
157config CUSTOM_RODATA_LD
Øyvind Rønningstad901c0a12019-03-20 12:53:49 +0100158 bool "(DEPRECATED) Include custom-rodata.ld"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400159 help
Øyvind Rønningstad901c0a12019-03-20 12:53:49 +0100160 Note: This is deprecated, use Cmake function zephyr_linker_sources() instead.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400161 Include a customized linker script fragment for inserting additional
162 data and linker directives into the rodata section.
163
164config CUSTOM_RWDATA_LD
Øyvind Rønningstad901c0a12019-03-20 12:53:49 +0100165 bool "(DEPRECATED) Include custom-rwdata.ld"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400166 help
Øyvind Rønningstad901c0a12019-03-20 12:53:49 +0100167 Note: This is deprecated, use Cmake function zephyr_linker_sources() instead.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400168 Include a customized linker script fragment for inserting additional
169 data and linker directives into the data section.
170
171config CUSTOM_SECTIONS_LD
Øyvind Rønningstad901c0a12019-03-20 12:53:49 +0100172 bool "(DEPRECATED) Include custom-sections.ld"
Anas Nashif86ad37a2018-11-02 07:12:07 -0400173 help
Øyvind Rønningstad901c0a12019-03-20 12:53:49 +0100174 Note: This is deprecated, use Cmake function zephyr_linker_sources() instead.
Anas Nashif86ad37a2018-11-02 07:12:07 -0400175 Include a customized linker script fragment for inserting additional
176 arbitrary sections.
177
Anas Nashif86ad37a2018-11-02 07:12:07 -0400178config KERNEL_ENTRY
179 string "Kernel entry symbol"
180 default "__start"
181 help
182 Code entry symbol, to be set at linking phase.
183
Sebastian Bøe3a0597f2019-03-15 14:05:09 +0100184config LINKER_SORT_BY_ALIGNMENT
185 bool "Sort input sections by alignment"
186 default y
187 help
188 This turns on the linker flag to sort sections by alignment
189 in decreasing size of symbols. This helps to minimize
190 padding between symbols.
191
Anas Nashif86ad37a2018-11-02 07:12:07 -0400192endmenu
193
194menu "Compiler Options"
195
Anas Nashif86ad37a2018-11-02 07:12:07 -0400196config NATIVE_APPLICATION
197 bool "Build as a native host application"
198 help
199 Build as a native application that can run on the host and using
200 resources and libraries provided by the host.
201
202choice
203 prompt "Optimization level"
204 default NO_OPTIMIZATIONS if COVERAGE
205 default DEBUG_OPTIMIZATIONS if DEBUG
206 default SIZE_OPTIMIZATIONS
207 help
208 Note that these flags shall only control the compiler
209 optimization level, and that no extra debug code shall be
210 conditionally compiled based on them.
211
212config SIZE_OPTIMIZATIONS
213 bool "Optimize for size"
214 help
215 Compiler optimizations will be set to -Os independently of other
216 options.
217
218config SPEED_OPTIMIZATIONS
219 bool "Optimize for speed"
220 help
221 Compiler optimizations will be set to -O2 independently of other
222 options.
223
224config DEBUG_OPTIMIZATIONS
225 bool "Optimize debugging experience"
226 help
227 Compiler optimizations will be set to -Og independently of other
228 options.
229
230config NO_OPTIMIZATIONS
231 bool "Optimize nothing"
232 help
233 Compiler optimizations will be set to -O0 independently of other
234 options.
235
236endchoice
237
238config COMPILER_OPT
239 string "Custom compiler options"
240 help
241 This option is a free-form string that is passed to the compiler
242 when building all parts of a project (i.e. kernel).
243 The compiler options specified by this string supplement the
244 predefined set of compiler supplied by the build system,
245 and can be used to change compiler optimization, warning and error
246 messages, and so on.
247
248endmenu
249
Anas Nashif22b95a22019-11-24 11:28:38 -0500250choice
251 prompt "Error checking behavior for CHECK macro"
252 default RUNTIME_ERROR_CHECKS
253
254config ASSERT_ON_ERRORS
255 bool "Assert on all errors"
256 help
257 Assert on errors covered with the CHECK macro.
258
259config NO_RUNTIME_CHECKS
260 bool "No runtime error checks"
261 help
262 Do not do any runtime checks or asserts when using the CHECK macro.
263
264config RUNTIME_ERROR_CHECKS
265 bool "Enable runtime error checks"
266 help
267 Always perform runtime checks covered with the CHECK macro. This
268 option is the default and the only option used during testing.
269
270endchoice
271
Anas Nashif86ad37a2018-11-02 07:12:07 -0400272menu "Build Options"
273
274config KERNEL_BIN_NAME
275 string "The kernel binary name"
276 default "zephyr"
277 help
278 This option sets the name of the generated kernel binary.
279
280config OUTPUT_STAT
281 bool "Create a statistics file"
282 default y
283 help
284 Create a stat file using readelf -e <elf>
285
286config OUTPUT_DISASSEMBLY
287 bool "Create a disassembly file"
288 default y
289 help
290 Create an .lst file with the assembly listing of the firmware.
291
292config OUTPUT_PRINT_MEMORY_USAGE
293 bool "Print memory usage to stdout"
294 default y
295 help
296 If the toolchain supports it, this option will pass
297 --print-memory-region to the linker when it is doing it's first
298 linker pass. Note that the memory regions are symbolic concepts
299 defined by the linker scripts and do not necessarily map
300 directly to the real physical address space. Take also note that
301 some platforms do two passes of the linker so the results do not
302 match exactly to the final elf file. See also rom_report,
303 ram_report and
304 https://sourceware.org/binutils/docs/ld/MEMORY.html
305
306config BUILD_OUTPUT_HEX
307 bool "Build a binary in HEX format"
308 help
309 Build a binary in HEX format. This will build a zephyr.hex file need
310 by some platforms.
311
312config BUILD_OUTPUT_BIN
313 bool "Build a binary in BIN format"
314 default y
315 help
316 Build a binary in BIN format. This will build a zephyr.bin file need
317 by some platforms.
318
319config BUILD_OUTPUT_EXE
320 bool "Build a binary in ELF format with .exe extension"
321 help
322 Build a binary in ELF format that can run in the host system. This
323 will build a zephyr.exe file.
324
325config BUILD_OUTPUT_S19
326 bool "Build a binary in S19 format"
327 help
328 Build a binary in S19 format. This will build a zephyr.s19 file need
329 by some platforms.
330
Håkon Øye Amundsenc086b932018-11-26 09:47:16 +0000331config BUILD_NO_GAP_FILL
332 bool "Don't fill gaps in generated hex/bin/s19 files."
Håkon Øye Amundsenc086b932018-11-26 09:47:16 +0000333
Anas Nashif86ad37a2018-11-02 07:12:07 -0400334config BUILD_OUTPUT_STRIPPED
335 bool "Build a stripped binary"
336 help
337 Build a stripped binary. This will build a zephyr.stripped file need
338 by some platforms.
339
340config APPLICATION_DEFINED_SYSCALL
341 bool "Scan application folder for any syscall definition"
342 help
343 Scan additional folders inside application source folder
344 for application defined syscalls.
345
Sebastian Bøed3a8fd42019-10-17 14:25:34 +0200346config MAKEFILE_EXPORTS
347 bool "Generate build metadata files named Makefile.exports"
348 help
349 Generates a file with build information that can be read by
350 third party Makefile-based build systems.
351
Anas Nashif86ad37a2018-11-02 07:12:07 -0400352endmenu
353endmenu
354
355
356menu "Boot Options"
357
358config IS_BOOTLOADER
359 bool "Act as a bootloader"
360 depends on XIP
361 depends on ARM
362 help
363 This option indicates that Zephyr will act as a bootloader to execute
364 a separate Zephyr image payload.
365
366config BOOTLOADER_SRAM_SIZE
367 int "SRAM reserved for bootloader"
368 default 16
369 depends on !XIP || IS_BOOTLOADER
Rajavardhan Gundie584b052018-12-14 16:55:43 +0530370 depends on ARM || XTENSA
Anas Nashif86ad37a2018-11-02 07:12:07 -0400371 help
372 This option specifies the amount of SRAM (measure in kB) reserved for
373 a bootloader image, when either:
374 - the Zephyr image itself is to act as the bootloader, or
375 - Zephyr is a !XIP image, which implicitly assumes existence of a
376 bootloader that loads the Zephyr !XIP image onto SRAM.
377
378config BOOTLOADER_MCUBOOT
379 bool "MCUboot bootloader support"
Ulf Magnusson90b9eb32019-11-16 01:22:16 +0100380 select USE_DT_CODE_PARTITION
Anas Nashif86ad37a2018-11-02 07:12:07 -0400381 help
382 This option signifies that the target uses MCUboot as a bootloader,
383 or in other words that the image is to be chain-loaded by MCUboot.
384 This sets several required build system and Device Tree options in
385 order for the image generated to be bootable using the MCUboot open
386 source bootloader. Currently this includes:
387
388 * Setting TEXT_SECTION_OFFSET to a default value that allows space
389 for the MCUboot image header
390 * Activating SW_VECTOR_RELAY on Cortex-M0 (or Armv8-M baseline)
391 targets with no built-in vector relocation mechanisms
392 * Including dts/common/mcuboot.overlay when building the Device
393 Tree in order to place and link the image at the slot0 offset
394
395config BOOTLOADER_ESP_IDF
396 bool "ESP-IDF bootloader support"
397 depends on SOC_ESP32
398 help
399 This option will trigger the compilation of the ESP-IDF bootloader
400 inside the build folder.
401 At flash time, the bootloader will be flashed with the zephyr image
402
Anas Nashif86ad37a2018-11-02 07:12:07 -0400403config BOOTLOADER_KEXEC
404 bool "Boot using Linux kexec() system call"
405 depends on X86
406 help
407 This option signifies that Linux boots the kernel using kexec system call
408 and utility. This method is used to boot the kernel over the network.
409
Anas Nashif86ad37a2018-11-02 07:12:07 -0400410config BOOTLOADER_CONTEXT_RESTORE
411 bool "Boot loader has context restore support"
412 default y
Piotr Zięcik9cc63e02019-02-12 11:07:20 +0100413 depends on SYS_POWER_DEEP_SLEEP_STATES && BOOTLOADER_CONTEXT_RESTORE_SUPPORTED
Anas Nashif86ad37a2018-11-02 07:12:07 -0400414 help
415 This option signifies that the target has a bootloader
416 that restores CPU context upon resuming from deep sleep
417 power state.
418
419config REBOOT
420 bool "Reboot functionality"
421 select SYSTEM_CLOCK_DISABLE
422 help
423 Enable the sys_reboot() API. Enabling this can drag in other subsystems
424 needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the
425 system clock before issuing a reset).
Andy Rossfe04adf2019-02-27 11:53:18 -0800426
427config MISRA_SANE
428 bool "MISRA standards compliance features"
429 help
430 Causes the source code to build in "MISRA" mode, which
431 disallows some otherwise-permitted features of the C
432 standard for safety reasons. Specifically variable length
433 arrays are not permitted (and gcc will enforce this).
434
Anas Nashif86ad37a2018-11-02 07:12:07 -0400435endmenu
Carlo Caioned048faa2019-12-17 17:13:47 +0000436
437menu "Compatibility"
438
439config COMPAT_INCLUDES
440 bool "Suppress warnings when using header shims"
441 default y
442 help
443 Suppress any warnings from the pre-processor when including
444 deprecated header files.
445
446endmenu