[tools] Add KConfig files.

This commit is contained in:
bernard 2017-01-31 11:54:12 +08:00
parent cb61d1ffbc
commit d692001fd5
8 changed files with 442 additions and 0 deletions

2
Kconfig Normal file
View File

@ -0,0 +1,2 @@
source "$RTT_DIR/src/KConfig"
source "$RTT_DIR/components/KConfig"

13
components/KConfig Normal file
View File

@ -0,0 +1,13 @@
menu "RT-Thread Components"
source "$RTT_DIR/components/finsh/KConfig"
source "$RTT_DIR/components/dfs/KConfig"
source "$RTT_DIR/components/drivers/KConfig"
source "$RTT_DIR/components/libc/KConfig"
source "$RTT_DIR/components/net/KConfig"
endmenu

77
components/dfs/KConfig Normal file
View File

@ -0,0 +1,77 @@
menu "Device virtual file system"
config RT_USING_DFS
bool "Using device virtual file system"
default y
help
The device file system is a light weight virtual file system.
if RT_USING_DFS
config DFS_USING_WORKDIR
bool "Using working directory"
default y
config DFS_FILESYSTEMS_MAX
int "The maximal number of mounted file system"
default 2
config DFS_FD_MAX
int "The maximal number of opened files"
default 4
config RT_USING_DFS_ELMFAT
bool "Enable elm-chan fatfs"
default y
help
FatFs is a generic FAT/exFAT file system module for small embedded systems.
if RT_USING_DFS_ELMFAT
config RT_DFS_ELM_CODE_PAGE
int "OEM code page"
default 437
config RT_DFS_ELM_MAX_LFN
int "Maximal size of file name length"
default 256
config RT_DFS_ELM_DRIVES
int "Number of volumes (logical drives) to be used."
default 2
config RT_DFS_ELM_MAX_SECTOR_SIZE
int "Maximum sector size to be handled."
default 512
help
if you use some spi nor flash for fatfs, please set this the erase sector size, for example 4096.
config RT_DFS_ELM_USE_ERASE
bool "Enable sector erase feature"
default n
config RT_DFS_ELM_REENTRANT
bool "Enable the reentrancy (thread safe) of the FatFs module"
default y
endif
config RT_USING_DFS_DEVFS
bool "Using devfs for device objects"
default y
config RT_USING_DFS_NET
bool "Enable BSD socket operated by file system API"
default n
help
Let BSD socket operated by file system API, such as read/write and involveed in select/poll POSIX APIs.
config RT_USING_DFS_NFS
bool "Using NFS v3 client file system"
default n
if RT_USING_DFS_NFS
config RT_NFS_HOST_EXPORT
string "NFSv3 host export"
default "192.168.1.5:/"
endif
endif
endmenu

View File

@ -0,0 +1,90 @@
menu "Device Drivers"
config RT_USING_SERIAL
bool "Using serial device drivers"
default y
config RT_USING_CAN
bool "Using CAN device drivers"
default n
config RT_USING_HWTIMER
bool "Using hardware timer device drivers"
default n
config RT_USING_I2C
bool "Using I2C device drivers"
default n
config RT_USING_PIN
bool "Using generic GPIO device drivers"
default y
config RT_USING_MTD_NOR
bool "Using MTD Nor Flash device drivers"
default n
config RT_USING_MTD_NAND
bool "Using MTD Nand Flash device drivers"
default n
config RT_USING_RTC
bool "Using RTC device drivers"
default n
config RT_USING_SDIO
bool "Using SD/MMC device drivers"
default n
config RT_USING_SPI
bool "Using SPI Bus/Device device drivers"
default n
if RT_USING_SPI
config RT_USING_W25QXX
bool "Using W25QXX SPI NorFlash"
default n
config RT_USING_GD
bool "Using GD SPI NorFlash"
default n
config RT_USING_ENC28J60
bool "Using ENC28J60 SPI Ethernet network interface"
select RT_USING_LWIP
default n
config RT_USING_SPI_WIFI
bool "Using RW009/007 SPI Wi-Fi wireless interface"
select RT_USING_LWIP
default n
endif
config RT_USING_WDT
bool "Using Watch Dog device drivers"
default n
config RT_USING_USB_HOST
bool "Using USB host"
default n
if RT_USING_USB_HOST
config RT_USBH_ADK
bool "Enable connected with Android by ADK USB"
default n
endif
config RT_USING_USB_DEVICE
bool "Using USB device"
default n
if RT_USING_USB_DEVICE
config RT_USB_DEVICE_CDC
bool "Enable to use device as CDC device"
default n
config RT_USB_DEVICE_MSTORAGE
bool "Enable to use device as Mass Storage device"
default n
endif
endmenu

43
components/finsh/KConfig Normal file
View File

@ -0,0 +1,43 @@
menu "Command shell"
config RT_USING_FINSH
bool "finsh shell"
default y
if RT_USING_FINSH
config FINSH_USING_SYMTAB
bool "Using symbol table for commands"
default y
config FINSH_USING_DESCRIPTION
bool "Keeping description in symbol table"
default y
config FINSH_THREAD_STACK_SIZE
int "The stack size for finsh thread"
default 4096
config FINSH_USING_AUTH
bool "shell support authentication"
default n
config FINSH_DEFAULT_PASSWORD
string "The default password for shell authentication"
default "rtthread"
config FINSH_USING_MSH
bool "Using module shell"
default y
config FINSH_USING_MSH_DEFAULT
bool "Using module shell in default"
default y
config FINSH_USING_MSH_ONLY
bool "Only using module shell"
default n
endif
endmenu

11
components/libc/KConfig Normal file
View File

@ -0,0 +1,11 @@
menu "libc"
config RT_USING_LIBC
bool "Enable libc APIs from toolchain"
default y
config RT_USING_PTHREADS
bool "Enable pthreads APIs"
default y
endmenu

156
src/Kconfig Normal file
View File

@ -0,0 +1,156 @@
menu "Real-time Kernel"
config RT_NAME_MAX
int "The maximal size of kernel object name"
range 2 32
default 8
help
Each kernel object, such as thread, timer, semaphore etc, has a name, the RT_NAME_MAX is the maximal size of this object name.
config RT_ALIGN_SIZE
int "Alignment size for CPU architecture data access"
default 4
help
Alignment size for CPU architecture data access
config RT_THREAD_PRIORITY_MAX
int "The maximal level value of priority of thread"
range 8 256
default 32
config RT_TICK_PER_SECOND
int "Tick frequency, Hz"
range 10 1000
default 100
help
System's tick frequency, Hz.
config RT_DEBUG
bool "Enable debug features"
default y
if RT_DEBUG
config RT_USING_OVERFLOW_CHECK
bool "Using stack overflow checking"
default y
help
Enable thread stack overflow checking. The stack overflow is checking when each thread switch.
config RT_DEBUG_INIT
bool "Enable system initialization informat print"
default n
help
print the procedure name of initialization
config RT_DEBUG_THREAD
bool "Enable thread switch information dump"
default n
help
print the switch to/from thread name when each thread context switch
endif
config RT_USING_HOOK
bool "Enable system hook"
default y
help
Enable the hook function when system running, such as idle thread hook, thread context switch etc.
config RT_USING_TIMER_SOFT
bool "Enable software timer with a timer thread"
default n
help
the timeout function context of soft-timer is under a high priority timer thread.
if RT_USING_TIMER_SOFT
config RT_TIMER_THREAD_PRIO
int "The priority level value of timer thread"
default 4
config RT_TIMER_THREAD_STACK_SIZE
int "The stack size of timer thread"
default 512
endif
menu "Inter-Thread communication"
config RT_USING_SEMAPHORE
bool "Enable semaphore"
default y
config RT_USING_MUTEX
bool "Enable mutex"
default y
config RT_USING_EVENT
bool "Enable event flag"
default y
config RT_USING_MAILBOX
bool "Enable mailbox"
default y
config RT_USING_MESSAGEQUEUE
bool "Enable message queue"
default y
endmenu
menu "Memory Management"
config RT_USING_MEMPOOL
bool "Using memory pool"
default y
help
Using static memory fixed partition
config RT_USING_MEMHEAP
bool "Using memory heap object"
default n
help
Using memory heap object to manage dynamic memory heap.
config RT_USING_HEAP
bool "Using dynamic memory management"
default y
if RT_USING_HEAP
choice USING_HEAP
config RT_USING_SMALL_MEM
bool "The memory management for small memory"
config RT_USING_SLAB
bool "Using SLAB memory management for large memory"
endchoice
endif
endmenu
menu "Kernel Device Object"
config RT_USING_DEVICE
bool "Using device object"
default y
config RT_USING_CONSOLE
bool "Using console for rt_kprintf"
default y
if RT_USING_CONSOLE
config RT_CONSOLEBUF_SIZE
int "the buffer size for console log printf"
default 128
config RT_CONSOLE_DEVICE_NAME
string "the device name for console"
default "uart"
endif
endmenu
endmenu

50
tools/mkrtconfig.py Normal file
View File

@ -0,0 +1,50 @@
import os
# make rtconfig.h from .config
def mk_rtconfig(filename):
try:
config = file(filename)
except:
print 'open .config failed'
return
rtconfig = file('rtconfig.h', 'w')
rtconfig.write('#ifndef RT_CONFIG_H__\n')
rtconfig.write('#define RT_CONFIG_H__\n\n')
empty_line = 1
for line in config:
line = line.lstrip(' ').replace('\n', '').replace('\r', '')
if len(line) == 0: continue
if line[0] == '#':
if len(line) == 1:
if empty_line:
continue
rtconfig.write('\n')
empty_line = 1
continue
rtconfig.write('/*%s */\n' % line[1:])
empty_line = 0
else:
empty_line = 0
setting = line.split('=')
if len(setting) >= 2:
if setting[0].startswith('CONFIG_'):
setting[0] = setting[0][7:]
if setting[1] == 'y':
rtconfig.write('#define %s\n' % setting[0])
else:
rtconfig.write('#define %s %s\n' % (setting[0], setting[1]))
rtconfig.write('#endif\n')
rtconfig.close()
if __name__ == "__main__":
mk_rtconfig('.config')