Boot Linux faster!

Check our new training course

Boot Linux faster!

Check our new training course
and Creative Commons CC-BY-SA
lecture and lab materials

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# General configuration options

# Copyright (c) 2014-2015 Wind River Systems, Inc.
# Copyright (c) 2016 Intel Corporation
# SPDX-License-Identifier: Apache-2.0


# Include Kconfig.defconfig files first so that they can override defaults and
# other symbol/choice properties by adding extra symbol/choice definitions.
# After merging all definitions for a symbol/choice, Kconfig picks the first
# property (e.g. the first default) with a satisfied condition.
#
# Shield defaults should have precedence over board defaults, which should have
# precedence over SoC defaults, so include them in that order.
#
# $ARCH and $BOARD_DIR will be glob patterns when building documentation.
source "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig"
source "$(BOARD_DIR)/Kconfig.defconfig"
source "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig"

menu "Modules"

source "modules/Kconfig"

endmenu

source "boards/Kconfig"
source "soc/Kconfig"
source "arch/Kconfig"
source "kernel/Kconfig"
source "dts/Kconfig"
source "drivers/Kconfig"
source "lib/Kconfig"
source "subsys/Kconfig"

osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig"

menu "Build and Link Features"

menu "Linker Options"

choice
	prompt "Linker Orphan Section Handling"
	default LINKER_ORPHAN_SECTION_WARN

config LINKER_ORPHAN_SECTION_PLACE
	bool "Place"
	help
	  Linker puts orphan sections in place without warnings
	  or errors.

config LINKER_ORPHAN_SECTION_WARN
	bool "Warn"
	help
	  Linker places the orphan sections in output and issues
	  warning about those sections.

config LINKER_ORPHAN_SECTION_ERROR
	bool "Error"
	help
	  Linker exits with error when an orphan section is found.

endchoice

config HAS_FLASH_LOAD_OFFSET
	bool
	help
	  This option is selected by targets having a FLASH_LOAD_OFFSET
	  and FLASH_LOAD_SIZE.

if HAS_FLASH_LOAD_OFFSET

config USE_DT_CODE_PARTITION
	bool "Link application into /chosen/zephyr,code-partition from devicetree"
	help
	  When enabled, the application will be linked into the flash partition
	  selected by the zephyr,code-partition property in /chosen in devicetree.
	  When this is disabled, the flash load offset and size can be set manually
	  below.

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition

config FLASH_LOAD_OFFSET
	# Only user-configurable when USE_DT_CODE_PARTITION is disabled
	hex "Kernel load offset" if !USE_DT_CODE_PARTITION
	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
	default 0
	help
	  This option specifies the byte offset from the beginning of flash that
	  the kernel should be loaded into. Changing this value from zero will
	  affect the Zephyr image's link, and will decrease the total amount of
	  flash available for use by application code.

	  If unsure, leave at the default value 0.

config FLASH_LOAD_SIZE
	# Only user-configurable when USE_DT_CODE_PARTITION is disabled
	hex "Kernel load size" if !USE_DT_CODE_PARTITION
	default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) if USE_DT_CODE_PARTITION
	default 0
	help
	  If non-zero, this option specifies the size, in bytes, of the flash
	  area that the Zephyr image will be allowed to occupy.  If zero, the
	  image will be able to occupy from the FLASH_LOAD_OFFSET to the end of
	  the device.

	  If unsure, leave at the default value 0.

endif # HAS_FLASH_LOAD_OFFSET

config ROM_START_OFFSET
	hex
	prompt "ROM start offset" if !BOOTLOADER_MCUBOOT
	default 0x200 if BOOTLOADER_MCUBOOT
	default 0
	help
	  If the application is built for chain-loading by a bootloader this
	  variable is required to be set to value that leaves sufficient
	  space between the beginning of the image and the start of the first
	  section to store an image header or any other metadata.
	  In the particular case of the MCUboot bootloader this reserves enough
	  space to store the image header, which should also meet vector table
	  alignment requirements on most ARM targets, although some targets
	  may require smaller or larger values.

config HAVE_CUSTOM_LINKER_SCRIPT
	bool "Custom linker scripts provided"
	help
	  Set this option if you have a custom linker script which needed to
	  be define in CUSTOM_LINKER_SCRIPT.

config CUSTOM_LINKER_SCRIPT
	string "Path to custom linker script"
	depends on HAVE_CUSTOM_LINKER_SCRIPT
	help
	  Path to the linker script to be used instead of the one define by the
	  board.

	  The linker script must be based on a version provided by Zephyr since
	  the kernel can expect a certain layout/certain regions.

	  This is useful when an application needs to add sections into the
	  linker script and avoid having to change the script provided by
	  Zephyr.

config KERNEL_ENTRY
	string "Kernel entry symbol"
	default "__start"
	help
	  Code entry symbol, to be set at linking phase.

config LINKER_SORT_BY_ALIGNMENT
	bool "Sort input sections by alignment"
	default y
	help
	  This turns on the linker flag to sort sections by alignment
	  in decreasing size of symbols. This helps to minimize
	  padding between symbols.

config SRAM_VECTOR_TABLE
	bool "Place the vector table in SRAM instead of flash"
	help
	  The option specifies that the vector table should be placed at the
	  start of SRAM instead of the start of flash.

config HAS_SRAM_OFFSET
	bool
	help
	  This option is selected by targets that require SRAM_OFFSET.

config SRAM_OFFSET
	hex "Kernel SRAM offset" if HAS_SRAM_OFFSET
	default 0
	help
	  This option specifies the byte offset from the beginning of SRAM
	  where the kernel begins. Changing this value from zero will affect
	  the Zephyr image's link, and will decrease the total amount of
	  SRAM available for use by application code.

	  If unsure, leave at the default value 0.

menu "Linker Sections"

config LINKER_USE_BOOT_SECTION
	bool "Enable Usage of Boot Linker Section"
	help
	  If enabled, the symbols which are needed for the boot process
	  will be put into another linker section reserved for these
	  symbols.

	  Requires that boot sections exist in the architecture, SoC,
	  board or custom linker script.

config LINKER_USE_PINNED_SECTION
	bool "Enable Usage of Pinned Linker Section"
	help
	  If enabled, the symbols which need to be pinned in memory
	  will be put into another linker section reserved for pinned
	  symbols. During boot, the corresponding memory will be marked
	  as pinned.

	  Requires that pinned sections exist in the architecture, SoC,
	  board or custom linker script.

endmenu # "Linker Sections"

endmenu

menu "Compiler Options"

config CODING_GUIDELINE_CHECK
	bool "Enforce coding guideline rules"
	help
	  Use available compiler flags to check coding guideline rules during
	  the build.

config NATIVE_APPLICATION
	bool "Build as a native host application"
	help
	  Build as a native application that can run on the host and using
	  resources and libraries provided by the host.

choice
	prompt "Optimization level"
	default NO_OPTIMIZATIONS    if COVERAGE
	default DEBUG_OPTIMIZATIONS if DEBUG
	default SIZE_OPTIMIZATIONS
	help
	  Note that these flags shall only control the compiler
	  optimization level, and that no extra debug code shall be
	  conditionally compiled based on them.

config SIZE_OPTIMIZATIONS
	bool "Optimize for size"
	help
	  Compiler optimizations will be set to -Os independently of other
	  options.

config SPEED_OPTIMIZATIONS
	bool "Optimize for speed"
	help
	  Compiler optimizations will be set to -O2 independently of other
	  options.

config DEBUG_OPTIMIZATIONS
	bool "Optimize debugging experience"
	help
	  Compiler optimizations will be set to -Og independently of other
	  options.

config NO_OPTIMIZATIONS
	bool "Optimize nothing"
	help
	  Compiler optimizations will be set to -O0 independently of other
	  options.

endchoice

config COMPILER_COLOR_DIAGNOSTICS
	bool "Enable colored diganostics"
	default y
	help
	  Compiler diagnostic messages are colorized.

config COMPILER_OPT
	string "Custom compiler options"
	help
	  This option is a free-form string that is passed to the compiler
	  when building all parts of a project (i.e. kernel).
	  The compiler options specified by this string supplement the
	  predefined set of compiler supplied by the build system,
	  and can be used to change compiler optimization, warning and error
	  messages, and so on.

config MISRA_SANE
	bool "MISRA standards compliance features"
	help
	  Causes the source code to build in "MISRA" mode, which
	  disallows some otherwise-permitted features of the C
	  standard for safety reasons.  Specifically variable length
	  arrays are not permitted (and gcc will enforce this).

endmenu

choice
	prompt "Error checking behavior for CHECK macro"
	default RUNTIME_ERROR_CHECKS

config ASSERT_ON_ERRORS
	bool "Assert on all errors"
	help
	  Assert on errors covered with the CHECK macro.

config NO_RUNTIME_CHECKS
	bool "No runtime error checks"
	help
	  Do not do any runtime checks or asserts when using the CHECK macro.

config RUNTIME_ERROR_CHECKS
	bool "Enable runtime error checks"
	help
	  Always perform runtime checks covered with the CHECK macro. This
	  option is the default and the only option used during testing.

endchoice

menu "Build Options"

config KERNEL_BIN_NAME
	string "The kernel binary name"
	default "zephyr"
	help
	  This option sets the name of the generated kernel binary.

config OUTPUT_STAT
	bool "Create a statistics file"
	default y
	help
	  Create a stat file using readelf -e <elf>

config OUTPUT_DISASSEMBLY
	bool "Create a disassembly file"
	default y
	help
	  Create an .lst file with the assembly listing of the firmware.

config OUTPUT_DISASSEMBLE_ALL
	bool "Disassemble all sections with source. Fill zeros."
	default n
	depends on OUTPUT_DISASSEMBLY
	help
	  The .lst file will contain complete disassembly of the firmware
	  not just those expected to contain instructions including zeros

config OUTPUT_PRINT_MEMORY_USAGE
	bool "Print memory usage to stdout"
	default y
	help
	  If the toolchain supports it, this option will pass
	  --print-memory-region to the linker when it is doing it's first
	  linker pass. Note that the memory regions are symbolic concepts
	  defined by the linker scripts and do not necessarily map
	  directly to the real physical address space. Take also note that
	  some platforms do two passes of the linker so the results do not
	  match exactly to the final elf file. See also rom_report,
	  ram_report and
	  https://sourceware.org/binutils/docs/ld/MEMORY.html

config CLEANUP_INTERMEDIATE_FILES
	bool "Remove all intermediate files"
	help
	  Delete intermediate files to save space and cleanup clutter resulting
	  from the build process.

config BUILD_NO_GAP_FILL
	bool "Don't fill gaps in generated hex/bin/s19 files."

config BUILD_OUTPUT_HEX
	bool "Build a binary in HEX format"
	help
	  Build an Intel HEX binary zephyr/zephyr.hex in the build directory.
	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

config BUILD_OUTPUT_BIN
	bool "Build a binary in BIN format"
	default y
	help
	  Build a "raw" binary zephyr/zephyr.bin in the build directory.
	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

config BUILD_OUTPUT_EFI
	bool "Build as an EFI application"
	default n
	depends on X86_64
	help
	  Build as an EFI application.

	  This works by creating a "zephyr.efi" EFI binary containing a zephyr
	  image extracted from a built zephyr.elf file.  EFI applications are
	  relocatable, and cannot be placed at specific locations in memory.
	  Instead, the stub code will copy the embedded zephyr sections to the
	  appropriate locations at startup, clear any zero-filled (BSS, etc...)
	  areas, then jump into the 64 bit entry point.

config BUILD_OUTPUT_EXE
	bool "Build a binary in ELF format with .exe extension"
	help
	  Build an ELF binary that can run in the host system at
	  zephyr/zephyr.exe in the build directory.
	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

config BUILD_OUTPUT_S19
	bool "Build a binary in S19 format"
	help
	  Build an S19 binary zephyr/zephyr.s19 in the build directory.
	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

config BUILD_OUTPUT_UF2
	bool "Build a binary in UF2 format"
	depends on BUILD_OUTPUT_BIN
	help
	  Build a UF2 binary zephyr/zephyr.uf2 in the build directory.
	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

if BUILD_OUTPUT_UF2

config BUILD_OUTPUT_UF2_FAMILY_ID
	string "UF2 device family ID"
	default "0x1c5f21b0" if SOC_ESP32
	default "0xada52840" if SOC_NRF52840_QIAA
	default "0x4fb2d5bd" if SOC_SERIES_IMX_RT
	default "0x2abc77ec" if SOC_SERIES_LPC55XXX
	default "0x68ed2b88" if SOC_SERIES_SAMD21
	default "0x55114460" if SOC_SERIES_SAMD51
	default "0x647824b6" if SOC_SERIES_STM32F0X
	default "0x5d1a0a2e" if SOC_SERIES_STM32F2X
	default "0x6b846188" if SOC_SERIES_STM32F3X
	default "0x53b80f00" if SOC_SERIES_STM32F7X
	default "0x300f5633" if SOC_SERIES_STM32G0X
	default "0x4c71240a" if SOC_SERIES_STM32G4X
	default "0x6db66082" if SOC_SERIES_STM32H7X
	default "0x202e3a91" if SOC_SERIES_STM32L0X
	default "0x1e1f432d" if SOC_SERIES_STM32L1X
	default "0x00ff6919" if SOC_SERIES_STM32L4X
	default "0x04240bdf" if SOC_SERIES_STM32L5X
	default "0x70d16653" if SOC_SERIES_STM32WBX
	default "0x5ee21072" if SOC_STM32F103XE
	default "0x57755a57" if SOC_STM32F401XC || SOC_STM32F401XE
	default "0x6d0922fa" if SOC_STM32F407XE
	default "0x8fb060fe" if SOC_STM32F407XG
	help
	  UF2 bootloaders only accept UF2 files with a matching family ID.
	  This can be either a hex, e.g. 0x68ed2b88, or well-known family
	  name string. If the SoC in use is known by UF2, the Family ID will
	  be pre-filled with the known value.

endif # BUILD_OUTPUT_UF2

config BUILD_OUTPUT_STRIPPED
	bool "Build a stripped binary"
	help
	  Build a stripped binary zephyr/zephyr.strip in the build directory.
	  The name of this file can be customized with CONFIG_KERNEL_BIN_NAME.

config APPLICATION_DEFINED_SYSCALL
	bool "Scan application folder for any syscall definition"
	help
	  Scan additional folders inside application source folder
	  for application defined syscalls.

config MAKEFILE_EXPORTS
	bool "Generate build metadata files named Makefile.exports"
	help
	  Generates a file with build information that can be read by
	  third party Makefile-based build systems.

endmenu
endmenu


menu "Boot Options"

config IS_BOOTLOADER
	bool "Act as a bootloader"
	depends on XIP
	depends on ARM
	help
	  This option indicates that Zephyr will act as a bootloader to execute
	  a separate Zephyr image payload.

config BOOTLOADER_SRAM_SIZE
	int "SRAM reserved for bootloader"
	default 16
	depends on !XIP || IS_BOOTLOADER
	depends on ARM || XTENSA
	help
	  This option specifies the amount of SRAM (measure in kB) reserved for
	  a bootloader image, when either:
	  - the Zephyr image itself is to act as the bootloader, or
	  - Zephyr is a !XIP image, which implicitly assumes existence of a
	  bootloader that loads the Zephyr !XIP image onto SRAM.

config MCUBOOT
	bool
	help
	  Hidden option used to indicate that the current image is MCUBoot

config BOOTLOADER_MCUBOOT
	bool "MCUboot bootloader support"
	select USE_DT_CODE_PARTITION
	imply INIT_ARCH_HW_AT_BOOT if ARCH_SUPPORTS_ARCH_HW_INIT
	depends on !MCUBOOT
	help
	  This option signifies that the target uses MCUboot as a bootloader,
	  or in other words that the image is to be chain-loaded by MCUboot.
	  This sets several required build system and Device Tree options in
	  order for the image generated to be bootable using the MCUboot open
	  source bootloader. Currently this includes:

	    * Setting ROM_START_OFFSET to a default value that allows space
	      for the MCUboot image header
	    * Activating SW_VECTOR_RELAY_CLIENT on Cortex-M0
	      (or Armv8-M baseline) targets with no built-in vector relocation
	      mechanisms

	  By default, this option instructs Zephyr to initialize the core
	  architecture HW registers during boot, when this is supported by
	  the application. This removes the need by MCUboot to reset
	  the core registers' state itself.

if BOOTLOADER_MCUBOOT

config MCUBOOT_SIGNATURE_KEY_FILE
	string "Path to the mcuboot signing key file"
	default ""
	help
	  The file contains a key pair whose public half is verified
	  by your target's MCUboot image. The file is in PEM format.

	  If set to a non-empty value, the build system tries to
	  sign the final binaries using a 'west sign -t imgtool' command.
	  The signed binaries are placed in the build directory
	  at zephyr/zephyr.signed.bin and zephyr/zephyr.signed.hex.

	  The file names can be customized with CONFIG_KERNEL_BIN_NAME.
	  The existence of bin and hex files depends on CONFIG_BUILD_OUTPUT_BIN
	  and CONFIG_BUILD_OUTPUT_HEX.

	  This option should contain an absolute path to the same file
	  as the BOOT_SIGNATURE_KEY_FILE option in your MCUboot
	  .config. (The MCUboot config option is used for the MCUboot
	  bootloader image; this option is for your application which
	  is to be loaded by MCUboot. The MCUboot config option can be
	  a relative path from the MCUboot repository root; this option's
	  behavior is undefined for relative paths.)

	  If left empty, you must sign the Zephyr binaries manually.

config MCUBOOT_EXTRA_IMGTOOL_ARGS
	string "Extra arguments to pass to imgtool"
	default ""
	help
	  If CONFIG_MCUBOOT_SIGNATURE_KEY_FILE is a non-empty string,
	  you can use this option to pass extra options to imgtool.
	  For example, you could set this to "--version 1.2".

config MCUBOOT_GENERATE_CONFIRMED_IMAGE
	bool "Also generate a padded, confirmed image"
	help
	  The signed, padded, and confirmed binaries are placed in the build
	  directory at zephyr/zephyr.signed.confirmed.bin and
	  zephyr/zephyr.signed.confirmed.hex.

	  The file names can be customized with CONFIG_KERNEL_BIN_NAME.
	  The existence of bin and hex files depends on CONFIG_BUILD_OUTPUT_BIN
	  and CONFIG_BUILD_OUTPUT_HEX.

endif # BOOTLOADER_MCUBOOT

config BOOTLOADER_ESP_IDF
	bool "ESP-IDF bootloader support"
	depends on SOC_ESP32
	help
	  This option will trigger the compilation of the ESP-IDF bootloader
	  inside the build folder.
	  At flash time, the bootloader will be flashed with the zephyr image

config BOOTLOADER_BOSSA
	bool "BOSSA bootloader support"
	select USE_DT_CODE_PARTITION

	help
	  Signifies that the target uses a BOSSA compatible bootloader.  If CDC
	  ACM USB support is also enabled then the board will reboot into the
	  bootloader automatically when bossac is run.

config BOOTLOADER_BOSSA_DEVICE_NAME
	string "BOSSA CDC ACM device name"
	depends on BOOTLOADER_BOSSA && CDC_ACM_DTE_RATE_CALLBACK_SUPPORT
	default "CDC_ACM_0"
	help
	  Sets the CDC ACM port to watch for reboot commands.

choice
	prompt "BOSSA bootloader variant"
	depends on BOOTLOADER_BOSSA

config BOOTLOADER_BOSSA_LEGACY
	bool "Legacy"
	help
	  Select the Legacy variant of the BOSSA bootloader.  This is defined
	  for compatibility mode only.  The recommendation is use newer
	  versions like Arduino or Adafruit UF2.

config BOOTLOADER_BOSSA_ARDUINO
	bool "Arduino"
	help
	  Select the Arduino variant of the BOSSA bootloader.  Uses 0x07738135
	  as the magic value to enter the bootloader.

config BOOTLOADER_BOSSA_ADAFRUIT_UF2
	bool "Adafruit UF2"
	help
	  Select the Adafruit UF2 variant of the BOSSA bootloader.  Uses
	  0xf01669ef as the magic value to enter the bootloader.

endchoice

endmenu

menu "Compatibility"

config COMPAT_INCLUDES
	bool "Suppress warnings when using header shims"
	default y
	help
	  Suppress any warnings from the pre-processor when including
	  deprecated header files.

endmenu