From 21b9e64cd6c37aef3475b3403b69c0b2cb61a9d5 Mon Sep 17 00:00:00 2001 From: bernard Date: Sat, 19 Jul 2014 06:51:43 +0800 Subject: [PATCH] [BSP] remove COMPONENTS_INIT for lpc176x and stm32f107 porting. --- bsp/lpc176x/applications/application.c | 38 +++++++++--- bsp/lpc176x/rtconfig.h | 2 +- bsp/stm32f107/applications/application.c | 78 ++++++++++++++---------- bsp/stm32f107/rtconfig.h | 4 +- 4 files changed, 80 insertions(+), 42 deletions(-) diff --git a/bsp/lpc176x/applications/application.c b/bsp/lpc176x/applications/application.c index 3ea7c2903..1fda158cb 100644 --- a/bsp/lpc176x/applications/application.c +++ b/bsp/lpc176x/applications/application.c @@ -19,14 +19,20 @@ #include #include "platform.h" -#ifdef RT_USING_COMPONENTS_INIT -#include -#endif #ifdef RT_USING_LWIP #include +#include +extern int lwip_system_init(void); #endif + #ifdef RT_USING_DFS #include +#include +#endif + +#ifdef RT_USING_FINSH +#include +#include #endif /* thread phase init */ @@ -38,21 +44,39 @@ void rt_init_thread_entry(void *parameter) #ifdef RT_USING_LWIP /* register Ethernet interface device */ lpc17xx_emac_hw_init(); -#endif -#ifdef RT_USING_COMPONENTS_INIT - /* initialization RT-Thread Components */ - rt_components_init(); + /* initialize lwip stack */ + /* register ethernetif device */ + eth_system_device_init(); + + /* initialize lwip system */ + lwip_system_init(); + rt_kprintf("TCP/IP initialized!\n"); #endif /* Filesystem Initialization */ #ifdef RT_USING_DFS + rt_hw_sdcard_init(); + + /* initialize the device file system */ + dfs_init(); + +#ifdef RT_USING_DFS_ELMFAT + /* initialize the elm chan FatFS file system*/ + elm_init(); +#endif + /* 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 + +#ifdef RT_USING_FINSH + /* initialize finsh */ + finsh_system_init(); +#endif } int rt_application_init() diff --git a/bsp/lpc176x/rtconfig.h b/bsp/lpc176x/rtconfig.h index 8aefe475d..07553e247 100644 --- a/bsp/lpc176x/rtconfig.h +++ b/bsp/lpc176x/rtconfig.h @@ -78,7 +78,7 @@ // // -#define RT_USING_COMPONENTS_INIT +// #define RT_USING_COMPONENTS_INIT //
#define RT_USING_FINSH // diff --git a/bsp/stm32f107/applications/application.c b/bsp/stm32f107/applications/application.c index 025451d32..ef2864100 100644 --- a/bsp/stm32f107/applications/application.c +++ b/bsp/stm32f107/applications/application.c @@ -22,11 +22,20 @@ #ifdef RT_USING_DFS #include +#include +#include #endif -#ifdef RT_USING_COMPONENTS_INIT -#include -#endif /* RT_USING_COMPONENTS_INIT */ +#ifdef RT_USING_LWIP +#include +#include +extern int lwip_system_init(void); +#endif + +#ifdef RT_USING_FINSH +#include +#include +#endif void rt_init_thread_entry(void* parameter) { @@ -35,45 +44,50 @@ void rt_init_thread_entry(void* parameter) rt_platform_init(); } -#ifdef RT_USING_COMPONENTS_INIT - /* initialization RT-Thread Components */ - rt_components_init(); -#endif - /* Filesystem Initialization */ #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT) + /* initialize the device file system */ + dfs_init(); + + /* initialize the elm chan FatFS file system*/ + elm_init(); + + /* mount sd card fat partition 1 as root directory */ + if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { - /* 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 initialzation failed!\n"); - } + rt_kprintf("File System initialized!\n"); + } + else + { + rt_kprintf("File System initialzation failed!\n"); } #endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */ + +#ifdef RT_USING_LWIP + /* initialize lwip stack */ + /* register ethernetif device */ + eth_system_device_init(); + + /* initialize lwip system */ + lwip_system_init(); + rt_kprintf("TCP/IP initialized!\n"); +#endif + +#ifdef RT_USING_FINSH + /* initialize finsh */ + finsh_system_init(); + finsh_set_device(RT_CONSOLE_DEVICE_NAME); +#endif } int rt_application_init(void) { - rt_thread_t init_thread; + rt_thread_t tid; -#if (RT_THREAD_PRIORITY_MAX == 32) - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - 2048, 8, 20); -#else - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - 2048, 80, 20); -#endif - - if (init_thread != RT_NULL) - { - rt_thread_startup(init_thread); - } + 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; } diff --git a/bsp/stm32f107/rtconfig.h b/bsp/stm32f107/rtconfig.h index 7450367db..7f308c103 100644 --- a/bsp/stm32f107/rtconfig.h +++ b/bsp/stm32f107/rtconfig.h @@ -69,8 +69,8 @@ #define RT_CONSOLE_DEVICE_NAME "uart1" //
-//
-#define RT_USING_COMPONENTS_INIT +//
+// #define RT_USING_COMPONENTS_INIT //
/* SECTION: finsh, a C-Express shell */