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 - -#ifdef RT_USING_DFS -/* dfs init */ -#include -/* dfs filesystem:ELM FatFs filesystem init */ -#include -/* dfs Filesystem APIs */ -#include -#endif - -#ifdef RT_USING_LWIP -#include -#include -#include -#endif +#include /* thread phase init */ void rt_init_thread_entry(void *parameter) { + /* register Ethernet interface device */ + lpc17xx_emac_hw_init(); + + /* initialization RT-Thread Components */ + rt_components_init(); + /* Filesystem Initialization */ #ifdef RT_USING_DFS - { - /* init the device filesystem */ - dfs_init(); - - /* init the elm FAT filesystam*/ - elm_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"); - } + /* 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 // #define RT_CONSOLEBUF_SIZE 128 +// +#define RT_CONSOLE_DEVICE_NAME "uart0" // +// +#define RT_USING_COMPONENTS_INIT //
#define RT_USING_FINSH // @@ -120,7 +124,7 @@ //
//
-// #define RT_USING_LWIP +#define RT_USING_LWIP // #define RT_LWIP_USING_RT_MEM // @@ -136,25 +140,25 @@ // #define RT_LWIP_TCP_PCB_NUM 5 // -#define RT_LWIP_TCP_SND_BUF 8192 +#define RT_LWIP_TCP_SND_BUF 2048 // -#define RT_LWIP_TCP_WND 8192 +#define RT_LWIP_TCP_WND 2048 // // #define RT_LWIP_SNMP // // #define RT_LWIP_DHCP // -#define RT_LWIP_TCP_SEG_NUM 40 +#define RT_LWIP_TCP_SEG_NUM 8 // #define RT_LWIP_TCPTHREAD_PRIORITY 12 // -#define RT_LWIP_TCPTHREAD_MBOX_SIZE 32 +#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 32 +#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8 // #define RT_LWIP_ETHTHREAD_STACKSIZE 512 //