summaryrefslogtreecommitdiff
path: root/bsp/lpc176x
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-04-15 07:03:10 +0000
committer[email protected] <[email protected]>2012-04-15 07:03:10 +0000
commit4d0338fd263eac3c94320fd21fee6f30723f9d6e (patch)
tree3ee98967b3e04528648c7a39cd901c7101f3be0d /bsp/lpc176x
parent19645fd35078c94fe04a9017a1ad1dd40e21a372 (diff)
Using Components Init to initialize all of components.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2060 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/lpc176x')
-rw-r--r--bsp/lpc176x/applications/application.c59
-rw-r--r--bsp/lpc176x/applications/startup.c33
-rw-r--r--bsp/lpc176x/drivers/board.c4
-rw-r--r--bsp/lpc176x/rtconfig.h16
4 files changed, 31 insertions, 81 deletions
diff --git a/bsp/lpc176x/applications/application.c b/bsp/lpc176x/applications/application.c
index 456c08e93f..d9ffd1cc25 100644
--- a/bsp/lpc176x/applications/application.c
+++ b/bsp/lpc176x/applications/application.c
@@ -16,59 +16,24 @@
*/
#include <rtthread.h>
-
-#ifdef RT_USING_DFS
-/* dfs init */
-#include <dfs_init.h>
-/* dfs filesystem:ELM FatFs filesystem init */
-#include <dfs_elm.h>
-/* dfs Filesystem APIs */
-#include <dfs_fs.h>
-#endif
-
-#ifdef RT_USING_LWIP
-#include <lwip/sys.h>
-#include <lwip/api.h>
-#include <netif/ethernetif.h>
-#endif
+#include <components_init.h>
/* thread phase init */
void rt_init_thread_entry(void *parameter)
{
- /* Filesystem Initialization */
-#ifdef RT_USING_DFS
- {
- /* init the device filesystem */
- dfs_init();
+ /* register Ethernet interface device */
+ lpc17xx_emac_hw_init();
- /* init the elm FAT filesystam*/
- elm_init();
+ /* initialization RT-Thread Components */
+ rt_components_init();
- /* mount sd card fat partition 1 as root directory */
- if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
- rt_kprintf("File System initialized!\n");
- else
- rt_kprintf("File System init failed!\n");
- }
-#endif
-
- /* LwIP Initialization */
-#ifdef RT_USING_LWIP
- {
- extern void lwip_sys_init(void);
- extern void lpc17xx_emac_hw_init(void);
-
- eth_system_device_init();
-
- /* register Ethernet interface device */
- lpc17xx_emac_hw_init();
- /* init all device */
- rt_device_init_all();
-
- /* init lwip system */
- lwip_sys_init();
- rt_kprintf("TCP/IP initialized!\n");
- }
+ /* Filesystem Initialization */
+#ifdef RT_USING_DFS
+ /* mount sd card fat partition 1 as root directory */
+ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
+ rt_kprintf("File System initialized!\n");
+ else
+ rt_kprintf("File System init failed!\n");
#endif
}
diff --git a/bsp/lpc176x/applications/startup.c b/bsp/lpc176x/applications/startup.c
index 86aec23495..f71b3ff55e 100644
--- a/bsp/lpc176x/applications/startup.c
+++ b/bsp/lpc176x/applications/startup.c
@@ -30,10 +30,6 @@
/*@{*/
extern int rt_application_init(void);
-#ifdef RT_USING_FINSH
-extern void finsh_system_init(void);
-extern void finsh_set_device(const char* device);
-#endif
#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
@@ -68,56 +64,41 @@ void assert_failed(u8* file, u32 line)
*/
void rtthread_startup(void)
{
- /* init board */
+ /* initialize board */
rt_hw_board_init();
/* show version */
rt_show_version();
- /* init tick */
- rt_system_tick_init();
-
- /* init kernel object */
- rt_system_object_init();
-
- /* init timer system */
- rt_system_timer_init();
-
#ifdef RT_USING_HEAP
+ /* initialize memory system */
#ifdef __CC_ARM
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x10008000);
#elif __ICCARM__
rt_system_heap_init(__segment_end("HEAP"), (void*)0x10008000);
#else
- /* init memory system */
rt_system_heap_init((void*)&__bss_end, (void*)0x10008000);
#endif
#endif
- /* init scheduler system */
+ /* initialize scheduler system */
rt_system_scheduler_init();
#ifdef RT_USING_DEVICE
#ifdef RT_USING_DFS
rt_hw_sdcard_init();
#endif
- /* init all device */
+ /* initialize all device */
rt_device_init_all();
#endif
- /* init application */
+ /* initialize application */
rt_application_init();
-#ifdef RT_USING_FINSH
- /* init finsh */
- finsh_system_init();
- finsh_set_device("uart0");
-#endif
-
- /* init timer thread */
+ /* initialize timer thread */
rt_system_timer_thread_init();
- /* init idle thread */
+ /* initialize idle thread */
rt_thread_idle_init();
/* start scheduler */
diff --git a/bsp/lpc176x/drivers/board.c b/bsp/lpc176x/drivers/board.c
index 24bc828ada..3f34e3032e 100644
--- a/bsp/lpc176x/drivers/board.c
+++ b/bsp/lpc176x/drivers/board.c
@@ -62,14 +62,14 @@ void rt_hw_board_init()
SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK);
#endif
- /* init systick */
+ /* initialize systick */
SysTick_Config( SystemCoreClock/RT_TICK_PER_SECOND);
/* set pend exception priority */
NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
#ifdef RT_USING_UART0
rt_hw_uart_init();
- rt_console_set_device("uart0");
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
}
diff --git a/bsp/lpc176x/rtconfig.h b/bsp/lpc176x/rtconfig.h
index bdcde8fbbe..e13570f144 100644
--- a/bsp/lpc176x/rtconfig.h
+++ b/bsp/lpc176x/rtconfig.h
@@ -71,8 +71,12 @@
#define RT_USING_CONSOLE
// <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" />
#define RT_CONSOLEBUF_SIZE 128
+// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart" />
+#define RT_CONSOLE_DEVICE_NAME "uart0"
// </section>
+// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
+#define RT_USING_COMPONENTS_INIT
// <section name="RT_USING_FINSH" description="Using finsh as shell, which is a C-Express shell" default="true" >
#define RT_USING_FINSH
// <bool name="FINSH_USING_SYMTAB" description="Using symbol table in finsh shell" default="true" />
@@ -120,7 +124,7 @@
// </section>
// <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
-// #define RT_USING_LWIP
+#define RT_USING_LWIP
// <bool name="RT_LWIP_USING_RT_MEM" description="Using RT-Thread memory management for LwIP" default="true" />
#define RT_LWIP_USING_RT_MEM
// <bool name="RT_LWIP_ICMP" description="Enable ICMP protocol" default="true" />
@@ -136,25 +140,25 @@
// <integer name="RT_LWIP_TCP_PCB_NUM" description="Maximal number of simultaneously active TCP connections" default="5" />
#define RT_LWIP_TCP_PCB_NUM 5
// <integer name="RT_LWIP_TCP_SND_BUF" description="TCP sender buffer size" default="8192" />
-#define RT_LWIP_TCP_SND_BUF 8192
+#define RT_LWIP_TCP_SND_BUF 2048
// <integer name="RT_LWIP_TCP_WND" description="TCP receive window" default="8192" />
-#define RT_LWIP_TCP_WND 8192
+#define RT_LWIP_TCP_WND 2048
// <bool name="RT_LWIP_SNMP" description="Enable SNMP protocol" default="false" />
// #define RT_LWIP_SNMP
// <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" />
// #define RT_LWIP_DHCP
// <integer name="RT_LWIP_TCP_SEG_NUM" description="the number of simultaneously queued TCP" default="8" />
-#define RT_LWIP_TCP_SEG_NUM 40
+#define RT_LWIP_TCP_SEG_NUM 8
// <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" />
#define RT_LWIP_TCPTHREAD_PRIORITY 12
// <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" />
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 32
+#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
// <integer name="RT_LWIP_TCPTHREAD_STACKSIZE" description="the thread stack size of TCP thread" default="4096" />
#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
// <integer name="RT_LWIP_ETHTHREAD_PRIORITY" description="the thread priority of ethnetif thread" default="144" />
#define RT_LWIP_ETHTHREAD_PRIORITY 14
// <integer name="RT_LWIP_ETHTHREAD_MBOX_SIZE" description="the mail box size of ethnetif thread to wait for" default="8" />
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32
+#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
// <integer name="RT_LWIP_ETHTHREAD_STACKSIZE" description="the stack size of ethnetif thread" default="512" />
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
// <ipaddr name="RT_LWIP_IPADDR" description="IP address of device" default="192.168.1.30" />