1# General configuration options
2
3# Copyright (c) 2014-2015 Wind River Systems, Inc.
4# Copyright (c) 2016 Intel Corporation
5# Copyright (c) 2023 Nordic Semiconductor ASA
6# SPDX-License-Identifier: Apache-2.0
7
8osource "${APPLICATION_SOURCE_DIR}/VERSION"
9
10# Include Kconfig.defconfig files first so that they can override defaults and
11# other symbol/choice properties by adding extra symbol/choice definitions.
12# After merging all definitions for a symbol/choice, Kconfig picks the first
13# property (e.g. the first default) with a satisfied condition.
14#
15# Shield defaults should have precedence over board defaults, which should have
16# precedence over SoC defaults, so include them in that order.
17#
18# $ARCH and $BOARD_DIR will be glob patterns when building documentation.
19# This loads custom shields defconfigs (from BOARD_ROOT)
20osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig"
21# This loads Zephyr base shield defconfigs
22source "boards/shields/*/Kconfig.defconfig"
23
24source "$(BOARD_DIR)/Kconfig.defconfig"
25
26# This loads custom SoC root defconfigs
27osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig"
28# This loads Zephyr base SoC root defconfigs
29osource "soc/$(ARCH)/*/Kconfig.defconfig"
30# This loads the toolchain defconfigs
31osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig.defconfig"
32# This loads the testsuite defconfig
33source "subsys/testsuite/Kconfig.defconfig"
34
35# This should be early since the autogen Kconfig.dts symbols may get
36# used by modules
37source "dts/Kconfig"
38
39menu "Modules"
40
41source "modules/Kconfig"
42
43endmenu
44
45source "boards/Kconfig"
46source "soc/Kconfig"
47source "arch/Kconfig"
48source "kernel/Kconfig"
49source "drivers/Kconfig"
50source "lib/Kconfig"
51source "subsys/Kconfig"
52
53osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig"
54
55menu "Build and Link Features"
56
57menu "Linker Options"
58
59choice LINKER_ORPHAN_CONFIGURATION
60	prompt "Linker Orphan Section Handling"
61	default LINKER_ORPHAN_SECTION_WARN
62
63config LINKER_ORPHAN_SECTION_PLACE
64	bool "Place"
65	help
66	  Linker puts orphan sections in place without warnings
67	  or errors.
68
69config LINKER_ORPHAN_SECTION_WARN
70	bool "Warn"
71	help
72	  Linker places the orphan sections in output and issues
73	  warning about those sections.
74
75config LINKER_ORPHAN_SECTION_ERROR
76	bool "Error"
77	help
78	  Linker exits with error when an orphan section is found.
79
80endchoice
81
82config HAS_FLASH_LOAD_OFFSET
83	bool
84	help
85	  This option is selected by targets having a FLASH_LOAD_OFFSET
86	  and FLASH_LOAD_SIZE.
87
88if HAS_FLASH_LOAD_OFFSET
89
90config USE_DT_CODE_PARTITION
91	bool "Link application into /chosen/zephyr,code-partition from devicetree"
92	help
93	  When enabled, the application will be linked into the flash partition
94	  selected by the zephyr,code-partition property in /chosen in devicetree.
95	  When this is disabled, the flash load offset and size can be set manually
96	  below.
97
98# Workaround for not being able to have commas in macro arguments
99DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
100
101config FLASH_LOAD_OFFSET
102	# Only user-configurable when USE_DT_CODE_PARTITION is disabled
103	hex "Kernel load offset" if !USE_DT_CODE_PARTITION
104	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
105	default 0
106	help
107	  This option specifies the byte offset from the beginning of flash that
108	  the kernel should be loaded into. Changing this value from zero will
109	  affect the Zephyr image's link, and will decrease the total amount of
110	  flash available for use by application code.
111
112	  If unsure, leave at the default value 0.
113
114config FLASH_LOAD_SIZE
115	# Only user-configurable when USE_DT_CODE_PARTITION is disabled
116	hex "Kernel load size" if !USE_DT_CODE_PARTITION
117	default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
118	default 0
119	help
120	  If non-zero, this option specifies the size, in bytes, of the flash
121	  area that the Zephyr image will be allowed to occupy.  If zero, the
122	  image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
123	  the device.
124
125	  If unsure, leave at the default value 0.
126
127endif # HAS_FLASH_LOAD_OFFSET
128
129config ROM_START_OFFSET
130	hex
131	prompt "ROM start offset" if !BOOTLOADER_MCUBOOT
132	default 0x200 if BOOTLOADER_MCUBOOT
133	default 0
134	help
135	  If the application is built for chain-loading by a bootloader this
136	  variable is required to be set to value that leaves sufficient
137	  space between the beginning of the image and the start of the first
138	  section to store an image header or any other metadata.
139	  In the particular case of the MCUboot bootloader this reserves enough
140	  space to store the image header, which should also meet vector table
141	  alignment requirements on most ARM targets, although some targets
142	  may require smaller or larger values.
143
144config ROM_END_OFFSET
145	hex "ROM end offset"
146	default 0
147	help
148	  If non-zero, this option reduces the maximum size that the Zephyr image is allowed to
149	  occupy, this is to allow for additional image storage which can be created and used by
150	  other systems such as bootloaders (for MCUboot, this would include the image swap
151	  fields and TLV storage at the end of the image).
152
153	  If unsure, leave at the default value 0.
154
155config LD_LINKER_SCRIPT_SUPPORTED
156	bool
157	default y
158
159choice LINKER_SCRIPT
160	prompt "Linker script"
161	default LD_LINKER_TEMPLATE if LD_LINKER_SCRIPT_SUPPORTED
162
163config LD_LINKER_TEMPLATE
164	bool "LD template"
165	depends on LD_LINKER_SCRIPT_SUPPORTED
166	help
167	  Select this option to use the LD linker script templates.
168	  The templates are pre-processed by the C pre-processor to create the
169	  final LD linker script.
170
171config CMAKE_LINKER_GENERATOR
172	bool "CMake generator"
173	depends on ARM
174	help
175	  Select this option to use the Zephyr CMake linker script generator.
176	  The linker configuration is written in CMake and the final linker
177	  script will be generated by the toolchain specific linker generator.
178	  For LD based linkers, this will be the ld generator, for ARMClang /
179	  armlink based linkers it will be the scatter generator.
180
181endchoice
182
183config HAVE_CUSTOM_LINKER_SCRIPT
184	bool "Custom linker script provided"
185	help
186	  Set this option if you have a custom linker script which needed to
187	  be define in CUSTOM_LINKER_SCRIPT.
188
189config CUSTOM_LINKER_SCRIPT
190	string "Path to custom linker script"
191	depends on HAVE_CUSTOM_LINKER_SCRIPT
192	help
193	  Path to the linker script to be used instead of the one define by the
194	  board.
195
196	  The linker script must be based on a version provided by Zephyr since
197	  the kernel can expect a certain layout/certain regions.
198
199	  This is useful when an application needs to add sections into the
200	  linker script and avoid having to change the script provided by
201	  Zephyr.
202
203config KERNEL_ENTRY
204	string "Kernel entry symbol"
205	default "__start"
206	help
207	  Code entry symbol, to be set at linking phase.
208
209config LINKER_SORT_BY_ALIGNMENT
210	bool "Sort input sections by alignment"
211	default y
212	help
213	  This turns on the linker flag to sort sections by alignment
214	  in decreasing size of symbols. This helps to minimize
215	  padding between symbols.
216
217config SRAM_VECTOR_TABLE
218	bool "Place the vector table in SRAM instead of flash"
219	help
220	  The option specifies that the vector table should be placed at the
221	  start of SRAM instead of the start of flash.
222
223config HAS_SRAM_OFFSET
224	bool
225	help
226	  This option is selected by targets that require SRAM_OFFSET.
227
228config SRAM_OFFSET
229	hex "Kernel SRAM offset" if HAS_SRAM_OFFSET
230	default 0
231	help
232	  This option specifies the byte offset from the beginning of SRAM
233	  where the kernel begins. Changing this value from zero will affect
234	  the Zephyr image's link, and will decrease the total amount of
235	  SRAM available for use by application code.
236
237	  If unsure, leave at the default value 0.
238
239menu "Linker Sections"
240
241config LINKER_USE_BOOT_SECTION
242	bool "Use Boot Linker Section"
243	help
244	  If enabled, the symbols which are needed for the boot process
245	  will be put into another linker section reserved for these
246	  symbols.
247
248	  Requires that boot sections exist in the architecture, SoC,
249	  board or custom linker script.
250
251config LINKER_USE_PINNED_SECTION
252	bool "Use Pinned Linker Section"
253	help
254	  If enabled, the symbols which need to be pinned in memory
255	  will be put into another linker section reserved for pinned
256	  symbols. During boot, the corresponding memory will be marked
257	  as pinned.
258
259	  Requires that pinned sections exist in the architecture, SoC,
260	  board or custom linker script.
261
262config LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT
263	bool "Generic sections are present at boot" if DEMAND_PAGING && LINKER_USE_PINNED_SECTION
264	default y
265	help
266	  When disabled, the linker sections other than the boot and
267	  pinned sections will be marked as not present in the page
268	  tables. This allows kernel to pull in data pages on demand
269	  as required by current execution context when demand paging
270	  is enabled. There is no need to load all code and data into
271	  memory at once.
272
273	  If unsure, say Y.
274
275config LINKER_LAST_SECTION_ID
276	bool "Last section identifier"
277	default y
278	depends on ARM || ARM64 || RISCV
279	help
280	  If enabled, the last section will contain an identifier.
281	  This ensures that the '_flash_used' linker symbol will always be
282	  correctly calculated, even in cases where the location counter may
283	  have been incremented for alignment purposes but no data is placed
284	  after alignment.
285
286	  Note: in cases where the flash is fully used, for example application
287	  specific data is written at the end of the flash area, then writing a
288	  last section identifier may cause rom region overflow.
289	  In such cases this setting should be disabled.
290
291config LINKER_LAST_SECTION_ID_PATTERN
292	hex "Last section identifier pattern"
293	default "0xE015E015"
294	depends on LINKER_LAST_SECTION_ID
295	help
296	  Pattern to fill into last section as identifier.
297	  Default pattern is 0xE015 (end of last section), but any pattern can
298	  be used.
299	  The size of the pattern must not exceed 4 bytes.
300
301config LINKER_USE_NO_RELAX
302	bool
303	help
304	  Hidden symbol to allow features to force the use of no relax.
305
306config LINKER_USE_RELAX
307	bool "Linker optimization of call addressing"
308	depends on !LINKER_USE_NO_RELAX
309	default y
310	help
311	  This option performs global optimizations that become possible when the linker resolves
312	  addressing in the program, such as relaxing address modes and synthesizing new
313	  instructions in the output object file. For ld and lld, this enables `--relax`.
314	  On platforms where this is not supported, `--relax' is accepted, but ignored.
315	  Disabling it can reduce performance, as the linker is no longer able to substiture long /
316	  in-effective jump calls to shorter / more effective instructions.
317
318endmenu # "Linker Sections"
319
320config LINKER_DEVNULL_SUPPORT
321	bool
322	default y if CPU_CORTEX_M || (RISCV && !64BIT)
323
324config LINKER_DEVNULL_MEMORY
325	bool "Devnull region"
326	depends on LINKER_DEVNULL_SUPPORT
327	help
328	  Devnull region is created. It is stripped from final binary but remains
329	  in byproduct elf file.
330
331config LINKER_DEVNULL_MEMORY_SIZE
332	int "Devnull region size"
333	depends on LINKER_DEVNULL_MEMORY
334	default 262144
335	help
336	  Size can be adjusted so it fits all data placed in that region.
337
338endmenu
339
340menu "Compiler Options"
341
342config CODING_GUIDELINE_CHECK
343	bool "Enforce coding guideline rules"
344	help
345	  Use available compiler flags to check coding guideline rules during
346	  the build.
347
348config NATIVE_LIBC
349	bool
350	select FULL_LIBC_SUPPORTED
351	help
352	  Zephyr will use the host system C library.
353
354config NATIVE_LIBCPP
355	bool
356	select FULL_LIBCPP_SUPPORTED
357	help
358	  Zephyr will use the host system C++ library
359
360config NATIVE_BUILD
361	bool
362	select NATIVE_LIBC if EXTERNAL_LIBC
363	select NATIVE_LIBCPP if EXTERNAL_LIBCPP
364	help
365	  Zephyr will be built targeting the host system for debug and
366	  development purposes.
367
368config NATIVE_APPLICATION
369	bool
370	default y if ARCH_POSIX
371	depends on !NATIVE_LIBRARY
372	select NATIVE_BUILD
373	help
374	  Build as a native application that can run on the host and using
375	  resources and libraries provided by the host.
376
377config NATIVE_LIBRARY
378	bool
379	select NATIVE_BUILD
380	help
381	  Build as a prelinked library for the native host target.
382	  This library can later be built into an executable for the host.
383
384config COMPILER_FREESTANDING
385	bool "Build in a freestanding compiler mode"
386	help
387	  Configure the compiler to operate in freestanding mode according to
388	  the C and C++ language specifications. Freestanding mode reduces the
389	  requirements of the compiler and language environment, which can
390	  negatively impact the ability for the compiler to detect errors and
391	  perform optimizations.
392
393choice COMPILER_OPTIMIZATIONS
394	prompt "Optimization level"
395	default NO_OPTIMIZATIONS    if COVERAGE
396	default DEBUG_OPTIMIZATIONS if DEBUG
397	default SIZE_OPTIMIZATIONS
398	help
399	  Note that these flags shall only control the compiler
400	  optimization level, and that no extra debug code shall be
401	  conditionally compiled based on them.
402
403config SIZE_OPTIMIZATIONS
404	bool "Optimize for size"
405	help
406	  Compiler optimizations will be set to -Os independently of other
407	  options.
408
409config SPEED_OPTIMIZATIONS
410	bool "Optimize for speed"
411	help
412	  Compiler optimizations will be set to -O2 independently of other
413	  options.
414
415config DEBUG_OPTIMIZATIONS
416	bool "Optimize debugging experience"
417	help
418	  Compiler optimizations will be set to -Og independently of other
419	  options.
420
421config NO_OPTIMIZATIONS
422	bool "Optimize nothing"
423	help
424	  Compiler optimizations will be set to -O0 independently of other
425	  options.
426
427	  Selecting this option will likely require manual tuning of the
428	  default stack sizes in order to avoid stack overflows.
429endchoice
430
431config LTO
432	bool "Link Time Optimization [EXPERIMENTAL]"
433	depends on (!(GEN_ISR_TABLES || GEN_IRQ_VECTOR_TABLE) || ISR_TABLES_LOCAL_DECLARATION) && !NATIVE_LIBRARY
434	select EXPERIMENTAL
435	help
436	  This option enables Link Time Optimization.
437
438config COMPILER_WARNINGS_AS_ERRORS
439	bool "Treat warnings as errors"
440	help
441	  Turn on "warning as error" toolchain flags
442
443config COMPILER_SAVE_TEMPS
444	bool "Save temporary object files"
445	help
446	  Instruct the compiler to save the temporary intermediate files
447	  permanently. These can be useful for troubleshooting build issues.
448
449config COMPILER_TRACK_MACRO_EXPANSION
450	bool "Track macro expansion"
451	default y
452	help
453	  When enabled, locations of tokens across macro expansions will be
454	  tracked. Disabling this option may be useful to debug long macro
455	  expansion chains.
456
457config COMPILER_COLOR_DIAGNOSTICS
458	bool "Colored diagnostics"
459	default y
460	help
461	  Compiler diagnostic messages are colorized.
462
463choice COMPILER_SECURITY_FORTIFY
464	prompt "Detect buffer overflows in libc calls"
465	default FORTIFY_SOURCE_NONE if NO_OPTIMIZATIONS || MINIMAL_LIBC || NATIVE_BUILD
466	default FORTIFY_SOURCE_COMPILE_TIME
467	help
468	  Buffer overflow checking in libc calls. Supported by Clang and
469	  GCC when using Picolibc or Newlib. Requires compiler optimization
470	  to be enabled.
471
472config FORTIFY_SOURCE_NONE
473	bool "No detection"
474	help
475	  Disables both compile-time and run-time checking.
476
477config FORTIFY_SOURCE_COMPILE_TIME
478	bool "Compile-time detection"
479	help
480	  Enables only compile-time checking. Compile-time checking
481	  doesn't increase executable size or reduce performance, it
482	  limits checking to what can be done with information available
483	  at compile time.
484
485config FORTIFY_SOURCE_RUN_TIME
486	bool "Compile-time and run-time detection"
487	help
488	  Enables both compile-time and run-time checking. Run-time
489	  checking increases coverage at the expense of additional code,
490	  and means that applications will raise a runtime exception
491	  when buffer overflow is detected.
492
493endchoice
494
495config COMPILER_OPT
496	string "Custom compiler options"
497	help
498	  This option is a free-form string that is passed to the compiler
499	  when building all parts of a project (i.e. kernel).
500	  The compiler options specified by this string supplement the
501	  predefined set of compiler supplied by the build system,
502	  and can be used to change compiler optimization, warning and error
503	  messages, and so on.
504
505config MISRA_SANE
506	bool "MISRA standards compliance features"
507	help
508	  Causes the source code to build in "MISRA" mode, which
509	  disallows some otherwise-permitted features of the C
510	  standard for safety reasons.  Specifically variable length
511	  arrays are not permitted (and gcc will enforce this).
512
513endmenu
514
515choice
516	prompt "Error checking behavior for CHECK macro"
517	default RUNTIME_ERROR_CHECKS
518
519config ASSERT_ON_ERRORS
520	bool "Assert on all errors"
521	help
522	  Assert on errors covered with the CHECK macro.
523
524config NO_RUNTIME_CHECKS
525	bool "No runtime error checks"
526	help
527	  Do not do any runtime checks or asserts when using the CHECK macro.
528
529config RUNTIME_ERROR_CHECKS
530	bool "Runtime error checks"
531	help
532	  Always perform runtime checks covered with the CHECK macro. This
533	  option is the default and the only option used during testing.
534
535endchoice
536
537menu "Build Options"
538
539config KERNEL_BIN_NAME
540	string "The kernel binary name"
541	default "zephyr"
542	help
543	  This option sets the name of the generated kernel binary.
544
545config OUTPUT_STAT
546	bool "Create a statistics file"
547	default y
548	help
549	  Create a stat file using readelf -e <elf>
550
551config OUTPUT_SYMBOLS
552	bool "Create a symbol file"
553	help
554	  Create a symbol file using nm <elf>
555
556config OUTPUT_DISASSEMBLY
557	bool "Create a disassembly file"
558	help
559	  Create an .lst file with the assembly listing of the firmware.
560
561config OUTPUT_DISASSEMBLE_ALL
562	bool "Disassemble all sections with source. Fill zeros."
563	default n
564	depends on OUTPUT_DISASSEMBLY
565	help
566	  The .lst file will contain complete disassembly of the firmware
567	  not just those expected to contain instructions including zeros
568
569config OUTPUT_PRINT_MEMORY_USAGE
570	bool "Print memory usage to stdout"
571	default y
572	help
573	  If the toolchain supports it, this option will pass
574	  --print-memory-region to the linker when it is doing it's first
575	  linker pass. Note that the memory regions are symbolic concepts
576	  defined by the linker scripts and do not necessarily map
577	  directly to the real physical address space. Take also note that
578	  some platforms do two passes of the linker so the results do not
579	  match exactly to the final elf file. See also rom_report,
580	  ram_report and
581	  https://sourceware.org/binutils/docs/ld/MEMORY.html
582
583config CLEANUP_INTERMEDIATE_FILES
584	bool "Remove all intermediate files"
585	help
586	  Delete intermediate files to save space and cleanup clutter resulting
587	  from the build process. Note this breaks incremental builds, west spdx
588	  (Software Bill of Material generation), and maybe others.
589
590config BUILD_NO_GAP_FILL
591	bool "Don't fill gaps in generated hex/bin/s19 files."
592
593config BUILD_OUTPUT_HEX
594	bool "Build a binary in HEX format"
595	help
596	  Build an Intel HEX binary zephyr/zephyr.hex in the build directory.
597	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
598
599config BUILD_OUTPUT_BIN
600	bool "Build a binary in BIN format"
601	default y
602	help
603	  Build a "raw" binary zephyr/zephyr.bin in the build directory.
604	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
605
606config BUILD_OUTPUT_EFI
607	bool "Build as an EFI application"
608	default n
609	depends on X86_64
610	help
611	  Build as an EFI application.
612
613	  This works by creating a "zephyr.efi" EFI binary containing a zephyr
614	  image extracted from a built zephyr.elf file.  EFI applications are
615	  relocatable, and cannot be placed at specific locations in memory.
616	  Instead, the stub code will copy the embedded zephyr sections to the
617	  appropriate locations at startup, clear any zero-filled (BSS, etc...)
618	  areas, then jump into the 64 bit entry point.
619
620config BUILD_OUTPUT_EXE
621	bool "Build a binary in ELF format with .exe extension"
622	help
623	  Build an ELF binary that can run in the host system at
624	  zephyr/zephyr.exe in the build directory.
625	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
626
627config BUILD_OUTPUT_S19
628	bool "Build a binary in S19 format"
629	help
630	  Build an S19 binary zephyr/zephyr.s19 in the build directory.
631	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
632
633config BUILD_OUTPUT_UF2
634	bool "Build a binary in UF2 format"
635	depends on BUILD_OUTPUT_BIN
636	help
637	  Build a UF2 binary zephyr/zephyr.uf2 in the build directory.
638	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
639
640if BUILD_OUTPUT_UF2
641
642config BUILD_OUTPUT_UF2_FAMILY_ID
643	string "UF2 device family ID"
644	default "0x1c5f21b0" if SOC_SERIES_ESP32
645	default "0x621e937a" if SOC_NRF52833_QIAA
646	default "0xada52840" if SOC_NRF52840_QIAA
647	default "0x4fb2d5bd" if SOC_SERIES_IMX_RT
648	default "0x2abc77ec" if SOC_SERIES_LPC55XXX
649	default "0xe48bff56" if SOC_SERIES_RP2XXX
650	default "0x68ed2b88" if SOC_SERIES_SAMD21
651	default "0x55114460" if SOC_SERIES_SAMD51
652	default "0x647824b6" if SOC_SERIES_STM32F0X
653	default "0x5d1a0a2e" if SOC_SERIES_STM32F2X
654	default "0x6b846188" if SOC_SERIES_STM32F3X
655	default "0x53b80f00" if SOC_SERIES_STM32F7X
656	default "0x300f5633" if SOC_SERIES_STM32G0X
657	default "0x4c71240a" if SOC_SERIES_STM32G4X
658	default "0x6db66082" if SOC_SERIES_STM32H7X
659	default "0x202e3a91" if SOC_SERIES_STM32L0X
660	default "0x1e1f432d" if SOC_SERIES_STM32L1X
661	default "0x00ff6919" if SOC_SERIES_STM32L4X
662	default "0x04240bdf" if SOC_SERIES_STM32L5X
663	default "0x70d16653" if SOC_SERIES_STM32WBX
664	default "0x5ee21072" if SOC_STM32F103XE
665	default "0x57755a57" if SOC_SERIES_STM32F4X && (!SOC_STM32F407XE) && (!SOC_STM32F407XG)
666	default "0x6d0922fa" if SOC_STM32F407XE
667	default "0x8fb060fe" if SOC_STM32F407XG
668	help
669	  UF2 bootloaders only accept UF2 files with a matching family ID.
670	  This can be either a hex, e.g. 0x68ed2b88, or well-known family
671	  name string. If the SoC in use is known by UF2, the Family ID will
672	  be pre-filled with the known value.
673
674config BUILD_OUTPUT_UF2_USE_FLASH_BASE
675	bool
676	default n
677
678config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET
679	bool
680	default n
681
682endif # BUILD_OUTPUT_UF2
683
684config BUILD_OUTPUT_STRIPPED
685	bool "Build a stripped binary"
686	help
687	  Build a stripped binary zephyr/zephyr.strip in the build directory.
688	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.
689
690config BUILD_OUTPUT_ADJUST_LMA
691	string
692	help
693	  This will adjust the LMA address in the final ELF and hex files with
694	  the value provided.
695	  This will not affect the internal address symbols inside the image but
696	  can be useful when adjusting the LMA address for flash tools or multi
697	  stage loaders where a pre-loader may copy image to a second location
698	  before booting a second core.
699	  The value will be evaluated as a math expression, this means that
700	  following are valid expression
701	  - 1024
702	  - 0x1000
703	  - -0x1000
704	  - 0x20000000 - 0x10000000
705	  Note: negative numbers are valid.
706	  To adjust according to a chosen flash partition one can specify a
707	  default as:
708	  DT_CHOSEN_IMAGE_<name> := <name>,<name>-partition
709	  DT_CHOSEN_Z_FLASH := zephyr,flash
710	  config BUILD_OUTPUT_ADJUST_LMA
711	    default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_IMAGE_M4))-\
712	             $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))"
713
714config BUILD_OUTPUT_INFO_HEADER
715	bool "Create a image information header"
716	help
717	  Create an image information header which will contain image
718	  information from the Zephyr binary.
719	  Example of information contained in the header file:
720	  - Number of segments in the image
721	  - LMA address of each segment
722	  - VMA address of each segment
723	  - Size of each segment
724
725config BUILD_ALIGN_LMA
726	bool "Align LMA in output image"
727	default y if BUILD_OUTPUT_ADJUST_LMA!=""
728	help
729	  Ensure that the LMA for each section in the output image respects
730	  the alignment requirements of that section. This is required for
731	  some tooling, such as objcopy, to be able to adjust the LMA of the
732	  ELF file.
733
734config APPLICATION_DEFINED_SYSCALL
735	bool "Scan application folder for any syscall definition"
736	help
737	  Scan additional folders inside application source folder
738	  for application defined syscalls.
739
740config MAKEFILE_EXPORTS
741	bool "Generate build metadata files named Makefile.exports"
742	help
743	  Generates a file with build information that can be read by
744	  third party Makefile-based build systems.
745
746config BUILD_OUTPUT_META
747	bool "Create a build meta file"
748	help
749	  Create a build meta file in the build directory containing lists of:
750	  - Zephyr: path and revision (if git repo)
751	  - Zephyr modules: name, path, and revision (if git repo)
752	  - West:
753	    - manifest: path and revision
754	    - projects: path and revision
755	  - Workspace:
756	    - dirty: one or more repositories are marked dirty
757	    - extra: extra Zephyr modules are manually included in the build
758	    - off:   the SHA of one or more west projects are not what the manifest
759	             defined when `west update` was run the last time (`manifest-rev`).
760	             The off state is only present if a west workspace is found.
761	  File extension is .meta
762
763config BUILD_OUTPUT_META_STATE_PROPAGATE
764	bool "Propagate module and project state"
765	depends on BUILD_OUTPUT_META
766	help
767	  Propagate to state of each module to the Zephyr revision field.
768	  If west is used the state of each west project is also propagated to
769	  the Zephyr revision field.
770	  West manifest repo revision field will also
771	  be marked with the same state as the Zephyr revision.
772	  The final revision will become: <SHA>-<state1>-<state2>-<state3>...
773	  If no states are appended to the SHA it means the build is of a clean
774	  tree.
775	  - dirty: one or more repositories are marked dirty
776	  - extra: extra Zephyr modules are manually included in the build
777	  - off:   the SHA of one or more west projects are not what the manifest
778	           defined when `west update` was run the last time (`manifest-rev`).
779	           The off state is only present if a west workspace is found.
780
781config BUILD_OUTPUT_STRIP_PATHS
782	bool "Strip absolute paths from binaries"
783	default y
784	help
785	  If the compiler supports it, strip the ${ZEPHYR_BASE} prefix from the
786	  __FILE__ macro used in __ASSERT*, in the
787	  .noinit."/home/joe/zephyr/fu/bar.c" section names and in any
788	  application code.
789	  This saves some memory, stops leaking user locations in binaries, makes
790	  failure logs more deterministic and most importantly makes builds more
791	  deterministic.
792	  Debuggers usually have a path mapping feature to ensure the files are
793	  still found.
794
795config CHECK_INIT_PRIORITIES
796	bool "Build time initialization priorities check"
797	default y
798	# If we are building a native_simulator target, we can only check the init priorities
799	# if we are building the final output but we are not assembling several images together
800	depends on !(NATIVE_LIBRARY && (!BUILD_OUTPUT_EXE || NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS != ""))
801	depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "armclang"
802	help
803	  Check the build for initialization priority issues by comparing the
804	  initialization priority in the build with the device dependency
805	  derived from the devicetree definition.
806
807	  Fails the build on priority errors (dependent devices, inverted
808	  priority).
809
810config EMIT_ALL_SYSCALLS
811	bool "Emit all possible syscalls in the tree"
812	help
813	  This tells the build system to emit all possible syscalls found
814	  in the tree, instead of only those syscalls associated with enabled
815	  drivers and subsystems.
816
817endmenu
818
819config DEPRECATED
820	bool
821	help
822	  Symbol that must be selected by a feature or module if it is
823	  considered to be deprecated.
824
825config WARN_DEPRECATED
826	bool
827	default y
828	prompt "Warn on deprecated usage"
829	help
830	  Print a warning when the Kconfig tree is parsed if any deprecated
831	  features are enabled.
832
833config EXPERIMENTAL
834	bool
835	help
836	  Symbol that must be selected by a feature if it is considered to be
837	  at an experimental implementation stage.
838
839config WARN_EXPERIMENTAL
840	bool
841	prompt "Warn on experimental usage"
842	help
843	  Print a warning when the Kconfig tree is parsed if any experimental
844	  features are enabled.
845
846config TAINT
847	bool
848	help
849	  Symbol that must be selected by a feature or module if the Zephyr
850	  build is considered tainted.
851
852config ENFORCE_ZEPHYR_STDINT
853	bool
854	prompt "Enforce Zephyr convention for stdint"
855	depends on !ARCH_POSIX
856	default y
857	help
858	  This enforces the Zephyr stdint convention where int32_t = int,
859	  int64_t = long long, and intptr_t = long so that short string
860	  format length modifiers can be used universally across ILP32
861	  and LP64 architectures. Sometimes this is not possible e.g. when
862	  linking against a binary-only C++ library whose type mangling
863	  is incompatible with the Zephyr convention, or if the build
864	  environment doesn't allow such enforcement, in which case this
865	  should be turned off with the caveat that argument type validation
866	  on Zephyr code will be skipped.
867
868endmenu
869
870
871menu "Boot Options"
872
873config IS_BOOTLOADER
874	bool "Act as a bootloader"
875	depends on XIP
876	depends on ARM
877	help
878	  This option indicates that Zephyr will act as a bootloader to execute
879	  a separate Zephyr image payload.
880
881config BOOTLOADER_SRAM_SIZE
882	int "SRAM reserved for bootloader [DEPRECATED]"
883	default 0
884	depends on !XIP || IS_BOOTLOADER
885	depends on ARM || XTENSA
886	help
887	  This option specifies the amount of SRAM (measure in kB) reserved for
888	  a bootloader image, when either:
889	  - the Zephyr image itself is to act as the bootloader, or
890	  - Zephyr is a !XIP image, which implicitly assumes existence of a
891	  bootloader that loads the Zephyr !XIP image onto SRAM.
892
893	  This option is deprecated, users should transition to using DTS to set this, if needed.
894	  To be removed after Zephyr 3.7 release.
895
896config BOOTLOADER_SRAM_SIZE_DEPRECATED
897	bool
898	default y
899	select DEPRECATED
900	depends on BOOTLOADER_SRAM_SIZE != 0
901	depends on !XIP || IS_BOOTLOADER
902	depends on ARM || XTENSA
903	help
904	  Non-prompt symbol to indicate that the deprecated BOOTLOADER_SRAM_SIZE Kconfig has a
905	  non-0 value. Please transition to using devicetree.
906
907config BOOTLOADER_ESP_IDF
908	bool "ESP-IDF bootloader support"
909	depends on SOC_FAMILY_ESP32 && !BOOTLOADER_MCUBOOT && !MCUBOOT
910	default	y
911	help
912	  This option will trigger the compilation of the ESP-IDF bootloader
913	  inside the build folder.
914	  At flash time, the bootloader will be flashed with the zephyr image
915
916config BOOTLOADER_BOSSA
917	bool "BOSSA bootloader support"
918	select USE_DT_CODE_PARTITION
919
920	help
921	  Signifies that the target uses a BOSSA compatible bootloader.  If CDC
922	  ACM USB support is also enabled then the board will reboot into the
923	  bootloader automatically when bossac is run.
924
925config BOOTLOADER_BOSSA_DEVICE_NAME
926	string "BOSSA CDC ACM device name"
927	depends on BOOTLOADER_BOSSA && CDC_ACM_DTE_RATE_CALLBACK_SUPPORT
928	default "CDC_ACM_0"
929	help
930	  Sets the CDC ACM port to watch for reboot commands.
931
932choice
933	prompt "BOSSA bootloader variant"
934	depends on BOOTLOADER_BOSSA
935
936config BOOTLOADER_BOSSA_LEGACY
937	bool "Legacy"
938	help
939	  Select the Legacy variant of the BOSSA bootloader.  This is defined
940	  for compatibility mode only.  The recommendation is use newer
941	  versions like Arduino or Adafruit UF2.
942
943config BOOTLOADER_BOSSA_ARDUINO
944	bool "Arduino"
945	help
946	  Select the Arduino variant of the BOSSA bootloader.  Uses 0x07738135
947	  as the magic value to enter the bootloader.
948
949config BOOTLOADER_BOSSA_ADAFRUIT_UF2
950	bool "Adafruit UF2"
951	help
952	  Select the Adafruit UF2 variant of the BOSSA bootloader.  Uses
953	  0xf01669ef as the magic value to enter the bootloader.
954
955endchoice
956
957endmenu
958