From 9ba62ab5e6b6282f79c0d1b58738b1026bafce75 Mon Sep 17 00:00:00 2001 From: ArdaFu Date: Thu, 2 Nov 2017 15:34:37 +0800 Subject: [PATCH 1/2] [components][net] Fix the bug that missing define RT_LWIP_IPADDR/MASKADDR/GWADDR when disable DHCP. --- components/net/KConfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/net/KConfig b/components/net/KConfig index cd758cd33a..b5f50de180 100644 --- a/components/net/KConfig +++ b/components/net/KConfig @@ -55,7 +55,7 @@ config RT_USING_LWIP default n endif - if !RT_LWIP_DHCP + menu "Static IPv4 Address" config RT_LWIP_IPADDR string "IPv4: IP address" default 192.168.1.30 @@ -67,7 +67,7 @@ config RT_USING_LWIP config RT_LWIP_MSKADDR string "IPv4: Mask address" default 255.255.255.0 - endif + endmenu config RT_LWIP_UDP bool "UDP protocol" From e97245dc5db6a105de435a60d8c21e2f11b6de34 Mon Sep 17 00:00:00 2001 From: ArdaFu Date: Thu, 2 Nov 2017 15:36:46 +0800 Subject: [PATCH 2/2] [bsp][tm4c129x] Add support to kconifg 1. add kconfig file and default .config 2. remove unused startup codes. --- bsp/tm4c129x/.config | 219 ++++++++++++++++ bsp/tm4c129x/KConfig | 32 +++ bsp/tm4c129x/applications/application.c | 17 +- bsp/tm4c129x/applications/board.h | 10 - bsp/tm4c129x/applications/startup.c | 68 ----- bsp/tm4c129x/rtconfig.h | 333 +++++++++++------------- 6 files changed, 406 insertions(+), 273 deletions(-) create mode 100644 bsp/tm4c129x/.config create mode 100644 bsp/tm4c129x/KConfig delete mode 100644 bsp/tm4c129x/applications/startup.c diff --git a/bsp/tm4c129x/.config b/bsp/tm4c129x/.config new file mode 100644 index 0000000000..04c0fec6a1 --- /dev/null +++ b/bsp/tm4c129x/.config @@ -0,0 +1,219 @@ +# +# Automatically generated file; DO NOT EDIT. +# RT-Thread Configuration +# + +# +# RT-Thread Kernel +# +CONFIG_RT_NAME_MAX=8 +CONFIG_RT_ALIGN_SIZE=4 +CONFIG_RT_THREAD_PRIORITY_MAX=32 +CONFIG_RT_TICK_PER_SECOND=100 +CONFIG_RT_DEBUG=y +CONFIG_RT_USING_OVERFLOW_CHECK=y +CONFIG_RT_DEBUG_INIT=0 +# CONFIG_RT_DEBUG_THREAD is not set +CONFIG_RT_USING_HOOK=y +CONFIG_IDLE_THREAD_STACK_SIZE=256 +CONFIG_RT_USING_TIMER_SOFT=y +CONFIG_RT_TIMER_THREAD_PRIO=4 +CONFIG_RT_TIMER_THREAD_STACK_SIZE=512 + +# +# Inter-Thread communication +# +CONFIG_RT_USING_SEMAPHORE=y +CONFIG_RT_USING_MUTEX=y +CONFIG_RT_USING_EVENT=y +CONFIG_RT_USING_MAILBOX=y +CONFIG_RT_USING_MESSAGEQUEUE=y +# CONFIG_RT_USING_SIGNALS is not set + +# +# Memory Management +# +CONFIG_RT_USING_MEMPOOL=y +CONFIG_RT_USING_MEMHEAP=y +CONFIG_RT_USING_HEAP=y +CONFIG_RT_USING_SMALL_MEM=y +# CONFIG_RT_USING_SLAB is not set + +# +# Kernel Device Object +# +CONFIG_RT_USING_DEVICE=y +CONFIG_RT_USING_CONSOLE=y +CONFIG_RT_CONSOLEBUF_SIZE=128 +CONFIG_RT_CONSOLE_DEVICE_NAME="uart0" +# CONFIG_RT_USING_MODULE is not set + +# +# RT-Thread Components +# +CONFIG_RT_USING_COMPONENTS_INIT=y +CONFIG_RT_USING_USER_MAIN=y + +# +# C++ features +# +# CONFIG_RT_USING_CPLUSPLUS is not set + +# +# Command shell +# +CONFIG_RT_USING_FINSH=y +CONFIG_FINSH_USING_HISTORY=y +CONFIG_FINSH_USING_SYMTAB=y +CONFIG_FINSH_USING_DESCRIPTION=y +CONFIG_FINSH_THREAD_PRIORITY=20 +CONFIG_FINSH_THREAD_STACK_SIZE=4096 +CONFIG_FINSH_CMD_SIZE=80 +# CONFIG_FINSH_USING_AUTH is not set +# CONFIG_FINSH_USING_MSH is not set + +# +# Device virtual file system +# +# CONFIG_RT_USING_DFS is not set + +# +# Device Drivers +# +CONFIG_RT_USING_DEVICE_IPC=y +CONFIG_RT_USING_SERIAL=y +# CONFIG_RT_USING_CAN is not set +# CONFIG_RT_USING_HWTIMER is not set +# CONFIG_RT_USING_I2C is not set +# CONFIG_RT_USING_PIN is not set +# CONFIG_RT_USING_MTD_NOR is not set +# CONFIG_RT_USING_MTD_NAND is not set +# CONFIG_RT_USING_RTC is not set +# CONFIG_RT_USING_SDIO is not set +# CONFIG_RT_USING_SPI is not set +# CONFIG_RT_USING_WDT is not set +# CONFIG_RT_USING_USB_HOST is not set +# CONFIG_RT_USING_USB_DEVICE is not set + +# +# POSIX layer and C standard library +# +# CONFIG_RT_USING_LIBC is not set +# CONFIG_RT_USING_PTHREADS is not set + +# +# Network stack +# + +# +# light weight TCP/IP stack +# +CONFIG_RT_USING_LWIP=y +CONFIG_RT_USING_LWIP141=y +# CONFIG_RT_USING_LWIP202 is not set +# CONFIG_RT_LWIP_IGMP is not set +CONFIG_RT_LWIP_ICMP=y +# CONFIG_RT_LWIP_SNMP is not set +CONFIG_RT_LWIP_DNS=y +CONFIG_RT_LWIP_DHCP=y +CONFIG_IP_SOF_BROADCAST=1 +CONFIG_IP_SOF_BROADCAST_RECV=1 +# CONFIG_LWIP_USING_DHCPD is not set + +# +# Static IPv4 Address +# +CONFIG_RT_LWIP_IPADDR="192.168.1.30" +CONFIG_RT_LWIP_GWADDR="192.168.1.1" +CONFIG_RT_LWIP_MSKADDR="255.255.255.0" +CONFIG_RT_LWIP_UDP=y +CONFIG_RT_LWIP_TCP=y +# CONFIG_RT_LWIP_RAW is not set +# CONFIG_RT_LWIP_PPP is not set +# CONFIG_RT_LWIP_PPPOE is not set +# CONFIG_RT_LWIP_PPPOS is not set +CONFIG_RT_LWIP_PBUF_NUM=16 +CONFIG_RT_LWIP_RAW_PCB_NUM=4 +CONFIG_RT_LWIP_UDP_PCB_NUM=4 +CONFIG_RT_LWIP_TCP_PCB_NUM=4 +CONFIG_RT_LWIP_TCP_SEG_NUM=40 +CONFIG_RT_LWIP_TCP_SND_BUF=8196 +CONFIG_RT_LWIP_TCP_WND=8196 +CONFIG_RT_LWIP_TCPTHREAD_PRIORITY=10 +CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=8 +CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE=1024 +CONFIG_RT_LWIP_ETHTHREAD_PRIORITY=12 +CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=1024 +CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=8 +# CONFIG_RT_LWIP_REASSEMBLY_FRAG is not set +CONFIG_LWIP_NETIF_STATUS_CALLBACK=1 +CONFIG_SO_REUSE=1 +CONFIG_LWIP_SO_RCVTIMEO=1 +CONFIG_LWIP_SO_SNDTIMEO=1 +CONFIG_LWIP_SO_RCVBUF=1 + +# +# Modbus master and slave stack +# +# CONFIG_RT_USING_MODBUS is not set +# CONFIG_RT_USING_NETUTILS is not set + +# +# RT-Thread UI Engine +# +# CONFIG_RT_USING_GUIENGINE is not set + +# +# RT-Thread online packages +# + +# +# system packages +# +# CONFIG_PKG_USING_PARTITION is not set +# CONFIG_PKG_USING_SQLITE is not set + +# +# IoT - internet of things +# +# CONFIG_PKG_USING_PAHOMQTT is not set +# CONFIG_PKG_USING_WEBCLIENT is not set +# CONFIG_PKG_USING_MONGOOSE is not set +# CONFIG_PKG_USING_WEBTERMINAL is not set +# CONFIG_PKG_USING_CJSON is not set +# CONFIG_PKG_USING_EZXML is not set + +# +# Marvell WiFi +# +# CONFIG_PKG_USING_MARVELLWIFI is not set + +# +# security packages +# +# CONFIG_PKG_USING_MBEDTLS is not set + +# +# language packages +# +# CONFIG_PKG_USING_JERRYSCRIPT is not set + +# +# multimedia packages +# + +# +# tools packages +# +# CONFIG_PKG_USING_CMBACKTRACE is not set +# CONFIG_PKG_USING_EASYLOGGER is not set + +# +# miscellaneous packages +# +# CONFIG_PKG_USING_HELLO is not set + +# +# BSP_SPECIAL CONFIG +# +CONFIG_RT_USING_UART0=y diff --git a/bsp/tm4c129x/KConfig b/bsp/tm4c129x/KConfig new file mode 100644 index 0000000000..fad849785c --- /dev/null +++ b/bsp/tm4c129x/KConfig @@ -0,0 +1,32 @@ +mainmenu "RT-Thread Configuration" + +config $BSP_DIR + string + option env="BSP_ROOT" + default "." + +config $RTT_DIR + string + option env="RTT_ROOT" + default "../.." + +config $PKGS_DIR + string + option env="PKGS_ROOT" + default "packages" + +source "$RTT_DIR/KConfig" +source "$PKGS_DIR/KConfig" + +menu "BSP_SPECIAL CONFIG" + +config RT_USING_UART0 + bool "Using RT_USING_UART0" + default y + +endmenu + + + + + \ No newline at end of file diff --git a/bsp/tm4c129x/applications/application.c b/bsp/tm4c129x/applications/application.c index 26c6460750..671511c36d 100644 --- a/bsp/tm4c129x/applications/application.c +++ b/bsp/tm4c129x/applications/application.c @@ -14,21 +14,8 @@ #include -/* thread phase init */ -void rt_init_thread_entry(void *parameter) +int main(void) { - /* Initialization RT-Thread Components */ - rt_components_init(); -} - -int rt_application_init(void) -{ - rt_thread_t tid; - tid = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - 2048, RT_THREAD_PRIORITY_MAX / 3, 20); - if (tid != RT_NULL) rt_thread_startup(tid); - - return 0; + /* user app entry */ } diff --git a/bsp/tm4c129x/applications/board.h b/bsp/tm4c129x/applications/board.h index 31682d762c..8c1b614172 100644 --- a/bsp/tm4c129x/applications/board.h +++ b/bsp/tm4c129x/applications/board.h @@ -23,16 +23,6 @@ #include extern uint32_t SysClock; -// - -// -#define RT_USING_UART0 -// -//#define RT_USING_UART1 -// -//#define RT_USING_UART2 - -// #ifdef __CC_ARM extern int Image$$RW_IRAM$$ZI$$Limit; diff --git a/bsp/tm4c129x/applications/startup.c b/bsp/tm4c129x/applications/startup.c deleted file mode 100644 index 97cc165490..0000000000 --- a/bsp/tm4c129x/applications/startup.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * File : startup.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2009-01-05 Bernard first implementation - * 2010-03-04 Magicoe for LPC17xx - * 2014-07-18 ArdaFu Port to TM4C129X - */ - -#include -#include - -#include "board.h" - -extern int rt_application_init(void); - -/** - * This function will startup RT-Thread RTOS. - */ -void rtthread_startup(void) -{ - /* initialize board */ - rt_hw_board_init(); - - /* show version */ - rt_show_version(); - -#ifdef RT_USING_HEAP - rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); -#endif - - /* initialize scheduler system */ - rt_system_scheduler_init(); - /* initialize system timer*/ - rt_system_timer_init(); - /* initialize application */ - rt_application_init(); - - /* initialize timer thread */ - rt_system_timer_thread_init(); - - /* initialize idle thread */ - rt_thread_idle_init(); - - /* start scheduler */ - rt_system_scheduler_start(); - - /* never reach here */ - return ; -} - -int main(void) -{ - /* disable interrupt first */ - rt_hw_interrupt_disable(); - - /* startup RT-Thread RTOS */ - rtthread_startup(); - - return 0; -} diff --git a/bsp/tm4c129x/rtconfig.h b/bsp/tm4c129x/rtconfig.h index c0c7ffced1..4e197eea80 100644 --- a/bsp/tm4c129x/rtconfig.h +++ b/bsp/tm4c129x/rtconfig.h @@ -1,221 +1,194 @@ -/* RT-Thread config file */ -#ifndef __RTTHREAD_CFG_H__ -#define __RTTHREAD_CFG_H__ +#ifndef RT_CONFIG_H__ +#define RT_CONFIG_H__ -// +/* Automatically generated file; DO NOT EDIT. */ +/* RT-Thread Configuration */ + +/* RT-Thread Kernel */ -// #define RT_NAME_MAX 8 -// -#define RT_ALIGN_SIZE 4 -// -// 8 -// 32 -// 256 -// -#define RT_THREAD_PRIORITY_MAX 32 -// -#define RT_TICK_PER_SECOND 100 -// -#define IDLE_THREAD_STACK_SIZE 512 -// -//#define RT_USING_MODULE -//
+#define RT_ALIGN_SIZE 4 +#define RT_THREAD_PRIORITY_MAX 32 +#define RT_TICK_PER_SECOND 100 #define RT_DEBUG -// -#define RT_DEBUG_INIT 0 -// -// #define RT_THREAD_DEBUG -// #define RT_USING_OVERFLOW_CHECK -//
- -// +#define RT_DEBUG_INIT 0 +/* RT_DEBUG_THREAD is not set */ #define RT_USING_HOOK -//
+#define IDLE_THREAD_STACK_SIZE 256 #define RT_USING_TIMER_SOFT -// -#define RT_TIMER_THREAD_PRIO 4 -// -#define RT_TIMER_THREAD_STACK_SIZE 512 -// -#define RT_TIMER_TICK_PER_SECOND 100 -//
+#define RT_TIMER_THREAD_PRIO 4 +#define RT_TIMER_THREAD_STACK_SIZE 512 + +/* Inter-Thread communication */ -//
-// #define RT_USING_SEMAPHORE -// #define RT_USING_MUTEX -// #define RT_USING_EVENT -// #define RT_USING_MAILBOX -// #define RT_USING_MESSAGEQUEUE -//
+/* RT_USING_SIGNALS is not set */ + +/* Memory Management */ -//
-// #define RT_USING_MEMPOOL -// #define RT_USING_MEMHEAP -// #define RT_USING_HEAP -// #define RT_USING_SMALL_MEM -// -// #define RT_USING_SLAB -//
+/* RT_USING_SLAB is not set */ + +/* Kernel Device Object */ -//
#define RT_USING_DEVICE -// -#define RT_USING_DEVICE_IPC -// -#define RT_USING_SERIAL -// -#define RT_UART_RX_BUFFER_SIZE 256 -// -//#define RT_USING_MTD_NAND -// -//#define RT_MTD_NAND_DEBUG -// -//#define RT_USING_NFTL -// -//#define RT_USING_SPI -// -//#define RT_USING_I2C -// -//#define RT_USING_RTC -// -#define RT_MMCSD_THREAD_PREORITY 15 -//
#define RT_USING_CONSOLE -// -#define RT_CONSOLEBUF_SIZE 128 -// -#define RT_CONSOLE_DEVICE_NAME "uart0" -//
+#define RT_CONSOLEBUF_SIZE 128 +#define RT_CONSOLE_DEVICE_NAME "uart0" +/* RT_USING_MODULE is not set */ + +/* RT-Thread Components */ -// #define RT_USING_COMPONENTS_INIT -//
+#define RT_USING_USER_MAIN + +/* C++ features */ + +/* RT_USING_CPLUSPLUS is not set */ + +/* Command shell */ + #define RT_USING_FINSH -// +#define FINSH_USING_HISTORY #define FINSH_USING_SYMTAB -// #define FINSH_USING_DESCRIPTION -// +#define FINSH_THREAD_PRIORITY 20 #define FINSH_THREAD_STACK_SIZE 4096 -// -//#define FINSH_USING_MSH -//
+#define FINSH_CMD_SIZE 80 +/* FINSH_USING_AUTH is not set */ +/* FINSH_USING_MSH is not set */ -//
-// -// #define RT_USING_NEWLIB -// -//#define RT_USING_PTHREADS -//
+/* Device virtual file system */ -//
-//#define RT_USING_DFS -// -//#define DFS_USING_WORKDIR -// -#define DFS_FILESYSTEM_TYPES_MAX 4 -// -#define DFS_FILESYSTEMS_MAX 4 -// -#define DFS_FD_MAX 16 -// -#define RT_USING_DFS_ELMFAT -// -#define RT_DFS_ELM_DRIVES 4 -// -#define RT_DFS_ELM_REENTRANT -// -// 1 -// 2 -// 3 -// -#define RT_DFS_ELM_USE_LFN 3 -// -#define RT_DFS_ELM_CODE_PAGE 936 -// -#define RT_DFS_ELM_CODE_PAGE_FILE -// -#define RT_DFS_ELM_MAX_LFN 255 -// -#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096 -// -#define RT_DFS_ELM_USE_ERASE -// -// #define RT_USING_DFS_YAFFS2 -// -// #define RT_USING_DFS_UFFS -// -#define RT_USING_DFS_DEVFS -// -//#define RT_USING_DFS_ROMFS -// -//#define RT_USING_DFS_NFS -// -#define RT_NFS_HOST_EXPORT "192.168.1.20:/" -//
+/* RT_USING_DFS is not set */ + +/* Device Drivers */ + +#define RT_USING_DEVICE_IPC +#define RT_USING_SERIAL +/* RT_USING_CAN is not set */ +/* RT_USING_HWTIMER is not set */ +/* RT_USING_I2C is not set */ +/* RT_USING_PIN is not set */ +/* RT_USING_MTD_NOR is not set */ +/* RT_USING_MTD_NAND is not set */ +/* RT_USING_RTC is not set */ +/* RT_USING_SDIO is not set */ +/* RT_USING_SPI is not set */ +/* RT_USING_WDT is not set */ +/* RT_USING_USB_HOST is not set */ +/* RT_USING_USB_DEVICE is not set */ + +/* POSIX layer and C standard library */ + +/* RT_USING_LIBC is not set */ +/* RT_USING_PTHREADS is not set */ + +/* Network stack */ + +/* light weight TCP/IP stack */ -//
#define RT_USING_LWIP -// #define RT_USING_LWIP141 -// +/* RT_USING_LWIP202 is not set */ +/* RT_LWIP_IGMP is not set */ #define RT_LWIP_ICMP -// -// #define RT_LWIP_IGMP -// -#define RT_LWIP_UDP -// -#define RT_LWIP_TCP -// +/* RT_LWIP_SNMP is not set */ #define RT_LWIP_DNS -// -#define RT_LWIP_PBUF_NUM 8 -// -#define RT_LWIP_TCP_PCB_NUM 5 -// -#define RT_LWIP_TCP_SND_BUF 8192 -// -#define RT_LWIP_TCP_WND 8192 -// -// #define RT_LWIP_SNMP -// - #define RT_LWIP_DHCP -// -#define RT_LWIP_TCP_SEG_NUM 24 -// -#define RT_LWIP_TCPTHREAD_PRIORITY 12 -// -#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8 -// -#define RT_LWIP_TCPTHREAD_STACKSIZE 4096 -// -#define RT_LWIP_ETHTHREAD_PRIORITY 14 -// -#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8 -// -#define RT_LWIP_ETHTHREAD_STACKSIZE 512 -// +#define RT_LWIP_DHCP +#define IP_SOF_BROADCAST 1 +#define IP_SOF_BROADCAST_RECV 1 +/* LWIP_USING_DHCPD is not set */ + +/* Static IPv4 Address */ + #define RT_LWIP_IPADDR "192.168.1.30" -// -#define RT_LWIP_GWADDR "192.168.1.1" -// -#define RT_LWIP_MSKADDR "255.255.255.0" -//
+#define RT_LWIP_GWADDR "192.168.1.1" +#define RT_LWIP_MSKADDR "255.255.255.0" +#define RT_LWIP_UDP +#define RT_LWIP_TCP +/* RT_LWIP_RAW is not set */ +/* RT_LWIP_PPP is not set */ +/* RT_LWIP_PPPOE is not set */ +/* RT_LWIP_PPPOS is not set */ +#define RT_LWIP_PBUF_NUM 16 +#define RT_LWIP_RAW_PCB_NUM 4 +#define RT_LWIP_UDP_PCB_NUM 4 +#define RT_LWIP_TCP_PCB_NUM 4 +#define RT_LWIP_TCP_SEG_NUM 40 +#define RT_LWIP_TCP_SND_BUF 8196 +#define RT_LWIP_TCP_WND 8196 +#define RT_LWIP_TCPTHREAD_PRIORITY 10 +#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8 +#define RT_LWIP_TCPTHREAD_STACKSIZE 1024 +#define RT_LWIP_ETHTHREAD_PRIORITY 12 +#define RT_LWIP_ETHTHREAD_STACKSIZE 1024 +#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8 +/* RT_LWIP_REASSEMBLY_FRAG is not set */ +#define LWIP_NETIF_STATUS_CALLBACK 1 +#define SO_REUSE 1 +#define LWIP_SO_RCVTIMEO 1 +#define LWIP_SO_SNDTIMEO 1 +#define LWIP_SO_RCVBUF 1 +/* Modbus master and slave stack */ +/* RT_USING_MODBUS is not set */ +/* RT_USING_NETUTILS is not set */ -// +/* RT-Thread UI Engine */ +/* RT_USING_GUIENGINE is not set */ + +/* RT-Thread online packages */ + +/* system packages */ + +/* PKG_USING_PARTITION is not set */ +/* PKG_USING_SQLITE is not set */ + +/* IoT - internet of things */ + +/* PKG_USING_PAHOMQTT is not set */ +/* PKG_USING_WEBCLIENT is not set */ +/* PKG_USING_MONGOOSE is not set */ +/* PKG_USING_WEBTERMINAL is not set */ +/* PKG_USING_CJSON is not set */ +/* PKG_USING_EZXML is not set */ + +/* Marvell WiFi */ + +/* PKG_USING_MARVELLWIFI is not set */ + +/* security packages */ + +/* PKG_USING_MBEDTLS is not set */ + +/* language packages */ + +/* PKG_USING_JERRYSCRIPT is not set */ + +/* multimedia packages */ + +/* tools packages */ + +/* PKG_USING_CMBACKTRACE is not set */ +/* PKG_USING_EASYLOGGER is not set */ + +/* miscellaneous packages */ + +/* PKG_USING_HELLO is not set */ + +/* BSP_SPECIAL CONFIG */ + +#define RT_USING_UART0 #endif