1# Kernel configuration options 2 3# Copyright (c) 2014-2015 Wind River Systems, Inc. 4# SPDX-License-Identifier: Apache-2.0 5 6menu "General Kernel Options" 7 8module = KERNEL 9module-str = kernel 10source "subsys/logging/Kconfig.template.log_config" 11 12config MULTITHREADING 13 bool "Multi-threading" if ARCH_HAS_SINGLE_THREAD_SUPPORT 14 default y 15 help 16 If disabled, only the main thread is available, so a main() function 17 must be provided. Interrupts are available. Kernel objects will most 18 probably not behave as expected, especially with regards to pending, 19 since the main thread cannot pend, it being the only thread in the 20 system. 21 22 Many drivers and subsystems will not work with this option 23 set to 'n'; disable only when you REALLY know what you are 24 doing. 25 26config NUM_COOP_PRIORITIES 27 int "Number of coop priorities" if MULTITHREADING 28 default 1 if !MULTITHREADING 29 default 16 30 range 0 128 31 help 32 Number of cooperative priorities configured in the system. Gives access 33 to priorities: 34 35 K_PRIO_COOP(0) to K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1) 36 37 or seen another way, priorities: 38 39 -CONFIG_NUM_COOP_PRIORITIES to -1 40 41 This can be set to zero to disable cooperative scheduling. Cooperative 42 threads always preempt preemptible threads. 43 44 The total number of priorities is 45 46 NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1 47 48 The extra one is for the idle thread, which must run at the lowest 49 priority, and be the only thread at that priority. 50 51config NUM_PREEMPT_PRIORITIES 52 int "Number of preemptible priorities" if MULTITHREADING 53 default 0 if !MULTITHREADING 54 default 15 55 range 0 128 56 help 57 Number of preemptible priorities available in the system. Gives access 58 to priorities 0 to CONFIG_NUM_PREEMPT_PRIORITIES - 1. 59 60 This can be set to 0 to disable preemptible scheduling. 61 62 The total number of priorities is 63 64 NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1 65 66 The extra one is for the idle thread, which must run at the lowest 67 priority, and be the only thread at that priority. 68 69config MAIN_THREAD_PRIORITY 70 int "Priority of initialization/main thread" 71 default -2 if !PREEMPT_ENABLED 72 default 0 73 help 74 Priority at which the initialization thread runs, including the start 75 of the main() function. main() can then change its priority if desired. 76 77config COOP_ENABLED 78 def_bool (NUM_COOP_PRIORITIES != 0) 79 80config PREEMPT_ENABLED 81 def_bool (NUM_PREEMPT_PRIORITIES != 0) 82 83config PRIORITY_CEILING 84 int "Priority inheritance ceiling" 85 default -127 86 help 87 This defines the minimum priority value (i.e. the logically 88 highest priority) that a thread will acquire as part of 89 k_mutex priority inheritance. 90 91config NUM_METAIRQ_PRIORITIES 92 int "Number of very-high priority 'preemptor' threads" 93 default 0 94 help 95 This defines a set of priorities at the (numerically) lowest 96 end of the range which have "meta-irq" behavior. Runnable 97 threads at these priorities will always be scheduled before 98 threads at lower priorities, EVEN IF those threads are 99 otherwise cooperative and/or have taken a scheduler lock. 100 Making such a thread runnable in any way thus has the effect 101 of "interrupting" the current task and running the meta-irq 102 thread synchronously, like an exception or system call. The 103 intent is to use these priorities to implement "interrupt 104 bottom half" or "tasklet" behavior, allowing driver 105 subsystems to return from interrupt context but be guaranteed 106 that user code will not be executed (on the current CPU) 107 until the remaining work is finished. As this breaks the 108 "promise" of non-preemptibility granted by the current API 109 for cooperative threads, this tool probably shouldn't be used 110 from application code. 111 112config SCHED_DEADLINE 113 bool "Earliest-deadline-first scheduling" 114 help 115 This enables a simple "earliest deadline first" scheduling 116 mode where threads can set "deadline" deltas measured in 117 k_cycle_get_32() units. Priority decisions within (!!) a 118 single priority will choose the next expiring deadline and 119 not simply the least recently added thread. 120 121config SCHED_CPU_MASK 122 bool "CPU mask affinity/pinning API" 123 depends on SCHED_DUMB 124 help 125 When true, the application will have access to the 126 k_thread_cpu_mask_*() APIs which control per-CPU affinity masks in 127 SMP mode, allowing applications to pin threads to specific CPUs or 128 disallow threads from running on given CPUs. Note that as currently 129 implemented, this involves an inherent O(N) scaling in the number of 130 idle-but-runnable threads, and thus works only with the DUMB 131 scheduler (as SCALABLE and MULTIQ would see no benefit). 132 133 Note that this setting does not technically depend on SMP and is 134 implemented without it for testing purposes, but for obvious reasons 135 makes sense as an application API only where there is more than one 136 CPU. With one CPU, it's just a higher overhead version of 137 k_thread_start/stop(). 138 139config SCHED_CPU_MASK_PIN_ONLY 140 bool "CPU mask variant with single-CPU pinning only" 141 depends on SMP && SCHED_CPU_MASK 142 help 143 When true, enables a variant of SCHED_CPU_MASK where only 144 one CPU may be specified for every thread. Effectively, all 145 threads have a single "assigned" CPU and they will never be 146 scheduled symmetrically. In general this is not helpful, 147 but some applications have a carefully designed threading 148 architecture and want to make their own decisions about how 149 to assign work to CPUs. In that circumstance, some moderate 150 optimizations can be made (e.g. having a separate run queue 151 per CPU, keeping the list length shorter). When selected, 152 the CPU mask becomes an immutable thread attribute. It can 153 only be modified before a thread is started. Most 154 applications don't want this. 155 156config MAIN_STACK_SIZE 157 int "Size of stack for initialization and main thread" 158 default 2048 if COVERAGE_GCOV 159 default 512 if ZTEST && !(RISCV || X86 || ARM) 160 default 1024 161 help 162 When the initialization is complete, the thread executing it then 163 executes the main() routine, so as to reuse the stack used by the 164 initialization, which would be wasted RAM otherwise. 165 166 After initialization is complete, the thread runs main(). 167 168config IDLE_STACK_SIZE 169 int "Size of stack for idle thread" 170 default 2048 if COVERAGE_GCOV 171 default 1024 if XTENSA 172 default 512 if RISCV 173 default 384 if DYNAMIC_OBJECTS 174 default 320 if ARC || (ARM && CPU_HAS_FPU) || (X86 && MMU) 175 default 256 176 help 177 Depending on the work that the idle task must do, most likely due to 178 power management but possibly to other features like system event 179 logging (e.g. logging when the system goes to sleep), the idle thread 180 may need more stack space than the default value. 181 182config ISR_STACK_SIZE 183 int "ISR and initialization stack size (in bytes)" 184 default 2048 185 help 186 This option specifies the size of the stack used by interrupt 187 service routines (ISRs), and during kernel initialization. 188 189config THREAD_STACK_INFO 190 bool "Thread stack info" 191 help 192 This option allows each thread to store the thread stack info into 193 the k_thread data structure. 194 195config THREAD_CUSTOM_DATA 196 bool "Thread custom data" 197 help 198 This option allows each thread to store 32 bits of custom data, 199 which can be accessed using the k_thread_custom_data_xxx() APIs. 200 201config THREAD_USERSPACE_LOCAL_DATA 202 bool 203 depends on USERSPACE 204 default y if ERRNO && !ERRNO_IN_TLS 205 206config LIBC_ERRNO 207 bool 208 help 209 Use external libc errno, not the internal one. This eliminates any 210 locally allocated errno storage and usage. 211 212config ERRNO 213 bool "Errno support" 214 default y 215 help 216 Enable per-thread errno in the kernel. Application and library code must 217 include errno.h provided by the C library (libc) to use the errno 218 symbol. The C library must access the per-thread errno via the 219 z_errno() symbol. 220 221config ERRNO_IN_TLS 222 bool "Store errno in thread local storage (TLS)" 223 depends on ERRNO && THREAD_LOCAL_STORAGE && !LIBC_ERRNO 224 default y 225 help 226 Use thread local storage to store errno instead of storing it in 227 the kernel thread struct. This avoids a syscall if userspace is enabled. 228 229choice SCHED_ALGORITHM 230 prompt "Scheduler priority queue algorithm" 231 default SCHED_DUMB 232 help 233 The kernel can be built with with several choices for the 234 ready queue implementation, offering different choices between 235 code size, constant factor runtime overhead and performance 236 scaling when many threads are added. 237 238config SCHED_DUMB 239 bool "Simple linked-list ready queue" 240 help 241 When selected, the scheduler ready queue will be implemented 242 as a simple unordered list, with very fast constant time 243 performance for single threads and very low code size. 244 Choose this on systems with constrained code size that will 245 never see more than a small number (3, maybe) of runnable 246 threads in the queue at any given time. On most platforms 247 (that are not otherwise using the red/black tree) this 248 results in a savings of ~2k of code size. 249 250config SCHED_SCALABLE 251 bool "Red/black tree ready queue" 252 help 253 When selected, the scheduler ready queue will be implemented 254 as a red/black tree. This has rather slower constant-time 255 insertion and removal overhead, and on most platforms (that 256 are not otherwise using the rbtree somewhere) requires an 257 extra ~2kb of code. But the resulting behavior will scale 258 cleanly and quickly into the many thousands of threads. Use 259 this on platforms where you may have many threads (very 260 roughly: more than 20 or so) marked as runnable at a given 261 time. Most applications don't want this. 262 263config SCHED_MULTIQ 264 bool "Traditional multi-queue ready queue" 265 depends on !SCHED_DEADLINE 266 help 267 When selected, the scheduler ready queue will be implemented 268 as the classic/textbook array of lists, one per priority 269 (max 32 priorities). This corresponds to the scheduler 270 algorithm used in Zephyr versions prior to 1.12. It incurs 271 only a tiny code size overhead vs. the "dumb" scheduler and 272 runs in O(1) time in almost all circumstances with very low 273 constant factor. But it requires a fairly large RAM budget 274 to store those list heads, and the limited features make it 275 incompatible with features like deadline scheduling that 276 need to sort threads more finely, and SMP affinity which 277 need to traverse the list of threads. Typical applications 278 with small numbers of runnable threads probably want the 279 DUMB scheduler. 280 281endchoice # SCHED_ALGORITHM 282 283choice WAITQ_ALGORITHM 284 prompt "Wait queue priority algorithm" 285 default WAITQ_DUMB 286 help 287 The wait_q abstraction used in IPC primitives to pend 288 threads for later wakeup shares the same backend data 289 structure choices as the scheduler, and can use the same 290 options. 291 292config WAITQ_SCALABLE 293 bool "Use scalable wait_q implementation" 294 help 295 When selected, the wait_q will be implemented with a 296 balanced tree. Choose this if you expect to have many 297 threads waiting on individual primitives. There is a ~2kb 298 code size increase over WAITQ_DUMB (which may be shared with 299 SCHED_SCALABLE) if the rbtree is not used elsewhere in the 300 application, and pend/unpend operations on "small" queues 301 will be somewhat slower (though this is not generally a 302 performance path). 303 304config WAITQ_DUMB 305 bool "Simple linked-list wait_q" 306 help 307 When selected, the wait_q will be implemented with a 308 doubly-linked list. Choose this if you expect to have only 309 a few threads blocked on any single IPC primitive. 310 311endchoice # WAITQ_ALGORITHM 312 313menu "Kernel Debugging and Metrics" 314 315config INIT_STACKS 316 bool "Initialize stack areas" 317 help 318 This option instructs the kernel to initialize stack areas with a 319 known value (0xaa) before they are first used, so that the high 320 water mark can be easily determined. This applies to the stack areas 321 for threads, as well as to the interrupt stack. 322 323config BOOT_BANNER 324 bool "Boot banner" 325 default y 326 select PRINTK 327 select EARLY_CONSOLE 328 help 329 This option outputs a banner to the console device during boot up. 330 331config BOOT_DELAY 332 int "Boot delay in milliseconds" 333 depends on MULTITHREADING 334 default 0 335 help 336 This option delays bootup for the specified amount of 337 milliseconds. This is used to allow serial ports to get ready 338 before starting to print information on them during boot, as 339 some systems might boot to fast for a receiving endpoint to 340 detect the new USB serial bus, enumerate it and get ready to 341 receive before it actually gets data. A similar effect can be 342 achieved by waiting for DCD on the serial port--however, not 343 all serial ports have DCD. 344 345config THREAD_MONITOR 346 bool "Thread monitoring" 347 help 348 This option instructs the kernel to maintain a list of all threads 349 (excluding those that have not yet started or have already 350 terminated). 351 352config THREAD_NAME 353 bool "Thread name" 354 help 355 This option allows to set a name for a thread. 356 357config THREAD_MAX_NAME_LEN 358 int "Max length of a thread name" 359 default 32 360 default 64 if ZTEST 361 range 8 128 362 depends on THREAD_NAME 363 help 364 Thread names get stored in the k_thread struct. Indicate the max 365 name length, including the terminating NULL byte. Reduce this value 366 to conserve memory. 367 368config INSTRUMENT_THREAD_SWITCHING 369 bool 370 371menuconfig THREAD_RUNTIME_STATS 372 bool "Thread runtime statistics" 373 help 374 Gather thread runtime statistics. 375 376 For example: 377 - Thread total execution cycles 378 - System total execution cycles 379 380if THREAD_RUNTIME_STATS 381 382config THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS 383 bool "Use timing functions to gather statistics" 384 select TIMING_FUNCTIONS_NEED_AT_BOOT 385 help 386 Use timing functions to gather thread runtime statistics. 387 388 Note that timing functions may use a different timer than 389 the default timer for OS timekeeping. 390 391config SCHED_THREAD_USAGE 392 bool "Collect thread runtime usage" 393 default y 394 select INSTRUMENT_THREAD_SWITCHING if !USE_SWITCH 395 help 396 Collect thread runtime info at context switch time 397 398config SCHED_THREAD_USAGE_ANALYSIS 399 bool "Analyze the collected thread runtime usage statistics" 400 default n 401 depends on SCHED_THREAD_USAGE 402 select INSTRUMENT_THREAD_SWITCHING if !USE_SWITCH 403 help 404 Collect additional timing information related to thread scheduling 405 for analysis purposes. This includes the total time that a thread 406 has been scheduled, the longest time for which it was scheduled and 407 others. 408 409config SCHED_THREAD_USAGE_ALL 410 bool "Collect total system runtime usage" 411 default y if SCHED_THREAD_USAGE 412 depends on SCHED_THREAD_USAGE 413 help 414 Maintain a sum of all non-idle thread cycle usage. 415 416config SCHED_THREAD_USAGE_AUTO_ENABLE 417 bool "Automatically enable runtime usage statistics" 418 default y 419 depends on SCHED_THREAD_USAGE 420 help 421 When set, this option automatically enables the gathering of both 422 the thread and CPU usage statistics. 423 424endif # THREAD_RUNTIME_STATS 425 426endmenu 427 428menu "Work Queue Options" 429config SYSTEM_WORKQUEUE_STACK_SIZE 430 int "System workqueue stack size" 431 default 4096 if COVERAGE 432 default 1024 433 434config SYSTEM_WORKQUEUE_PRIORITY 435 int "System workqueue priority" 436 default -2 if COOP_ENABLED && !PREEMPT_ENABLED 437 default 0 if !COOP_ENABLED 438 default -1 439 help 440 By default, system work queue priority is the lowest cooperative 441 priority. This means that any work handler, once started, won't 442 be preempted by any other thread until finished. 443 444config SYSTEM_WORKQUEUE_NO_YIELD 445 bool "Select whether system work queue yields" 446 help 447 By default, the system work queue yields between each work item, to 448 prevent other threads from being starved. Selecting this removes 449 this yield, which may be useful if the work queue thread is 450 cooperative and a sequence of work items is expected to complete 451 without yielding. 452 453endmenu 454 455menu "Barrier Operations" 456config BARRIER_OPERATIONS_BUILTIN 457 bool 458 help 459 Use the compiler builtin functions for barrier operations. This is 460 the preferred method. However, support for all arches in GCC is 461 incomplete. 462 463config BARRIER_OPERATIONS_ARCH 464 bool 465 help 466 Use when there isn't support for compiler built-ins, but you have 467 written optimized assembly code under arch/ which implements these. 468endmenu 469 470menu "Atomic Operations" 471config ATOMIC_OPERATIONS_BUILTIN 472 bool 473 help 474 Use the compiler builtin functions for atomic operations. This is 475 the preferred method. However, support for all arches in GCC is 476 incomplete. 477 478config ATOMIC_OPERATIONS_ARCH 479 bool 480 help 481 Use when there isn't support for compiler built-ins, but you have 482 written optimized assembly code under arch/ which implements these. 483 484config ATOMIC_OPERATIONS_C 485 bool 486 help 487 Use atomic operations routines that are implemented entirely 488 in C by locking interrupts. Selected by architectures which either 489 do not have support for atomic operations in their instruction 490 set, or haven't been implemented yet during bring-up, and also 491 the compiler does not have support for the atomic __sync_* builtins. 492endmenu 493 494menu "Timer API Options" 495 496config TIMESLICING 497 bool "Thread time slicing" 498 default y 499 depends on SYS_CLOCK_EXISTS && (NUM_PREEMPT_PRIORITIES != 0) 500 help 501 This option enables time slicing between preemptible threads of 502 equal priority. 503 504config TIMESLICE_SIZE 505 int "Time slice size (in ms)" 506 default 0 507 range 0 2147483647 508 depends on TIMESLICING 509 help 510 This option specifies the maximum amount of time a thread can execute 511 before other threads of equal priority are given an opportunity to run. 512 A time slice size of zero means "no limit" (i.e. an infinitely large 513 time slice). 514 515config TIMESLICE_PRIORITY 516 int "Time slicing thread priority ceiling" 517 default 0 518 range 0 NUM_PREEMPT_PRIORITIES 519 depends on TIMESLICING 520 help 521 This option specifies the thread priority level at which time slicing 522 takes effect; threads having a higher priority than this ceiling are 523 not subject to time slicing. 524 525config TIMESLICE_PER_THREAD 526 bool "Support per-thread timeslice values" 527 depends on TIMESLICING 528 help 529 When set, this enables an API for setting timeslice values on 530 a per-thread basis, with an application callback invoked when 531 a thread reaches the end of its timeslice. 532 533config POLL 534 bool "Async I/O Framework" 535 help 536 Asynchronous notification framework. Enable the k_poll() and 537 k_poll_signal_raise() APIs. The former can wait on multiple events 538 concurrently, which can be either directly triggered or triggered by 539 the availability of some kernel objects (semaphores and FIFOs). 540 541endmenu 542 543menu "Other Kernel Object Options" 544 545config MEM_SLAB_TRACE_MAX_UTILIZATION 546 bool "Getting maximum slab utilization" 547 help 548 This adds variable to the k_mem_slab structure to hold 549 maximum utilization of the slab. 550 551config NUM_MBOX_ASYNC_MSGS 552 int "Maximum number of in-flight asynchronous mailbox messages" 553 default 10 554 help 555 This option specifies the total number of asynchronous mailbox 556 messages that can exist simultaneously, across all mailboxes 557 in the system. 558 559 Setting this option to 0 disables support for asynchronous 560 mailbox messages. 561 562config EVENTS 563 bool "Event objects" 564 help 565 This option enables event objects. Threads may wait on event 566 objects for specific events, but both threads and ISRs may deliver 567 events to event objects. 568 569 Note that setting this option slightly increases the size of the 570 thread structure. 571 572config PIPES 573 bool "Pipe objects" 574 help 575 This option enables kernel pipes. A pipe is a kernel object that 576 allows a thread to send a byte stream to another thread. Pipes can 577 be used to synchronously transfer chunks of data in whole or in part. 578 579config KERNEL_MEM_POOL 580 bool "Use Kernel Memory Pool" 581 default y 582 help 583 Enable the use of kernel memory pool. 584 585 Say y if unsure. 586 587if KERNEL_MEM_POOL 588 589config HEAP_MEM_POOL_SIZE 590 int "Heap memory pool size (in bytes)" 591 default 0 if !POSIX_MQUEUE 592 default 1024 if POSIX_MQUEUE 593 help 594 This option specifies the size of the heap memory pool used when 595 dynamically allocating memory using k_malloc(). The maximum size of 596 the memory pool is only limited to available memory. A size of zero 597 means that no heap memory pool is defined. 598 599endif # KERNEL_MEM_POOL 600 601endmenu 602 603config ARCH_HAS_CUSTOM_SWAP_TO_MAIN 604 bool 605 help 606 It's possible that an architecture port cannot use _Swap() to swap to 607 the _main() thread, but instead must do something custom. It must 608 enable this option in that case. 609 610config SWAP_NONATOMIC 611 bool 612 help 613 On some architectures, the _Swap() primitive cannot be made 614 atomic with respect to the irq_lock being released. That 615 is, interrupts may be received between the entry to _Swap 616 and the completion of the context switch. There are a 617 handful of workaround cases in the kernel that need to be 618 enabled when this is true. Currently, this only happens on 619 ARM when the PendSV exception priority sits below that of 620 Zephyr-handled interrupts. 621 622config ARCH_HAS_CUSTOM_BUSY_WAIT 623 bool 624 help 625 It's possible that an architecture port cannot or does not want to use 626 the provided k_busy_wait(), but instead must do something custom. It must 627 enable this option in that case. 628 629config SYS_CLOCK_TICKS_PER_SEC 630 int "System tick frequency (in ticks/second)" 631 default 100 if QEMU_TARGET || SOC_POSIX 632 default 10000 if TICKLESS_KERNEL 633 default 100 634 help 635 This option specifies the nominal frequency of the system clock in Hz. 636 637 For asynchronous timekeeping, the kernel defines a "ticks" concept. A 638 "tick" is the internal count in which the kernel does all its internal 639 uptime and timeout bookkeeping. Interrupts are expected to be delivered 640 on tick boundaries to the extent practical, and no fractional ticks 641 are tracked. 642 643 The choice of tick rate is configurable by this option. Also the number 644 of cycles per tick should be chosen so that 1 millisecond is exactly 645 represented by an integral number of ticks. Defaults on most hardware 646 platforms (ones that support setting arbitrary interrupt timeouts) are 647 expected to be in the range of 10 kHz, with software emulation 648 platforms and legacy drivers using a more traditional 100 Hz value. 649 650 Note that when available and enabled, in "tickless" mode 651 this config variable specifies the minimum available timing 652 granularity, not necessarily the number or frequency of 653 interrupts delivered to the kernel. 654 655 A value of 0 completely disables timer support in the kernel. 656 657config SYS_CLOCK_HW_CYCLES_PER_SEC 658 int "System clock's h/w timer frequency" 659 help 660 This option specifies the frequency of the hardware timer used for the 661 system clock (in Hz). This option is set by the SOC's or board's Kconfig file 662 and the user should generally avoid modifying it via the menu configuration. 663 664config SYS_CLOCK_EXISTS 665 bool "System clock exists and is enabled" 666 default y 667 help 668 This option specifies that the kernel has timer support. 669 670 Some device configurations can eliminate significant code if 671 this is disabled. Obviously timeout-related APIs will not 672 work when disabled. 673 674config TIMEOUT_64BIT 675 bool "Store kernel timeouts in 64 bit precision" 676 default y 677 help 678 When this option is true, the k_ticks_t values passed to 679 kernel APIs will be a 64 bit quantity, allowing the use of 680 larger values (and higher precision tick rates) without fear 681 of overflowing the 32 bit word. This feature also gates the 682 availability of absolute timeout values (which require the 683 extra precision). 684 685config SYS_CLOCK_MAX_TIMEOUT_DAYS 686 int "Max timeout (in days) used in conversions" 687 default 365 688 help 689 Value is used in the time conversion static inline function to determine 690 at compile time which algorithm to use. One algorithm is faster, takes 691 less code but may overflow if multiplication of source and target 692 frequency exceeds 64 bits. Second algorithm prevents that. Faster 693 algorithm is selected for conversion if maximum timeout represented in 694 source frequency domain multiplied by target frequency fits in 64 bits. 695 696config XIP 697 bool "Execute in place" 698 help 699 This option allows the kernel to operate with its text and read-only 700 sections residing in ROM (or similar read-only memory). Not all boards 701 support this option so it must be used with care; you must also 702 supply a linker command file when building your image. Enabling this 703 option increases both the code and data footprint of the image. 704 705menu "Initialization Priorities" 706 707config KERNEL_INIT_PRIORITY_OBJECTS 708 int "Kernel objects initialization priority" 709 default 30 710 help 711 Kernel objects use this priority for initialization. This 712 priority needs to be higher than minimal default initialization 713 priority. 714 715config KERNEL_INIT_PRIORITY_DEFAULT 716 int "Default init priority" 717 default 40 718 help 719 Default minimal init priority for each init level. 720 721config KERNEL_INIT_PRIORITY_DEVICE 722 int "Default init priority for device drivers" 723 default 50 724 help 725 Device driver, that depends on common components, such as 726 interrupt controller, but does not depend on other devices, 727 uses this init priority. 728 729config APPLICATION_INIT_PRIORITY 730 int "Default init priority for application level drivers" 731 default 90 732 help 733 This priority level is for end-user drivers such as sensors and display 734 which have no inward dependencies. 735 736 737endmenu 738 739menu "Security Options" 740 741config STACK_CANARIES 742 bool "Compiler stack canaries" 743 depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR 744 help 745 This option enables compiler stack canaries. 746 747 If stack canaries are supported by the compiler, it will emit 748 extra code that inserts a canary value into the stack frame when 749 a function is entered and validates this value upon exit. 750 Stack corruption (such as that caused by buffer overflow) results 751 in a fatal error condition for the running entity. 752 Enabling this option can result in a significant increase 753 in footprint and an associated decrease in performance. 754 755 If stack canaries are not supported by the compiler an error 756 will occur at build time. 757 758config EXECUTE_XOR_WRITE 759 bool "W^X for memory partitions" 760 depends on USERSPACE 761 depends on ARCH_HAS_EXECUTABLE_PAGE_BIT 762 default y 763 help 764 When enabled, will enforce that a writable page isn't executable 765 and vice versa. This might not be acceptable in all scenarios, 766 so this option is given for those unafraid of shooting themselves 767 in the foot. 768 769 If unsure, say Y. 770 771config STACK_POINTER_RANDOM 772 int "Initial stack pointer randomization bounds" 773 depends on !STACK_GROWS_UP 774 depends on MULTITHREADING 775 depends on TEST_RANDOM_GENERATOR || ENTROPY_HAS_DRIVER 776 default 0 777 help 778 This option performs a limited form of Address Space Layout 779 Randomization by offsetting some random value to a thread's 780 initial stack pointer upon creation. This hinders some types of 781 security attacks by making the location of any given stack frame 782 non-deterministic. 783 784 This feature can waste up to the specified size in bytes the stack 785 region, which is carved out of the total size of the stack region. 786 A reasonable minimum value would be around 100 bytes if this can 787 be spared. 788 789 This is currently only implemented for systems whose stack pointers 790 grow towards lower memory addresses. 791 792config BOUNDS_CHECK_BYPASS_MITIGATION 793 bool "Bounds check bypass mitigations for speculative execution" 794 depends on USERSPACE 795 help 796 Untrusted parameters from user mode may be used in system calls to 797 index arrays during speculative execution, also known as the Spectre 798 V1 vulnerability. When enabled, various macros defined in 799 misc/speculation.h will insert fence instructions or other appropriate 800 mitigations after bounds checking any array index parameters passed 801 in from untrusted sources (user mode threads). When disabled, these 802 macros do nothing. 803endmenu 804 805config MAX_DOMAIN_PARTITIONS 806 int "Maximum number of partitions per memory domain" 807 default 16 808 range 0 255 809 depends on USERSPACE 810 help 811 Configure the maximum number of partitions per memory domain. 812 813config ARCH_MEM_DOMAIN_DATA 814 bool 815 depends on USERSPACE 816 help 817 This hidden option is selected by the target architecture if 818 architecture-specific data is needed on a per memory domain basis. 819 If so, the architecture defines a 'struct arch_mem_domain' which is 820 embedded within every struct k_mem_domain. The architecture 821 must also define the arch_mem_domain_init() function to set this up 822 when a memory domain is created. 823 824 Typical uses might be a set of page tables for that memory domain. 825 826config ARCH_MEM_DOMAIN_SYNCHRONOUS_API 827 bool 828 depends on USERSPACE 829 help 830 This hidden option is selected by the target architecture if 831 modifying a memory domain's partitions at runtime, or changing 832 a memory domain's thread membership requires synchronous calls 833 into the architecture layer. 834 835 If enabled, the architecture layer must implement the following 836 APIs: 837 838 arch_mem_domain_thread_add 839 arch_mem_domain_thread_remove 840 arch_mem_domain_partition_remove 841 arch_mem_domain_partition_add 842 843 It's important to note that although supervisor threads can be 844 members of memory domains, they have no implications on supervisor 845 thread access to memory. Memory domain APIs may only be invoked from 846 supervisor mode. 847 848 For these reasons, on uniprocessor systems unless memory access 849 policy is managed in separate software constructions like page 850 tables, these APIs don't need to be implemented as the underlying 851 memory management hardware will be reprogrammed on context switch 852 anyway. 853 854menu "SMP Options" 855 856config SMP 857 bool "Symmetric multiprocessing support" 858 depends on USE_SWITCH 859 depends on !ATOMIC_OPERATIONS_C 860 help 861 When true, kernel will be built with SMP support, allowing 862 more than one CPU to schedule Zephyr tasks at a time. 863 864config USE_SWITCH 865 bool "Use new-style _arch_switch instead of arch_swap" 866 depends on USE_SWITCH_SUPPORTED 867 help 868 The _arch_switch() API is a lower level context switching 869 primitive than the original arch_swap mechanism. It is required 870 for an SMP-aware scheduler, or if the architecture does not 871 provide arch_swap. In uniprocess situations where the 872 architecture provides both, _arch_switch incurs more somewhat 873 overhead and may be slower. 874 875config USE_SWITCH_SUPPORTED 876 bool 877 help 878 Indicates whether _arch_switch() API is supported by the 879 currently enabled platform. This option should be selected by 880 platforms that implement it. 881 882config SMP_BOOT_DELAY 883 bool "Delay booting secondary cores" 884 depends on SMP 885 help 886 By default Zephyr will boot all available CPUs during start up. 887 Select this option to skip this and allow architecture code boot 888 secondary CPUs at a later time. 889 890config MP_NUM_CPUS 891 int "Number of CPUs/cores" 892 default MP_MAX_NUM_CPUS 893 range 1 5 894 help 895 Number of multiprocessing-capable cores available to the 896 multicpu API and SMP features. 897 898config MP_MAX_NUM_CPUS 899 int "Maximum number of CPUs/cores" 900 default 1 901 range 1 5 902 help 903 Maximum number of multiprocessing-capable cores available to the 904 multicpu API and SMP features. 905 906config SCHED_IPI_SUPPORTED 907 bool 908 help 909 True if the architecture supports a call to 910 arch_sched_ipi() to broadcast an interrupt that will call 911 z_sched_ipi() on other CPUs in the system. Required for 912 k_thread_abort() to operate with reasonable latency 913 (otherwise we might have to wait for the other thread to 914 take an interrupt, which can be arbitrarily far in the 915 future). 916 917config TRACE_SCHED_IPI 918 bool "Test IPI" 919 help 920 When true, it will add a hook into z_sched_ipi(), in order 921 to check if schedule IPI has called or not, for testing 922 purpose. 923 depends on SCHED_IPI_SUPPORTED 924 depends on MP_NUM_CPUS>1 925 926config KERNEL_COHERENCE 927 bool "Place all shared data into coherent memory" 928 depends on ARCH_HAS_COHERENCE 929 default y if SMP && MP_NUM_CPUS > 1 930 select THREAD_STACK_INFO 931 help 932 When available and selected, the kernel will build in a mode 933 where all shared data is placed in multiprocessor-coherent 934 (generally "uncached") memory. Thread stacks will remain 935 cached, as will application memory declared with 936 __incoherent. This is intended for Zephyr SMP kernels 937 running on cache-incoherent architectures only. Note that 938 when this is selected, there is an implicit API change that 939 assumes cache coherence to any memory passed to the kernel. 940 Code that creates kernel data structures in uncached regions 941 may fail strangely. Some assertions exist to catch these 942 mistakes, but not all circumstances can be tested. 943 944endmenu 945 946config TICKLESS_KERNEL 947 bool "Tickless kernel" 948 default y if TICKLESS_CAPABLE 949 depends on TICKLESS_CAPABLE 950 help 951 This option enables a fully event driven kernel. Periodic system 952 clock interrupt generation would be stopped at all times. 953 954config TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE 955 bool 956 default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr" || "$(ZEPHYR_TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE)" = "y" 957 help 958 Hidden option to signal that toolchain supports generating code 959 with thread local storage. 960 961config THREAD_LOCAL_STORAGE 962 bool "Thread Local Storage (TLS)" 963 depends on ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE 964 select NEED_LIBC_MEM_PARTITION if (CPU_CORTEX_M && USERSPACE) 965 help 966 This option enables thread local storage (TLS) support in kernel. 967 968endmenu 969 970menu "Device Options" 971 972config HAS_DYNAMIC_DEVICE_HANDLES 973 bool 974 help 975 Hidden option that makes possible to manipulate device handles at 976 runtime. 977 978endmenu 979 980rsource "Kconfig.vm" 981