From 86ad37a53330441b30625db2f6dc52e94ce65d47 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 2 Nov 2018 07:12:07 -0400 Subject: [PATCH] kconfig: distribute misc/Kconfig option where they belong Move misc/Kconfig options to where they belong. misc/Kconfig was used as a catch-all, but we are now able to put things in a better place. Signed-off-by: Anas Nashif --- Kconfig.zephyr | 337 +++++++++++++++++++++++++++++++++++++- misc/Kconfig | 382 ------------------------------------------- subsys/debug/Kconfig | 42 +++++ 3 files changed, 377 insertions(+), 384 deletions(-) delete mode 100644 misc/Kconfig diff --git a/Kconfig.zephyr b/Kconfig.zephyr index d80bf268241..9a67bbaccdb 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -34,8 +34,6 @@ source "dts/Kconfig" source "drivers/Kconfig" -source "misc/Kconfig" - source "lib/Kconfig" source "subsys/Kconfig" @@ -44,6 +42,10 @@ source "ext/Kconfig" source "tests/Kconfig" +menu "Build and Link Features" + +menu "Linker Options" + choice prompt "Linker Orphan Section Handling" default LINKER_ORPHAN_SECTION_WARN @@ -66,3 +68,334 @@ config LINKER_ORPHAN_SECTION_ERROR 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_DTS +config FLASH_LOAD_OFFSET + hex "Kernel load offset" + default 0 + depends on HAS_FLASH_LOAD_OFFSET + 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 + hex "Kernel load size" + default 0 + depends on HAS_FLASH_LOAD_OFFSET + 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 + +config TEXT_SECTION_OFFSET + hex "TEXT section offset" + 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 .text + 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 CUSTOM_RODATA_LD + bool "Include custom-rodata.ld" + help + Include a customized linker script fragment for inserting additional + data and linker directives into the rodata section. + +config CUSTOM_RWDATA_LD + bool "Include custom-rwdata.ld" + help + Include a customized linker script fragment for inserting additional + data and linker directives into the data section. + +config CUSTOM_SECTIONS_LD + bool "Include custom-sections.ld" + help + Include a customized linker script fragment for inserting additional + arbitrary sections. + +config LINK_WHOLE_ARCHIVE + bool "Allow linking with --whole-archive" + help + This options allows linking external libraries with the + --whole-archive option to keep all symbols. + +config KERNEL_ENTRY + string "Kernel entry symbol" + default "__start" + help + Code entry symbol, to be set at linking phase. + +config CHECK_LINK_MAP + bool "Check linker map" + default y + help + Run a linker address generation validity checker at the end of the + build. + +endmenu + +menu "Compiler Options" + +config CROSS_COMPILE + string "Cross-compiler tool prefix" + help + Same as running 'make CROSS_COMPILE=prefix-' but stored for + default make runs in this kernel build directory. You don't + need to set this unless you want the configured kernel build + directory to select the cross-compiler automatically. + +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_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. + +endmenu + +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 + +config OUTPUT_DISASSEMBLY + bool "Create a disassembly file" + default y + help + Create an .lst file with the assembly listing of the firmware. + +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 BUILD_OUTPUT_HEX + bool "Build a binary in HEX format" + help + Build a binary in HEX format. This will build a zephyr.hex file need + by some platforms. + +config BUILD_OUTPUT_BIN + bool "Build a binary in BIN format" + default y + help + Build a binary in BIN format. This will build a zephyr.bin file need + by some platforms. + +config BUILD_OUTPUT_EXE + bool "Build a binary in ELF format with .exe extension" + help + Build a binary in ELF format that can run in the host system. This + will build a zephyr.exe file. + +config BUILD_OUTPUT_S19 + bool "Build a binary in S19 format" + help + Build a binary in S19 format. This will build a zephyr.s19 file need + by some platforms. + +config BUILD_OUTPUT_STRIPPED + bool "Build a stripped binary" + help + Build a stripped binary. This will build a zephyr.stripped file need + by some platforms. + +config APPLICATION_DEFINED_SYSCALL + bool "Scan application folder for any syscall definition" + help + Scan additional folders inside application source folder + for application defined syscalls. + +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 + 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 BOOTLOADER_MCUBOOT + bool "MCUboot bootloader support" + 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 TEXT_SECTION_OFFSET to a default value that allows space + for the MCUboot image header + * Activating SW_VECTOR_RELAY on Cortex-M0 (or Armv8-M baseline) + targets with no built-in vector relocation mechanisms + * Including dts/common/mcuboot.overlay when building the Device + Tree in order to place and link the image at the slot0 offset + +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 REALMODE + bool "boot from x86 real mode" + depends on X86 + help + This option enabled Zephyr to start in x86 real mode, instead of + protected mode. + +config BOOTLOADER_KEXEC + bool "Boot using Linux kexec() system call" + depends on X86 + help + This option signifies that Linux boots the kernel using kexec system call + and utility. This method is used to boot the kernel over the network. + +config BOOTLOADER_UNKNOWN + bool "Generic boot loader support" + depends on X86 + help + This option signifies that the target has a generic bootloader + or that it supports multiple ways of booting and it isn't clear + at build time which method is to be used. When this option is enabled + the board may have to do extra work to ensure a proper startup. + +config BOOTLOADER_CONTEXT_RESTORE + bool "Boot loader has context restore support" + default y + depends on SYS_POWER_DEEP_SLEEP && BOOTLOADER_CONTEXT_RESTORE_SUPPORTED + help + This option signifies that the target has a bootloader + that restores CPU context upon resuming from deep sleep + power state. + +config REBOOT + bool "Reboot functionality" + select SYSTEM_CLOCK_DISABLE + help + Enable the sys_reboot() API. Enabling this can drag in other subsystems + needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the + system clock before issuing a reset). +endmenu diff --git a/misc/Kconfig b/misc/Kconfig deleted file mode 100644 index d1263106437..00000000000 --- a/misc/Kconfig +++ /dev/null @@ -1,382 +0,0 @@ -# Kconfig - miscellany configuration options - -# -# Copyright (c) 2014-2015 Wind River Systems, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# - -menu "Build and Link Features" - -menu "Linker Options" -config HAS_FLASH_LOAD_OFFSET - bool - help - This option is selected by targets having a FLASH_LOAD_OFFSET - and FLASH_LOAD_SIZE. - -if !HAS_DTS -config FLASH_LOAD_OFFSET - hex "Kernel load offset" - default 0 - depends on HAS_FLASH_LOAD_OFFSET - 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 - hex "Kernel load size" - default 0 - depends on HAS_FLASH_LOAD_OFFSET - 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 - -config TEXT_SECTION_OFFSET - hex "TEXT section offset" - 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 .text - 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 CUSTOM_RODATA_LD - bool "Include custom-rodata.ld" - help - Include a customized linker script fragment for inserting additional - data and linker directives into the rodata section. - -config CUSTOM_RWDATA_LD - bool "Include custom-rwdata.ld" - help - Include a customized linker script fragment for inserting additional - data and linker directives into the data section. - -config CUSTOM_SECTIONS_LD - bool "Include custom-sections.ld" - help - Include a customized linker script fragment for inserting additional - arbitrary sections. - -config LINK_WHOLE_ARCHIVE - bool "Allow linking with --whole-archive" - help - This options allows linking external libraries with the - --whole-archive option to keep all symbols. - -config KERNEL_ENTRY - string "Kernel entry symbol" - default "__start" - help - Code entry symbol, to be set at linking phase. - -config CHECK_LINK_MAP - bool "Check linker map" - default y - help - Run a linker address generation validity checker at the end of the - build. - -endmenu - -menu "Compiler Options" - -config CROSS_COMPILE - string "Cross-compiler tool prefix" - help - Same as running 'make CROSS_COMPILE=prefix-' but stored for - default make runs in this kernel build directory. You don't - need to set this unless you want the configured kernel build - directory to select the cross-compiler automatically. - -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_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. - -endmenu - -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 - -config OUTPUT_DISASSEMBLY - bool "Create a disassembly file" - default y - help - Create an .lst file with the assembly listing of the firmware. - -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 BUILD_OUTPUT_HEX - bool "Build a binary in HEX format" - help - Build a binary in HEX format. This will build a zephyr.hex file need - by some platforms. - -config BUILD_OUTPUT_BIN - bool "Build a binary in BIN format" - default y - help - Build a binary in BIN format. This will build a zephyr.bin file need - by some platforms. - -config BUILD_OUTPUT_EXE - bool "Build a binary in ELF format with .exe extension" - help - Build a binary in ELF format that can run in the host system. This - will build a zephyr.exe file. - -config BUILD_OUTPUT_S19 - bool "Build a binary in S19 format" - help - Build a binary in S19 format. This will build a zephyr.s19 file need - by some platforms. - -config BUILD_OUTPUT_STRIPPED - bool "Build a stripped binary" - help - Build a stripped binary. This will build a zephyr.stripped file need - by some platforms. - -config APPLICATION_DEFINED_SYSCALL - bool "Scan application folder for any syscall definition" - help - Scan additional folders inside application source folder - for application defined syscalls. - -endmenu -endmenu - -menu "System Monitoring Options" - -config PERFORMANCE_METRICS - bool "Enable performance metrics [EXPERIMENTAL]" - help - Enable Performance Metrics. - -config BOOT_TIME_MEASUREMENT - bool "Boot time measurements [EXPERIMENTAL]" - depends on PERFORMANCE_METRICS - help - This option enables the recording of timestamps during system start - up. The global variable __start_time_stamp records the time kernel begins - executing, while __main_time_stamp records when main() begins executing, - and __idle_time_stamp records when the CPU becomes idle. All values are - recorded in terms of CPU clock cycles since system reset. - -config CPU_CLOCK_FREQ_MHZ - int "CPU Clock Frequency in MHz" - default 20 - depends on BOOT_TIME_MEASUREMENT - help - This option specifies the CPU Clock Frequency in MHz in order to - convert Intel RDTSC timestamp to microseconds. - -config STATS - bool "Statistics support" - help - Enable per-module event counters for troubleshooting, maintenance, - and usage monitoring. Statistics can be retrieved with the mcumgr - management subsystem. - -config STATS_NAMES - bool "Statistic names" - depends on STATS - help - Include a full name string for each statistic in the build. If this - setting is disabled, statistics are assigned generic names of the - form "s0", "s1", etc. Enabling this setting simplifies debugging, - but results in a larger code size. -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 - 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 BOOTLOADER_MCUBOOT - bool "MCUboot bootloader support" - 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 TEXT_SECTION_OFFSET to a default value that allows space - for the MCUboot image header - * Activating SW_VECTOR_RELAY on Cortex-M0 (or Armv8-M baseline) - targets with no built-in vector relocation mechanisms - * Including dts/common/mcuboot.overlay when building the Device - Tree in order to place and link the image at the slot0 offset - -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 REALMODE - bool "boot from x86 real mode" - depends on X86 - help - This option enabled Zephyr to start in x86 real mode, instead of - protected mode. - -config BOOTLOADER_KEXEC - bool "Boot using Linux kexec() system call" - depends on X86 - help - This option signifies that Linux boots the kernel using kexec system call - and utility. This method is used to boot the kernel over the network. - -config BOOTLOADER_UNKNOWN - bool "Generic boot loader support" - depends on X86 - help - This option signifies that the target has a generic bootloader - or that it supports multiple ways of booting and it isn't clear - at build time which method is to be used. When this option is enabled - the board may have to do extra work to ensure a proper startup. - -config BOOTLOADER_CONTEXT_RESTORE - bool "Boot loader has context restore support" - default y - depends on SYS_POWER_DEEP_SLEEP && BOOTLOADER_CONTEXT_RESTORE_SUPPORTED - help - This option signifies that the target has a bootloader - that restores CPU context upon resuming from deep sleep - power state. - -config REBOOT - bool "Reboot functionality" - select SYSTEM_CLOCK_DISABLE - help - Enable the sys_reboot() API. Enabling this can drag in other subsystems - needed to perform a "safe" reboot (e.g. SYSTEM_CLOCK_DISABLE, to stop the - system clock before issuing a reset). -endmenu diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index 0ca78f38bd6..a7adb570e5d 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -6,6 +6,48 @@ # SPDX-License-Identifier: Apache-2.0 # +menu "System Monitoring Options" + +config PERFORMANCE_METRICS + bool "Enable performance metrics [EXPERIMENTAL]" + help + Enable Performance Metrics. + +config BOOT_TIME_MEASUREMENT + bool "Boot time measurements [EXPERIMENTAL]" + depends on PERFORMANCE_METRICS + help + This option enables the recording of timestamps during system start + up. The global variable __start_time_stamp records the time kernel begins + executing, while __main_time_stamp records when main() begins executing, + and __idle_time_stamp records when the CPU becomes idle. All values are + recorded in terms of CPU clock cycles since system reset. + +config CPU_CLOCK_FREQ_MHZ + int "CPU Clock Frequency in MHz" + default 20 + depends on BOOT_TIME_MEASUREMENT + help + This option specifies the CPU Clock Frequency in MHz in order to + convert Intel RDTSC timestamp to microseconds. + +config STATS + bool "Statistics support" + help + Enable per-module event counters for troubleshooting, maintenance, + and usage monitoring. Statistics can be retrieved with the mcumgr + management subsystem. + +config STATS_NAMES + bool "Statistic names" + depends on STATS + help + Include a full name string for each statistic in the build. If this + setting is disabled, statistics are assigned generic names of the + form "s0", "s1", etc. Enabling this setting simplifies debugging, + but results in a larger code size. +endmenu + menu "Debugging Options" config DEBUG