diff options
| author | Bernard Xiong <[email protected]> | 2017-12-08 11:57:22 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2017-12-08 11:57:22 +0800 |
| commit | f74cde045ba4ba70cdefb4408496d51203209192 (patch) | |
| tree | f5837d9052c4190e211c2e48094016e9771884f0 /bsp/lpc2148 | |
| parent | 37c6eac27bbf8eb780b38419c761e95bf33424c2 (diff) | |
[BSP] fix the finsh_system_init issue in BSP
Diffstat (limited to 'bsp/lpc2148')
| -rw-r--r-- | bsp/lpc2148/applications/application.c | 54 | ||||
| -rw-r--r-- | bsp/lpc2148/applications/startup.c | 35 |
2 files changed, 42 insertions, 47 deletions
diff --git a/bsp/lpc2148/applications/application.c b/bsp/lpc2148/applications/application.c index f1c8d33065..5ceb371837 100644 --- a/bsp/lpc2148/applications/application.c +++ b/bsp/lpc2148/applications/application.c @@ -19,6 +19,11 @@ */ /*@{*/ +#ifdef RT_USING_FINSH +#include <shell.h> +#include <finsh.h> +#endif + #ifdef RT_USING_DFS /* dfs init */ #include <dfs.h> @@ -41,16 +46,31 @@ /* thread phase init */ void rt_init_thread_entry(void *parameter) { +#ifdef RT_USING_DEVICE +#ifdef RT_USING_DFS + /* init sd card */ + rt_hw_sdcard_init(); +#endif + +#ifdef RT_USING_LWIP + eth_system_device_init(); + /* init ethernetif device */ + rt_hw_dm9000_init(); +#endif + + /* init hardware serial device */ + rt_hw_serial_init(); +#endif + /* Filesystem Initialization */ #ifdef RT_USING_DFS { /* init the device filesystem */ dfs_init(); - /* init the efsl filesystam*/ - efsl_init(); + elm_init(); /* mount sd card fat partition 1 as root directory */ - if (dfs_mount("sd0", "/", "efs", 0, 0) == 0) + if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) rt_kprintf("File System initialized!\n"); else rt_kprintf("File System init failed!\n"); @@ -67,6 +87,10 @@ void rt_init_thread_entry(void *parameter) rt_kprintf("TCP/IP initialized!\n"); } #endif + +#ifdef RT_USING_FINSH + finsh_system_init(); +#endif } /************** LED BLINK *******************/ @@ -78,53 +102,53 @@ void rt_init_thread_entry(void *parameter) ALIGN(4) char thread_led1_stack[512]; struct rt_thread thread_led1; -void thread_led1_entry(void* parameter) +void thread_led1_entry(void *parameter) { - unsigned int count=0; + unsigned int count = 0; IO1DIR |= LED1; - while(1) + while (1) { /* led1 on */ IO1CLR = LED1; #ifndef RT_USING_FINSH - rt_kprintf("led1 on, count : %d\r\n",count); + rt_kprintf("led1 on, count : %d\r\n", count); #endif count++; - rt_thread_delay( RT_TICK_PER_SECOND/3 ); /* delay 0.3s */ + rt_thread_delay(RT_TICK_PER_SECOND / 3); /* delay 0.3s */ /* led1 off */ IO1SET = LED1; #ifndef RT_USING_FINSH rt_kprintf("led1 off\r\n"); #endif - rt_thread_delay( RT_TICK_PER_SECOND/3 ); + rt_thread_delay(RT_TICK_PER_SECOND / 3); } } ALIGN(4) char thread_led2_stack[512]; struct rt_thread thread_led2; -void thread_led2_entry(void* parameter) +void thread_led2_entry(void *parameter) { - unsigned int count=0; + unsigned int count = 0; IO1DIR |= LED2; - while(1) + while (1) { /* led2 on */ IO1CLR = LED2; #ifndef RT_USING_FINSH - rt_kprintf("led2 on, count : %d\r\n",count); + rt_kprintf("led2 on, count : %d\r\n", count); #endif count++; - rt_thread_delay( RT_TICK_PER_SECOND/2 ); /* delay 0.5s */ + rt_thread_delay(RT_TICK_PER_SECOND / 2); /* delay 0.5s */ /* led2 off */ IO1SET = LED2; #ifndef RT_USING_FINSH rt_kprintf("led1 off\r\n"); #endif - rt_thread_delay( RT_TICK_PER_SECOND/2 ); + rt_thread_delay(RT_TICK_PER_SECOND / 2); } } /************** LED BLINK *******************/ diff --git a/bsp/lpc2148/applications/startup.c b/bsp/lpc2148/applications/startup.c index e9a7967819..4a2db19c95 100644 --- a/bsp/lpc2148/applications/startup.c +++ b/bsp/lpc2148/applications/startup.c @@ -33,18 +33,11 @@ /*@{*/ -#ifdef RT_USING_FINSH -extern int finsh_system_init(void); -#endif - extern int rt_application_init(void); extern void rt_show_version(void); #ifdef RT_USING_DEVICE extern rt_err_t rt_hw_serial_init(void); #endif -#ifdef RT_USING_FINSH -extern int finsh_system_init(void); -#endif #ifdef __CC_ARM extern int Image$$RW_IRAM1$$ZI$$Limit; @@ -76,41 +69,19 @@ void rtthread_startup(void) #ifdef RT_USING_HEAP #ifdef __CC_ARM - rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x40008000); + rt_system_heap_init((void *)&Image$$RW_IRAM1$$ZI$$Limit, (void *)0x40008000); #else /* init memory system */ - rt_system_heap_init((void*)&__bss_end, (void*)0x40008000); + rt_system_heap_init((void *)&__bss_end, (void *)0x40008000); #endif #endif /* init scheduler system */ rt_system_scheduler_init(); -#ifdef RT_USING_DEVICE -#ifdef RT_USING_DFS - /* init sd card */ - rt_hw_sdcard_init(); -#endif - -#ifdef RT_USING_LWIP - eth_system_device_init(); - /* init ethernetif device */ - rt_hw_dm9000_init(); -#endif - - /* init hardware serial device */ - rt_hw_serial_init(); -#endif - /* init application */ rt_application_init(); -#ifdef RT_USING_FINSH - /* init finsh */ - finsh_system_init(); - finsh_set_device("uart1"); -#endif - /* init idle thread */ rt_thread_idle_init(); @@ -121,7 +92,7 @@ void rtthread_startup(void) return ; } -int main (void) +int main(void) { /* invoke rtthread_startup */ rtthread_startup(); |
