From 9463dc0b8f0ae9916b410cb9e5f9ce8e758cc5ad Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 17 Dec 2016 17:36:20 -0500 Subject: kernel: merge kernel Kconfigs into one Reorganise and cleanup Kernel Kconfig options and group options of the same area under Menus to ease readability and to have a better structure when using menuconfig. Change-Id: Ic6b39730297861367abd345ede35e41c046c099d Signed-off-by: Anas Nashif --- kernel/Kconfig | 408 +++++++++++++++++++++++++++++++++++++++++++++++-- kernel/unified/Kconfig | 390 ---------------------------------------------- 2 files changed, 395 insertions(+), 403 deletions(-) delete mode 100644 kernel/unified/Kconfig diff --git a/kernel/Kconfig b/kernel/Kconfig index 200c0a543..0aded3764 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -18,6 +18,379 @@ menu "General Kernel Options" +config MULTITHREADING + bool + prompt "Multi-threading" + default y + help + If disabled, only the main thread is available, so a main() function + must be provided. Interrupts are available. Kernel objects will most + probably not behave as expected, especially with regards to pending, + since the main thread cannot pend, it being the only thread in the + system. + + Many drivers and subsystems will not work with this option; use only + when you REALLY know what you are doing. + +config NUM_COOP_PRIORITIES + int + prompt "Number of coop priorities" if MULTITHREADING + default 16 + default 1 if !MULTITHREADING + help + Number of cooperative priorities configured in the system. Gives access + to priorities: + + K_PRIO_COOP(0) to K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1) + + or seen another way, priorities: + + -CONFIG_NUM_COOP_PRIORITIES to -1 + + This can be set to zero to disable cooperative scheduling. Cooperative + threads always preempt preemptible threads. + + Each priority requires an extra 8 bytes of RAM. Each set of 32 extra + total priorities require an extra 4 bytes and add one possible + iteration to loops that search for the next thread to run. + + The total number of priorities is + + NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1 + + The extra one is for the idle thread, which must run at the lowest + priority, and be the only thread at that priority. + +config NUM_PREEMPT_PRIORITIES + int + prompt "Number of preemptible priorities" if MULTITHREADING + default 15 + default 0 if !MULTITHREADING + help + Number of preemptible priorities available in the system. Gives access + to priorities 0 to CONFIG_NUM_PREEMPT_PRIORITIES - 1. + + This can be set to 0 to disable preemptible scheduling. + + Each priority requires an extra 8 bytes of RAM. Each set of 32 extra + total priorities require an extra 4 bytes and add one possible + iteration to loops that search for the next thread to run. + + The total number of priorities is + + NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1 + + The extra one is for the idle thread, which must run at the lowest + priority, and be the only thread at that priority. + +config MAIN_THREAD_PRIORITY + int + prompt "Priority of initialization/main thread" + default 0 + default -1 if NUM_PREEMPT_PRIORITIES = 0 + help + Priority at which the initialization thread runs, including the start + of the main() function. main() can then change its priority if desired. + +config COOP_ENABLED + bool + default y + default n if (NUM_COOP_PRIORITIES = 0) + +config PREEMPT_ENABLED + bool + default y + default n if (NUM_PREEMPT_PRIORITIES = 0) + +config PRIORITY_CEILING + int + prompt "Priority inheritance ceiling" + default 0 + +config MAIN_STACK_SIZE + int + prompt "Size of stack for initialization and main thread" + default 1024 + help + When the intitialization is complete, the thread executing it then + executes the main() routine, so as to reuse the stack used by the + initialization, which would be wasted RAM otherwise. + + After initialization is complete, the thread runs main(). + +config IDLE_STACK_SIZE + int + prompt "Size of stack for idle thread" + default 256 + default 320 if ARC + help + Depending on the work that the idle task must do, most likely due to + power management but possibly to other features like system event + logging (e.g. logging when the system goes to sleep), the idle thread + may need more stack space than the default value. + +config ISR_STACK_SIZE + int + prompt "ISR and initialization stack size (in bytes)" + default 2048 + help + This option specifies the size of the stack used by interrupt + service routines (ISRs), and during kernel initialization. + +config THREAD_CUSTOM_DATA + bool + prompt "Thread custom data" + default n + help + This option allows each thread to store 32 bits of custom data, + which can be accessed using the k_thread_custom_data_xxx() APIs. + +config NUM_DYNAMIC_TIMERS + int + prompt "Number of timers available for dynamic allocation" + default 0 + depends on NANO_TIMERS + help + Number of timers available for dynamic allocation via the + k_timer_alloc()/k_timer_free() API. + +config TICKLESS_IDLE_SUPPORTED + bool + default n + help + To be selected by an architecture if it does support tickless idle. + +config ERRNO + bool + prompt "Enable errno support" + default y + help + Enable per-thread errno in the kernel. Application and library code must + include errno.h provided by the C library (libc) to use the errno + symbol. The C library must access the per-thread errno via the + _get_errno() symbol. + +menu "Kernel Debugging and Metrics" +config KERNEL_DEBUG + bool + prompt "Kernel debugging" + default n + select INIT_STACKS + help + Enable kernel debugging. + + Note that debugging the kernel internals can be very verbose. + +config BOOT_BANNER + bool + prompt "Boot banner" + default n + select PRINTK + select EARLY_CONSOLE + help + This option outputs a banner to the console device during boot up. It + also embeds a date & time stamp in the kernel and in each USAP image. + +config BUILD_TIMESTAMP + bool + prompt "Build Timestamp" + help + Build timestamp and add it to the boot banner. + +config INT_LATENCY_BENCHMARK + bool + prompt "Interrupt latency metrics [EXPERIMENTAL]" + default n + depends on ARCH="x86" + help + This option enables the tracking of interrupt latency metrics; + the exact set of metrics being tracked is board-dependent. + Tracking begins when int_latency_init() is invoked by an application. + The metrics are displayed (and a new sampling interval is started) + each time int_latency_show() is called thereafter. + +config THREAD_MONITOR + bool + prompt "Thread monitoring [EXPERIMENTAL]" + default n + help + This option instructs the kernel to maintain a list of all threads + (excluding those that have not yet started or have already + terminated). +endmenu + +menu "Work Queue Options" +config SYSTEM_WORKQUEUE_STACK_SIZE + int "System workqueue stack size" + default 1024 + +config SYSTEM_WORKQUEUE_PRIORITY + int "System workqueue priority" + default -1 + +config OFFLOAD_WORKQUEUE_STACK_SIZE + int "Workqueue stack size for thread offload requests" + default 1024 + +config OFFLOAD_WORKQUEUE_PRIORITY + int "Offload requests workqueue priority" + default -1 + +endmenu + +menu "Atomic Operations" +config ATOMIC_OPERATIONS_BUILTIN + bool + help + Use the compiler builtin functions for atomic operations. This is + the preferred method. However, support for all arches in GCC is + incomplete. + +config ATOMIC_OPERATIONS_CUSTOM + bool + help + Use when there isn't support for compiler built-ins, but you have + written optimized assembly code under arch/ which implements these. + +config ATOMIC_OPERATIONS_C + bool + help + Use atomic operations routines that are implemented entirely + in C by locking interrupts. Selected by architectures which either + do not have support for atomic operations in their instruction + set, or haven't been implemented yet during bring-up, and also + the compiler does not have support for the atomic __sync_* builtins. +endmenu + +menu "Timer API Options" + +config TIMESLICING + bool "Thread time slicing" + default y + depends on SYS_CLOCK_EXISTS && (NUM_PREEMPT_PRIORITIES != 0) + help + This option enables time slicing between preemptible threads of + equal priority. + +config TIMESLICE_SIZE + int "Time slice size (in ms)" + default 0 + range 0 2147483647 + depends on TIMESLICING + help + This option specifies the maximum amount of time a thread can execute + before other threads of equal priority are given an opportunity to run. + A time slice size of zero means "no limit" (i.e. an infinitely large + time slice). + +config TIMESLICE_PRIORITY + int "Time slicing thread priority ceiling" + default 0 + range 0 NUM_PREEMPT_PRIORITIES + depends on TIMESLICING + help + This option specifies the thread priority level at which time slicing + takes effect; threads having a higher priority than this ceiling are + not subject to time slicing. + +endmenu + +menu "Other Kernel Object Options" +config SEMAPHORE_GROUPS + bool "Enable semaphore groups" + default y + help + This option enables support for semaphore groups. Threads that use + semaphore groups require more stack space. Disabling this option will + both decrease the footprint as well as improve the performance of + the k_sem_give() routine. + +config NUM_MBOX_ASYNC_MSGS + int "Maximum number of in-flight asynchronous mailbox messages" + default 10 + help + This option specifies the total number of asynchronous mailbox + messages that can exist simultaneously, across all mailboxes + in the system. + + Setting this option to 0 disables support for asynchronous + mailbox messages. + +config NUM_PIPE_ASYNC_MSGS + int "Maximum number of in-flight asynchronous pipe messages" + default 10 + help + This option specifies the total number of asynchronous pipe + messages that can exist simultaneously, across all pipes in + the system. + + Setting this option to 0 disables support for asynchronous + pipe messages. +endmenu + +menu "Memory Pool Options" +choice + prompt "Memory pool block allocation policy" + default MEM_POOL_SPLIT_BEFORE_DEFRAG + help + This option specifies how a memory pool reacts if an unused memory + block of the required size is not available. + +config MEM_POOL_SPLIT_BEFORE_DEFRAG + bool "Split a larger block before merging smaller blocks" + help + This option instructs a memory pool to try splitting a larger unused + block if an unused block of the required size is not available; only + if no such blocks exist will the memory pool try merging smaller unused + blocks. This policy attempts to limit the cost of performing automatic + partial defragmention of the memory pool, at the cost of fragmenting + the memory pool's larger blocks. + +config MEM_POOL_DEFRAG_BEFORE_SPLIT + bool "Merge smaller blocks before splitting a larger block" + help + This option instructs a memory pool to try merging smaller unused + blocks if an unused block of the required size is not available; only + if this does not generate a sufficiently large block will the memory + pool try splitting a larger unused block. This policy attempts to + preserve the memory pool's larger blocks, at the cost of performing + automatic partial defragmentations more frequently. + +config MEM_POOL_SPLIT_ONLY + bool "Split a larger block, but never merge smaller blocks" + help + This option instructs a memory pool to try splitting a larger unused + block if an unused block of the required size is not available; if no + such blocks exist the block allocation operation fails. This policy + attempts to limit the cost of defragmenting the memory pool by avoiding + automatic partial defragmentation, at the cost of requiring the + application to explicitly request a full defragmentation of the memory + pool when an allocation fails. Depending on how a memory pool is used, + it may be more efficient for a memory pool to perform an occasional + full defragmentation than to perform frequent partial defragmentations. + +endchoice + +config HEAP_MEM_POOL_SIZE + int + prompt "Heap memory pool size (in bytes)" + default 0 + help + This option specifies the size of the heap memory pool used when + dynamically allocating memory using k_malloc(). Supported values + are: 256, 1024, 4096, and 16384. A size of zero means that no + heap memory pool is defined. +endmenu + + +config ARCH_HAS_CUSTOM_SWAP_TO_MAIN + bool + # hidden + default n + help + It's possible that an architecture port cannot use _Swap() to swap to + the _main() thread, but instead must do something custom. It must + enable this option in that case. config SYS_CLOCK_TICKS_PER_SEC int @@ -71,15 +444,7 @@ config RING_BUFFER their own buffer memory and can store arbitrary data. For optimal performance, use buffer sizes that are a power of 2. -config THREAD_MONITOR - bool - prompt "Thread monitoring [EXPERIMENTAL]" - default n - help - This option instructs the kernel to maintain a list of all threads - (excluding those that have not yet started or have already - terminated). - +menu "Initialization Priorities" config KERNEL_INIT_PRIORITY_OBJECTS int prompt "Kernel objects initialization priority" @@ -112,6 +477,7 @@ config APPLICATION_INIT_PRIORITY help This priority level is for end-user drivers such as sensors and display which have no inward dependencies. +endmenu menu "Security Options" @@ -134,10 +500,7 @@ config STACK_CANARIES option has no effect. endmenu -endmenu - -source "kernel/unified/Kconfig" - +menu "Legacy Options" config MDEF bool prompt "Use MDEF files for statically configured kernel objects" @@ -151,6 +514,25 @@ config MDEF In doubt, select 'y'. +config NANO_TIMEOUTS + bool + default y + depends on SYS_CLOCK_EXISTS + help + Only here for common (ie. non-unified kernel) code that rely on this. + Unified kernel uses SYS_CLOCK_EXISTS everywhere instead. + +config NANO_TIMERS + bool + default y + depends on SYS_CLOCK_EXISTS + help + Only here for common (ie. non-unified kernel) code that rely on this. + Unified kernel uses SYS_CLOCK_EXISTS everywhere instead. +endmenu + source "kernel/Kconfig.event_logger" + source "kernel/Kconfig.power_mgmt" +endmenu diff --git a/kernel/unified/Kconfig b/kernel/unified/Kconfig deleted file mode 100644 index 5ee1ac730..000000000 --- a/kernel/unified/Kconfig +++ /dev/null @@ -1,390 +0,0 @@ -# Kconfig - Kernel configuration options - -# -# Copyright (c) 2014-2015 Wind River Systems, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -menu "Unified Kernel Options" - -config KERNEL_DEBUG - bool - prompt "Kernel debugging" - default n - select INIT_STACKS - help - Enable kernel debugging. - - Note that debugging the kernel internals can be very verbose. - -config MULTITHREADING - bool - prompt "Multi-threading" - default y - help - If disabled, only the main thread is available, so a main() function - must be provided. Interrupts are available. Kernel objects will most - probably not behave as expected, especially with regards to pending, - since the main thread cannot pend, it being the only thread in the - system. - - Many drivers and subsystems will not work with this option; use only - when you REALLY know what you are doing. - -config NUM_COOP_PRIORITIES - int - prompt "Number of coop priorities" if MULTITHREADING - default 16 - default 1 if !MULTITHREADING - help - Number of cooperative priorities configured in the system. Gives access - to priorities: - - K_PRIO_COOP(0) to K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1) - - or seen another way, priorities: - - -CONFIG_NUM_COOP_PRIORITIES to -1 - - This can be set to zero to disable cooperative scheduling. Cooperative - threads always preempt preemptible threads. - - Each priority requires an extra 8 bytes of RAM. Each set of 32 extra - total priorities require an extra 4 bytes and add one possible - iteration to loops that search for the next thread to run. - - The total number of priorities is - - NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1 - - The extra one is for the idle thread, which must run at the lowest - priority, and be the only thread at that priority. - -config NUM_PREEMPT_PRIORITIES - int - prompt "Number of preemptible priorities" if MULTITHREADING - default 15 - default 0 if !MULTITHREADING - help - Number of preemptible priorities available in the system. Gives access - to priorities 0 to CONFIG_NUM_PREEMPT_PRIORITIES - 1. - - This can be set to 0 to disable preemptible scheduling. - - Each priority requires an extra 8 bytes of RAM. Each set of 32 extra - total priorities require an extra 4 bytes and add one possible - iteration to loops that search for the next thread to run. - - The total number of priorities is - - NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1 - - The extra one is for the idle thread, which must run at the lowest - priority, and be the only thread at that priority. - -config COOP_ENABLED - bool - default y - default n if (NUM_COOP_PRIORITIES = 0) - -config PREEMPT_ENABLED - bool - default y - default n if (NUM_PREEMPT_PRIORITIES = 0) - -config PRIORITY_CEILING - int - prompt "Priority inheritance ceiling" - default 0 - -config BOOT_BANNER - bool - prompt "Boot banner" - default n - select PRINTK - select EARLY_CONSOLE - help - This option outputs a banner to the console device during boot up. It - also embeds a date & time stamp in the kernel and in each USAP image. - -config BUILD_TIMESTAMP - bool - prompt "Build Timestamp" - help - Build timestamp and add it to the boot banner. - -config INT_LATENCY_BENCHMARK - bool - prompt "Interrupt latency metrics [EXPERIMENTAL]" - default n - depends on ARCH="x86" - help - This option enables the tracking of interrupt latency metrics; - the exact set of metrics being tracked is board-dependent. - Tracking begins when int_latency_init() is invoked by an application. - The metrics are displayed (and a new sampling interval is started) - each time int_latency_show() is called thereafter. - -config MAIN_THREAD_PRIORITY - int - prompt "Priority of initialization/main thread" - default 0 - default -1 if NUM_PREEMPT_PRIORITIES = 0 - help - Priority at which the initialization thread runs, including the start - of the main() function. main() can then change its priority if desired. - -config MAIN_STACK_SIZE - int - prompt "Size of stack for initialization and main thread" - default 1024 - help - When the intitialization is complete, the thread executing it then - executes the main() routine, so as to reuse the stack used by the - initialization, which would be wasted RAM otherwise. - - After initialization is complete, the thread runs main(). - -config IDLE_STACK_SIZE - int - prompt "Size of stack for idle thread" - default 256 - default 320 if ARC - help - Depending on the work that the idle task must do, most likely due to - power management but possibly to other features like system event - logging (e.g. logging when the system goes to sleep), the idle thread - may need more stack space than the default value. - -config ISR_STACK_SIZE - int - prompt "ISR and initialization stack size (in bytes)" - default 2048 - help - This option specifies the size of the stack used by interrupt - service routines (ISRs), and during kernel initialization. - -config THREAD_CUSTOM_DATA - bool - prompt "Thread custom data" - default n - help - This option allows each thread to store 32 bits of custom data, - which can be accessed using the k_thread_custom_data_xxx() APIs. - -config NANO_TIMEOUTS - bool - default y - depends on SYS_CLOCK_EXISTS - help - Only here for common (ie. non-unified kernel) code that rely on this. - Unified kernel uses SYS_CLOCK_EXISTS everywhere instead. - -config NANO_TIMERS - bool - default y - depends on SYS_CLOCK_EXISTS - help - Only here for common (ie. non-unified kernel) code that rely on this. - Unified kernel uses SYS_CLOCK_EXISTS everywhere instead. - -config NUM_DYNAMIC_TIMERS - int - prompt "Number of timers available for dynamic allocation" - default 0 - depends on NANO_TIMERS - help - Number of timers available for dynamic allocation via the - k_timer_alloc()/k_timer_free() API. - -config TICKLESS_IDLE_SUPPORTED - bool - default n - help - To be selected by an architecture if it does support tickless idle. - -config ERRNO - bool - prompt "Enable errno support" - default y - help - Enable per-thread errno in the kernel. Application and library code must - include errno.h provided by the C library (libc) to use the errno - symbol. The C library must access the per-thread errno via the - _get_errno() symbol. - -config SYSTEM_WORKQUEUE_STACK_SIZE - int "System workqueue stack size" - default 1024 - -config SYSTEM_WORKQUEUE_PRIORITY - int "System workqueue priority" - default -1 - -config OFFLOAD_WORKQUEUE_STACK_SIZE - int "Workqueue stack size for thread offload requests" - default 1024 - -config OFFLOAD_WORKQUEUE_PRIORITY - int "Offload requests workqueue priority" - default -1 - -config NUM_MBOX_ASYNC_MSGS - int "" - default 10 - help - This option specifies the total number of asynchronous mailbox - messages that can exist simultaneously, across all mailboxes - in the system. - - Setting this option to 0 disables support for asynchronous - mailbox messages. - -config NUM_PIPE_ASYNC_MSGS - int "Maximum number of in-flight asynchronous pipe messages" - default 10 - help - This option specifies the total number of asynchronous pipe - messages that can exist simultaneously, across all pipes in - the system. - - Setting this option to 0 disables support for asynchronous - pipe messages. - -config ATOMIC_OPERATIONS_BUILTIN - bool - help - Use the compiler builtin functions for atomic operations. This is - the preferred method. However, support for all arches in GCC is - incomplete. - -config ATOMIC_OPERATIONS_CUSTOM - bool - help - Use when there isn't support for compiler built-ins, but you have - written optimized assembly code under arch/ which implements these. - -config ATOMIC_OPERATIONS_C - bool - help - Use atomic operations routines that are implemented entirely - in C by locking interrupts. Selected by architectures which either - do not have support for atomic operations in their instruction - set, or haven't been implemented yet during bring-up, and also - the compiler does not have support for the atomic __sync_* builtins. - -menu "Timer API Options" - -config TIMESLICING - bool "Thread time slicing" - default y - depends on SYS_CLOCK_EXISTS && (NUM_PREEMPT_PRIORITIES != 0) - help - This option enables time slicing between preemptible threads of - equal priority. - -config TIMESLICE_SIZE - int "Time slice size (in ms)" - default 0 - range 0 2147483647 - depends on TIMESLICING - help - This option specifies the maximum amount of time a thread can execute - before other threads of equal priority are given an opportunity to run. - A time slice size of zero means "no limit" (i.e. an infinitely large - time slice). - -config TIMESLICE_PRIORITY - int "Time slicing thread priority ceiling" - default 0 - range 0 NUM_PREEMPT_PRIORITIES - depends on TIMESLICING - help - This option specifies the thread priority level at which time slicing - takes effect; threads having a higher priority than this ceiling are - not subject to time slicing. - -endmenu - -config SEMAPHORE_GROUPS - bool "Enable semaphore groups" - default y - help - This option enables support for semaphore groups. Threads that use - semaphore groups require more stack space. Disabling this option will - both decrease the footprint as well as improve the performance of - the k_sem_give() routine. - -choice - prompt "Memory pool block allocation policy" - default MEM_POOL_SPLIT_BEFORE_DEFRAG - help - This option specifies how a memory pool reacts if an unused memory - block of the required size is not available. - -config MEM_POOL_SPLIT_BEFORE_DEFRAG - bool "Split a larger block before merging smaller blocks" - help - This option instructs a memory pool to try splitting a larger unused - block if an unused block of the required size is not available; only - if no such blocks exist will the memory pool try merging smaller unused - blocks. This policy attempts to limit the cost of performing automatic - partial defragmention of the memory pool, at the cost of fragmenting - the memory pool's larger blocks. - -config MEM_POOL_DEFRAG_BEFORE_SPLIT - bool "Merge smaller blocks before splitting a larger block" - help - This option instructs a memory pool to try merging smaller unused - blocks if an unused block of the required size is not available; only - if this does not generate a sufficiently large block will the memory - pool try splitting a larger unused block. This policy attempts to - preserve the memory pool's larger blocks, at the cost of performing - automatic partial defragmentations more frequently. - -config MEM_POOL_SPLIT_ONLY - bool "Split a larger block, but never merge smaller blocks" - help - This option instructs a memory pool to try splitting a larger unused - block if an unused block of the required size is not available; if no - such blocks exist the block allocation operation fails. This policy - attempts to limit the cost of defragmenting the memory pool by avoiding - automatic partial defragmentation, at the cost of requiring the - application to explicitly request a full defragmentation of the memory - pool when an allocation fails. Depending on how a memory pool is used, - it may be more efficient for a memory pool to perform an occasional - full defragmentation than to perform frequent partial defragmentations. - -endchoice - -config HEAP_MEM_POOL_SIZE - int - prompt "Heap memory pool size (in bytes)" - default 0 - help - This option specifies the size of the heap memory pool used when - dynamically allocating memory using k_malloc(). Supported values - are: 256, 1024, 4096, and 16384. A size of zero means that no - heap memory pool is defined. - -endmenu - -config ARCH_HAS_CUSTOM_SWAP_TO_MAIN - bool - # hidden - default n - help - It's possible that an architecture port cannot use _Swap() to swap to - the _main() thread, but instead must do something custom. It must - enable this option in that case. -- cgit v1.2.3