NuttX Configuration System

Source: Internet
Author: User
Tags sendfile

(Embedded real-time operating system rtos nuttx 7.1)
Introduction to Configuration System 1: the source code of NuttX adopts the same configuration system as the Linux kernel, and does not have to build a configuration system like eCos. The configuration system mainly includes Kconfig, Makefile, and configuration tools to generate the configuration interface. The configuration interface is generated by the configuration tool. The configuration tool is compiled and executed by Makefile, and the options in the configuration interface are defined by Kconfig files at various levels.

The Kconfig configuration data file appears in almost all the NuttX directories. These data files are still part of development. The Kconfig file contains the configuration information associated with the directory of the Kconfig file.

The main Kconfig file of NuttX is nuttx/Kconfig. The main Kconfig file calls the Kconfig file of subdirectories at all levels and the Kconfig file of the application directory to form a tree-like relationship.

Menus are organized in a tree structure. The main menu has sub-menus and sub-menus or configuration options. Each option can have dependencies to determine whether the dependency is displayed. The subitem is displayed only when the parent item of the dependent item has been selected.

NuttX uses the kconfig frontend as the configuration tool. The front-end of kconfig has already introduced the installation in the article "the installation script of NuttX. After installation, an executable file kconfig-mconf is generated.

The make command calls the Makefile file. The top-level Makefile file of NuttX is nuttx/Makefile, which simply contains the following lines of nuttx/Makefile. unix:

menuconfig:    $(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-mconf Kconfig
Config_cmd_dir is defined in the preset. config file. If not, the default value is../apps. The target menuconfig calls the kconfig-mconf command for configuration. 2. the operation method is the preset. config file. Copied from nuttx/config/<board>/<target configuration>/defconfig. It is implemented by the following lines in the "Install script for NuttX:
Echo "nuttx configuration" cd $ BASEDIR/$ TOPDIR/nuttx/tools./configure. sh $ TARGETCONFIG
Execute the make menuconfig command in the nuttx directory to read the preset. config file and bring up the text menu-based configuration interface ,:

Keyboard operation method:
Press <key> browse menu and press <Enter> Select Sub-menu and press <Y> include this option. Press <N> If this option is not included, press <M> to compile it into a module Press <Esc> exit or use the <space> key to select three types of brackets:
Brackets: either null, indicating that the option is included or "*", indicating that the option is not included. Angle brackets: Can be empty, "*", and "M". Multiple choices can be selected and compiled into modules. Parentheses: select one of the provided options or manually enter a value of the specified range. 3. Configure Option 3.1 Build Setup Prompt for development and/or incomplete code/drivers -- Prompt for developing and incomplete code and drivers.
Default to smallest size -- set the Default value to the minimum size. Changing the default value does not affect the existing settings in your configuration file, but applies only to new settings that require the default value.
Build Host Platform: the Host Platform that is built. You can select Linux, OSX, Windows, and Other.
Build Configuration -- Build Configuration
Binary Output Formats -- Binary Output format
Customize Header Files -- custom Header Files
Debug Options -- Debug Options
Optimization Level-Optimization Level 3.2 System Type CPU Architecture-CPU Architecture
(The architecture-specific configuration is omitted here)
* ** Board Settings ***
Delay loops per millisecond -- latency loop for system boot and driver initialization (MS)
Calibrate delay loop -- calibration delay loop
* ** Interrupt options ***
Interrupt Stack Size -- Size of the interrupted Stack
* ** Boot options ***
Boot Mode -- Boot Mode
Boot Memory Configuration -- Boot Memory Configuration 3.3 Board Selection Select target board -- Select target Board
* ** Common Board Options ***
Board LED support-onboard LED support
Board button support-onboard button support
MMC/SD minor number -- MMC/SD master device number
MMC/SD slot number -- MMC/SD slot
MMC/sd spi device number -- SPI device number used by MMC/SD
* ** Board-Specific Options ** 3.4 RTOS Features (RTOS Features) m board/driver initialization -- Custom Board/driver initialization
Milliseconds per system timer tick-Number of Milliseconds in the system clock cycle
64-bit system clock-64-bit system clock
Round robin timeslice (MSEC) -- rotation time slice Length
Enable CPU load monitoring -- Enable CPU load monitoring
Monitor system performance-Monitor system Operation
Maximum task name size -- Maximum size of the task name
Support parent/child task relationships -- Support parent-child task relationships
Enables Julian time conversions -- enable Julian time Conversion
Start year -- Start year
Start month -- Start month
Start day -- Start day
Enable/dev/console -- Enable/dev/console
Enable mutex types -- Enable mutex type
Enable priority inheritance -- Enable priority inheritance
Disable cloning of file descriptors -- Disable file descriptor cloning
Disable clone file descriptors without stdio -- Do not clone file descriptors outside stdio
Disable cloning of socket descriptors -- Disable socket descriptor cloning
Enable waitpid () API -- Enable waitpid () API
Enable startup hook -- Enable startup hook
Enable atexit () API -- Enable atexit () API
Enable on_exit () API -- Enable on_exit () API
Application entry point -- Application entry point
Disable NuttX interfaces -- Disable the NuttX Interface
Disable clock interfaces -- Disable the clock interface
Disable POSIX timers -- Disable POSIX Timer
Disable pthread support -- Disable pthread support
Disable signal support -- Disable signal support
Disable POSIX message queue support -- Disable POSIX message queue support
Disable environment variable support -- Disable environment variable support
* ** Signal Numbers ***
Number of SIGUSR1--SIGUSR1
Number of SIGUSR2--SIGUSR2
Number of SIGALRM--SIGALRM
Number of SIGCONDTIMEDOUT--SIGCONDTIMEDOUT
Number of SIGWORK--SIGWORK
* ** Sizes of incluable things (0 disables )***
Max number of tasks -- maximum number of tasks
Maximum number of task arguments -- Maximum number of task Parameters
Maximum number of pthread keys -- Maximum number of pthread keys
Maximum number of file descriptors per task -- Maximum number of file descriptors for each task
Maximum number of FILE streams -- Maximum number of FILE streams
Maximum size of a file name -- Maximum file name size
Number of pre-allocated messages -- Number of pre-allocated messages
Maximum message size -- Maximum message size
Maximum number of watchdog parameters -- Maximum number of watchdog parameters
Number of pre-allocated watchdog timers -- Number of pre-allocated watchdog timers
Number of pre-allocated POSIX timers -- Number of pre-allocated POSIX timers
* ** Stack and heap information ***
Idle thread stack size -- the size of the Idle thread stack
Main thread stack size -- size of the Main thread stack
Minimum pthread stack size -- maximum pthread stack size
Default pthread stack size -- Default pthread stack size 3.5 Device driver Disable driver poll interfaces -- Disable driver polling Interface
Enable/dev/null -- Enable/dev/null
Enable/dev/zero -- Enable/dev/zero
Enable loop device -- Enable the loop device
RAM Disk Support -- ramdisk Support
CAN Driver Support -- CAN Driver Support
PWM Driver Support -- PWM Driver Support
I2C Driver Support -- I2C Driver Support
SPI Driver Support -- SPI Driver Support
I2S Driver Support -- I2S Driver Support
RTC Driver Support -- RTC Driver Support
Watchdog Timer Support -- Support for Watchdog timers
Analog Device (ADC/DAC) Support-Analog Device (ADC/DAC) Support
Audio Device Support-Audio Device Support
Video Device Support-Video Device Support
Block-to-Character (BCH) Support -- Block-to-Character drive (BCH) Support
Input Device Support -- Input Device Support
LCD Driver Support-LCD Driver Support
MMC/SD Driver Support -- MMC/SD Driver Support
Memory Technology Device (MTD) Support-storage Technology Device (MTD) Support
Network Device/PHY Support -- Network Device/PHY Support
FIFO and named pipe drivers -- FIFO and named pipeline driver
Power management (PM) driver interfaces -- Power management (PM) driver Interface
Power Management Support -- Power Management Support
Sensor Device Support-Sensor Device Support
Osmocom-bb Sercomm Driver Support -- Osmocom-bb Sercomm Driver Support
Serial Driver Support-Support for Serial Driver
USB Device Driver Support-USB Device Driver Support
USB Host Driver Support-USB Host Driver Support
Wireless Device Support-Wireless Device Support
* ** System Logging Device Options ***
* ** System Logging ***
RAM log device support -- RAM log device supports 3.6 Network Support (Networking support) Networking support -- network Support
Not interrupt driven -- no interrupt driver
Use multiple device-side I/O buffers -- Use multiple device-side I/O buffers
Promiscuous mode -- hybrid mode
Number of socket descriptor -- Number of socket Descriptors
Max socket operations -- maximum number of concurrent socket operations
Socket options -- Socket options
SO_LINGER socket option -- SO_LINGER socket option
Network packet buffer size (MTU) -- Network packet buffer size (MTU)
Urgent data-emergency data
TCP/IP Networking -- TCP/IP Networking
UDP Networking-UDP Networking
ICMP networking support -- ICMP network support
ICMP ping interfaces -- ICMP ping Interface
Ping address configuration -- Ping address configuration
IGMPv2 clientsupport -- IGMPv2 Client Support
Collect network statistics-Collect network statistics
Receive window size -- size of the Receiving window
ARP table size -- ARP table size
ARP address harvesting -- Obtain ARP address
Routing table suport -- route table support
Multi-cast Tx support -- support for multicast sending
SLIP support -- SLIP supports File Systems *** File system configuration ***
Disable support for mount points -- do not support mount points
Disable pseudo-filesystem operations -- Disable operations on the pseudo File System
File mapping emulation-File ing Simulation
FAT file system -- FAT file system
FAT upper/lower names -- FAT upper/lower name
FAT long file names -- FAT long file name
FAT maximum file name size -- maximum FAT file name size
FAT timestamps -- FAT Timestamp
DMA memory allocator -- DMA memory distributor
NFS client file system -- NFS client file system
NXFFS file system -- NXFFS file system
ROMFS file system -- ROMFS file system
SMART file system -- SMART file system
BINFS File System -- BINFS File System
PROCFS File System -- PROCFS File System
* ** System Logging ***
Enable SYSLOG Controls -- Enable SYSLOG Control
Advanced SYSLOG features -- Advanced SYSLOG feature 3.8 graphical Support (Graphics support) NX Graphics -- NX Graphics3.9 Memory Management Build Support for multiple heaps -- Multi-heap Build support
Small memory model-Small memory model
Number of memory regions -- Number of memory partitions
Enable Granule Allocator -- Enable the granularity distributor 3.10 Audio Support (Audio Support) Audio support -- Audio Support 3.11 Binary format (Binary Formats) Disble BINFMT Support -- disable BINFMT support
Support PATH variable -- supports PATH variables
Enable the NXFLAT Binary Format -- Enable NXFLAT Binary Format
Enable the ELF Binary Format -- Enable the ELF Binary Format
Support Builtin Applications -- Support for built-in Applications
Symbol Tables Ordered by Name -- Sort the Symbol table by Name. Library Routines *** Standard C Library Options ***
C stdio buffer size -- c stdio buffer size
STDIO line buffering -- STDIO row Buffer
Number unget () characters -- Number of unget () characters
Home directory -- Home directory
Standard Math library-Standard Math library
Disable sprintf support fieldwidth -- Disable sprintf to support field width
Enable floating point in printf -- Enable floating point in printf
Order of the random number generate -- random number generation rule
Newline Options -- new line Options
Enable exec [l | v]/posix_spawn () Support -- Enable exec [l | v]/posix_spawn () Support
Spawn Stack Size -- Size of the created sub-Stack
Default task_spawn Stack Size -- Default task_spawn Stack Size
Enable strerror -- Enable strerror
Perror () to stdout -- perror () output to stdout
Low-level console output -- underlying console output
Sendfile () buffer size -- sendfile () buffer size
Support for ROM string access -- supports ROM string access
Enable arch optimized functions -- Enable functions optimized for a specific architecture
* ** Non-standard Library Support ***
Enable worker thread -- Enable the worker thread
High priority (kernel) worker thread -- High priority (kernel) worker thread
High priority worker thread priority -- priority of a High-priority worker thread
High priority worker thread period -- the cycle of a High-priority worker thread
High priority worker thread stack size -- stack size of High-priority worker threads
Low priority (kernel) worker thread -- Low-priority (kernel) worker thread
Keyboard CODEC -- Keyboard codecs
Segment LCD codec-Segment LCD Decoder
* ** Basic CXX Support ***
Sizeof (_ Bool) is 8-bits -- sizeof (_ Bool) is 8 bits
Have C ++ compiler -- with a C ++ compiler
Have C ++ initialization -- C ++ initialization
Size_t is type long -- size_t is of the long type
* ** UClibc ++ Standard C ++ Library ***
Build uClibc ++ (must be installed) -- Build uClibc ++ (must be installed) 3.13 Application Configuration (Application Configuration) Built-In Applications -- built-in Application
Examples -- Example
Graphics Support-graphic Support
Interpreters -- Interpreter
Network Utilities-Network Utilities
FreeModBus-FreeModBus Protocol
NSH Library -- NSH Library
NxWidgets/NxWM -- NxWidgets/NxWM GUI package
Platform-specific Support-Platform-specific Support
System Libraries and NSH Add-Ons -- System library and NSH plug-in 4 configuration order basic configuration order is from bottom to top:
Select build environment select processor select board select supported peripherals configure Device Driver configure application options for creating new configuration, this is quite the right direction, however, it is not suitable for modifying existing configurations. 5. Click <Yes> Save when you exit the configuration page, and generate a new. config file under the "nuttx" directory ,:

After. config is generated, the task of configuring the system is completed .. Where does config go? It will be introduced in the next article "NuttX compilation system. 6. manually modify the format of the. config file as follows:
## Automatically generated file; DO NOT EDIT.# Nuttx/ Configuration### Build Setup## CONFIG_EXPERIMENTAL is not set## Build Configuration## CONFIG_APPS_DIR="../apps"# CONFIG_BUILD_2PASS is not set## Binary Output Formats## CONFIG_RRLOAD_BINARY is not setCONFIG_INTELHEX_BINARY=y# CONFIG_MOTOROLA_SREC is not setCONFIG_RAW_BINARY=y## Customize Header Files## CONFIG_ARCH_STDBOOL_H is not set# CONFIG_ARCH_MATH_H is not set# CONFIG_ARCH_FLOAT_H is not set# CONFIG_ARCH_STDARG_H is not set## Debug Options## CONFIG_DEBUG is not set# CONFIG_DEBUG_SYMBOLS is not set......
For simple modifications, you can make them in a text editor, such as modifying the destination IP address and Host IP address of NSH:
CONFIG_NSH_IPADDR=0xc0a8020aCONFIG_NSH_DRIPADDR=0xc0a80201
The ing between the hexadecimal value assignment and the dot-decimal value is as follows:
C0 -- 192
A8 -- 168
02--2
0a -- 107 Kconfig language 7.1 menu items most options define a configuration option, other options play a secondary role. A configuration option can be defined as follows:
config DEBUG_USB    bool "USB Debug Output"    default n    depends on USBDEV || USBHOST    ---help---        Enable usb debug SYSLOG output (disabled by default)
Start a new configuration option with the keyword "config" and follow multiple parameters. The following lines define the attributes of the configuration option. The property can be the type, input prompt, dependency, help text, and default value of the configuration option. Configuration options with the same name can be defined multiple times, but each definition can only have a single input prompt and the type cannot conflict. 7.2 menu attributes a menu option can have multiple attributes, but these attributes are not used at will and are restricted by syntax.

Each configuration option must have a type definition. The types include bool, tristate, string, hex, and int. There are two basic types: tristate and string. Each type definition can have an input prompt.

Enter the prompt: "prompt" <prompt> ["if" <expr>] -- each menu option has a maximum of one prompt, which can be displayed on the menu. An optional dependency can be added using the "if" statement.

Default Value: "default" <expr> ["if" <expr>] -- the configuration options can have several default values. If multiple default values are available, only the first default value is used. The default value of an option can also be defined elsewhere and overwritten by the default value defined above. If no other value is set, the default value is the unique value of the configuration symbol. If a selection prompt appears, the default value can be displayed and the configuration can be modified. You can use the "if" statement to add optional Dependencies by default.

Dependency: "depends on"/"requires" <expr> -- This defines the dependency between menu options. If multiple dependencies are defined, connect them with the "&" symbol. The dependency is valid for all other options in this menu (you can also use the "if" Statement ).

Reverse dependency: "select" <symbol> ["if" <expr>] -- a common dependency is to narrow down the upper limit of the symbol, while a reverse dependency is the lower limit of the symbol. The value of the current menu symbol is used as the minimum value that can be set by the symbol. If the symbol value is selected multiple times, this limit is set to the maximum value. Reverse dependency can only be used for Boolean or triplicate symbols.

Number range: "range" <symbol> ["if" <expr>] -- this allows the input values of int and hex types to be limited to a certain range. The value entered by the user must be greater than or equal to the first symbolic value and less than or equal to the second symbolic value.

Help text: "help" or "--- help ---" -- This defines the help text. The end of the help text is determined by the indentation level. When a line is indented less than the first line of the help text, the help text is deemed to have ended. "--- Help ---" is no different from "help", mainly to provide developers with help different from "help. 7.3 The Menu dependency Dependency defines the display of menu options, which can also reduce the selection range of three-state symbols. The expression's three-state logic has one more State than the Boolean logic, which indicates the module state. The syntax of the dependency expression is as follows:
<expr> ::= <symbol>                             (1)           <symbol> '=' <symbol>                (2)           <symbol> '!=' <symbol>               (3)           '(' <expr> ')'                       (4)           '!' <expr>                           (5)           <expr> '&&' <expr>                   (6)           <expr> '||' <expr>                   (7)
Expressions are listed in descending order of priority.

(1) convert a symbol to an expression. A boolean or a three-state symbol can be converted to a corresponding expression value. The result of other types of symbols is "n ".
(2) If the values of the two symbols are equal, "y" is returned; otherwise, "n" is returned ".
(3) If the values of the two symbols are equal, "n" is returned; otherwise, "y" is returned ".
(4) return the value of the expression. The expressions in parentheses are preferentially calculated.
(5) return the calculation result of (2-/expr.
(6) return the calculation result of min (/expr/,/expr.
(7) return the calculation result of max (/expr/,/expr.

The value of an expression is "n", "m", or "y" (or 0, 1, or 2 ). When the expression value is "m" or "y", the menu option is displayed.

There are two types of symbols: constant and constant.

Uncommon symbols are the most common and can be defined using the config statement. A non-constant is composed of digits or underscores.

Constant symbols are only part of the expression. Constant symbols are always included in the quotation marks. You can use other characters in quotation marks. The quotation marks must be escaped by the "\" sign. 7.4 menu organization structure the tree structure of menu options has two ways of organization.

The first is to explicitly declare a menu.
menu "SPI Configuration"    depends on STM32_SPIconfig STM32_SPI_INTERRUPTS    bool "Interrupt driver SPI"    default n    ---help---......endmenu
The part between menu and endmenu is the sub menu of SPI Configuration. All sub-options inherit the dependencies of the menu. For example, the dependency "pai_spi" is added to the dependency list of the "pai_spi_interrupts" configuration option.

The second is to determine the menu structure through dependency.

If a menu option depends on the previous one, it is a sub menu. This requires that the previous option and suboption be displayed synchronously or not.
config DISABLE_OS_API    bool "Disable NuttX interfaces"    default y......config DISABLE_CLOCK    bool "Disable clock interfaces"    depends on DISABLE_OS_API    default n
DISABLE_CLOCK depends on DISABLE_ OS _API, which is displayed only when DISABLE_ OS _API is not "n. 7.5 Kconfig syntax the Kconfig configuration file describes a series of menu options. Each line starts with a keyword (except the help text ). The following keywords end menu options: config, menuconfig, choice/endchoice, comment, menu/endmenu, if/endif, source. The first five menu options are also defined.

Config: "config" <symbol>, <config options> -- this can define a configuration symbol <symbol>, and you can configure option attributes.

Menuconfig: "menuconfig" <symbol>, <config options> -- this is similar to a simple configuration option, but it implies that all sub-options should be displayed as a list of independent options.

Choices: "choice", <choice options>, <choice block>, and "endchoice" -- this defines a selection group and allows you to configure option attributes. Each option can only be boolean or triplicate. Only one configuration option can be selected for the boolean type, and multiple options can be configured as "m" for the three-state type ". If a hardware device has multiple drivers, the kernel can only be statically linked or loaded at a time, but all drivers can be compiled into modules. You can also select another option "optional". You can set the option to "n" without selecting any options.

Comment: "comment" <prompt>, <comment options> -- This defines a comment, which is displayed on the menu during the preparation process, or can be displayed back to the output file. The only possible option is dependency.

Menu: "menu" <prompt>, <menu options>, <menu block>, and "endmenu" -- this defines a Menu item, which is described in the menu organization structure. The only possible option is dependency.

If: "if" <expr>, <if block>, and "endif" -- this defines an if statement block. The dependency expression <expr> is attached to all encapsulated menu options.

Source: "source" <prompt> -- read the specified configuration file. The file to be read is parsed to generate a menu.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.