提交 f74cde04 编写于 作者: B Bernard Xiong

[BSP] fix the finsh_system_init issue in BSP

上级 37c6eac2
...@@ -35,6 +35,11 @@ ...@@ -35,6 +35,11 @@
#include <rtgui/driver.h> #include <rtgui/driver.h>
#endif #endif
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
/* thread phase init */ /* thread phase init */
void rt_init_thread_entry(void *parameter) void rt_init_thread_entry(void *parameter)
{ {
...@@ -97,6 +102,11 @@ void rt_init_thread_entry(void *parameter) ...@@ -97,6 +102,11 @@ void rt_init_thread_entry(void *parameter)
} }
} }
#endif #endif
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init();
#endif
} }
// init led // init led
......
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
#include "board.h" #include "board.h"
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
...@@ -81,12 +77,6 @@ void rtthread_startup(void) ...@@ -81,12 +77,6 @@ void rtthread_startup(void)
/* initialize application */ /* initialize application */
rt_application_init(); rt_application_init();
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init();
finsh_set_device( FINSH_DEVICE_NAME );
#endif
/* initialize timer */ /* initialize timer */
rt_system_timer_init(); rt_system_timer_init();
......
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
*/ */
/*@{*/ /*@{*/
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
/* dfs init */ /* dfs init */
#include <dfs.h> #include <dfs.h>
...@@ -41,16 +46,31 @@ ...@@ -41,16 +46,31 @@
/* thread phase init */ /* thread phase init */
void rt_init_thread_entry(void *parameter) 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 */ /* Filesystem Initialization */
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
{ {
/* init the device filesystem */ /* init the device filesystem */
dfs_init(); dfs_init();
/* init the efsl filesystam*/ elm_init();
efsl_init();
/* mount sd card fat partition 1 as root directory */ /* 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"); rt_kprintf("File System initialized!\n");
else else
rt_kprintf("File System init failed!\n"); rt_kprintf("File System init failed!\n");
...@@ -67,6 +87,10 @@ void rt_init_thread_entry(void *parameter) ...@@ -67,6 +87,10 @@ void rt_init_thread_entry(void *parameter)
rt_kprintf("TCP/IP initialized!\n"); rt_kprintf("TCP/IP initialized!\n");
} }
#endif #endif
#ifdef RT_USING_FINSH
finsh_system_init();
#endif
} }
/************** LED BLINK *******************/ /************** LED BLINK *******************/
...@@ -78,53 +102,53 @@ void rt_init_thread_entry(void *parameter) ...@@ -78,53 +102,53 @@ void rt_init_thread_entry(void *parameter)
ALIGN(4) char thread_led1_stack[512]; ALIGN(4) char thread_led1_stack[512];
struct rt_thread thread_led1; 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; IO1DIR |= LED1;
while(1) while (1)
{ {
/* led1 on */ /* led1 on */
IO1CLR = LED1; IO1CLR = LED1;
#ifndef RT_USING_FINSH #ifndef RT_USING_FINSH
rt_kprintf("led1 on, count : %d\r\n",count); rt_kprintf("led1 on, count : %d\r\n", count);
#endif #endif
count++; 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 */ /* led1 off */
IO1SET = LED1; IO1SET = LED1;
#ifndef RT_USING_FINSH #ifndef RT_USING_FINSH
rt_kprintf("led1 off\r\n"); rt_kprintf("led1 off\r\n");
#endif #endif
rt_thread_delay( RT_TICK_PER_SECOND/3 ); rt_thread_delay(RT_TICK_PER_SECOND / 3);
} }
} }
ALIGN(4) char thread_led2_stack[512]; ALIGN(4) char thread_led2_stack[512];
struct rt_thread thread_led2; 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; IO1DIR |= LED2;
while(1) while (1)
{ {
/* led2 on */ /* led2 on */
IO1CLR = LED2; IO1CLR = LED2;
#ifndef RT_USING_FINSH #ifndef RT_USING_FINSH
rt_kprintf("led2 on, count : %d\r\n",count); rt_kprintf("led2 on, count : %d\r\n", count);
#endif #endif
count++; 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 */ /* led2 off */
IO1SET = LED2; IO1SET = LED2;
#ifndef RT_USING_FINSH #ifndef RT_USING_FINSH
rt_kprintf("led1 off\r\n"); rt_kprintf("led1 off\r\n");
#endif #endif
rt_thread_delay( RT_TICK_PER_SECOND/2 ); rt_thread_delay(RT_TICK_PER_SECOND / 2);
} }
} }
/************** LED BLINK *******************/ /************** LED BLINK *******************/
......
...@@ -33,18 +33,11 @@ ...@@ -33,18 +33,11 @@
/*@{*/ /*@{*/
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
#endif
extern int rt_application_init(void); extern int rt_application_init(void);
extern void rt_show_version(void); extern void rt_show_version(void);
#ifdef RT_USING_DEVICE #ifdef RT_USING_DEVICE
extern rt_err_t rt_hw_serial_init(void); extern rt_err_t rt_hw_serial_init(void);
#endif #endif
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
...@@ -76,41 +69,19 @@ void rtthread_startup(void) ...@@ -76,41 +69,19 @@ void rtthread_startup(void)
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
#ifdef __CC_ARM #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 #else
/* init memory system */ /* init memory system */
rt_system_heap_init((void*)&__bss_end, (void*)0x40008000); rt_system_heap_init((void *)&__bss_end, (void *)0x40008000);
#endif #endif
#endif #endif
/* init scheduler system */ /* init scheduler system */
rt_system_scheduler_init(); 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 */ /* init application */
rt_application_init(); rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device("uart1");
#endif
/* init idle thread */ /* init idle thread */
rt_thread_idle_init(); rt_thread_idle_init();
...@@ -121,7 +92,7 @@ void rtthread_startup(void) ...@@ -121,7 +92,7 @@ void rtthread_startup(void)
return ; return ;
} }
int main (void) int main(void)
{ {
/* invoke rtthread_startup */ /* invoke rtthread_startup */
rtthread_startup(); rtthread_startup();
......
...@@ -14,12 +14,22 @@ ...@@ -14,12 +14,22 @@
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
/** /**
* @addtogroup LPC2478 * @addtogroup LPC2478
*/ */
/*@{*/ /*@{*/
int rt_application_init() int rt_application_init()
{ {
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
return 0; return 0;
} }
......
...@@ -16,13 +16,7 @@ ...@@ -16,13 +16,7 @@
#include <rthw.h> #include <rthw.h>
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
extern int finsh_system_init(void);
#endif
#include <LPC24xx.h> #include <LPC24xx.h>
#include <board.h>
/** /**
* @addtogroup LPC2478 * @addtogroup LPC2478
...@@ -30,9 +24,6 @@ extern int finsh_system_init(void); ...@@ -30,9 +24,6 @@ extern int finsh_system_init(void);
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_DEVICE
extern rt_err_t rt_hw_serial_init(void);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
...@@ -65,9 +56,9 @@ void rtthread_startup(void) ...@@ -65,9 +56,9 @@ void rtthread_startup(void)
/* init memory system */ /* init memory system */
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
#ifdef __CC_ARM #ifdef __CC_ARM
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x40010000); rt_system_heap_init((void *)&Image$$RW_IRAM1$$ZI$$Limit, (void *)0x40010000);
#else #else
rt_system_heap_init((void*)&__bss_end, (void*)0x40010000); rt_system_heap_init((void *)&__bss_end, (void *)0x40010000);
#endif #endif
#endif #endif
...@@ -77,12 +68,6 @@ void rtthread_startup(void) ...@@ -77,12 +68,6 @@ void rtthread_startup(void)
/* init application */ /* init application */
rt_application_init(); rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device("uart1");
#endif
/* init soft timer thread */ /* init soft timer thread */
rt_system_timer_thread_init(); rt_system_timer_thread_init();
......
...@@ -18,16 +18,16 @@ ...@@ -18,16 +18,16 @@
#include <shell.h> #include <shell.h>
#endif #endif
extern int demo_init(void); extern int demo_init(void);
void rt_init_thread_entry(void* parameter) void rt_init_thread_entry(void* parameter)
{ {
#ifdef RT_USING_FINSH
/* initialization finsh shell Component */ /* initialization finsh shell Component */
finsh_system_init(); finsh_system_init();
#endif
demo_init(); demo_init();
} }
int rt_application_init() int rt_application_init()
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE * http://www.rt-thread.org/license/LICENSE
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
......
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
......
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
#include <board.h> #include <board.h>
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
/* dfs init */ /* dfs init */
#include <dfs.h> #include <dfs.h>
...@@ -41,6 +46,14 @@ void rt_init_thread_entry(void* parameter) ...@@ -41,6 +46,14 @@ void rt_init_thread_entry(void* parameter)
/* Filesystem Initialization */ /* Filesystem Initialization */
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
{ {
/* init sdcard driver */
#if STM32_USE_SDIO
rt_hw_sdcard_init();
#else
rt_hw_msd_init();
#endif
/* init the device filesystem */ /* init the device filesystem */
dfs_init(); dfs_init();
...@@ -75,6 +88,13 @@ void rt_init_thread_entry(void* parameter) ...@@ -75,6 +88,13 @@ void rt_init_thread_entry(void* parameter)
rt_kprintf("TCP/IP initialized!\n"); rt_kprintf("TCP/IP initialized!\n");
} }
#endif #endif
rt_hw_rtc_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
} }
int rt_application_init() int rt_application_init()
......
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
...@@ -96,26 +92,9 @@ void rtthread_startup(void) ...@@ -96,26 +92,9 @@ void rtthread_startup(void)
/* init scheduler system */ /* init scheduler system */
rt_system_scheduler_init(); rt_system_scheduler_init();
#ifdef RT_USING_DFS
/* init sdcard driver */
#if STM32_USE_SDIO
rt_hw_sdcard_init();
#else
rt_hw_msd_init();
#endif
#endif
rt_hw_rtc_init();
/* init application */ /* init application */
rt_application_init(); rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device("uart1");
#endif
/* init timer thread */ /* init timer thread */
rt_system_timer_thread_init(); rt_system_timer_thread_init();
......
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
#include "stm32f4xx_eth.h" #include "stm32f4xx_eth.h"
#endif #endif
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_GDB #ifdef RT_USING_GDB
#include <gdb_stub.h> #include <gdb_stub.h>
#endif #endif
...@@ -50,6 +55,11 @@ void rt_init_thread_entry(void* parameter) ...@@ -50,6 +55,11 @@ void rt_init_thread_entry(void* parameter)
rt_kprintf("TCP/IP initialized!\n"); rt_kprintf("TCP/IP initialized!\n");
} }
#endif #endif
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
} }
int rt_application_init() int rt_application_init()
...@@ -65,5 +75,3 @@ int rt_application_init() ...@@ -65,5 +75,3 @@ int rt_application_init()
return 0; return 0;
} }
/*@}*/
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
...@@ -88,12 +84,6 @@ void rtthread_startup(void) ...@@ -88,12 +84,6 @@ void rtthread_startup(void)
/* init application */ /* init application */
rt_application_init(); rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device( FINSH_DEVICE_NAME );
#endif
/* init timer thread */ /* init timer thread */
rt_system_timer_thread_init(); rt_system_timer_thread_init();
......
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
......
...@@ -16,6 +16,11 @@ ...@@ -16,6 +16,11 @@
#include <board.h> #include <board.h>
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_LWIP #ifdef RT_USING_LWIP
#include <lwip/sys.h> #include <lwip/sys.h>
#include <lwip/api.h> #include <lwip/api.h>
...@@ -50,6 +55,10 @@ void rt_init_thread_entry(void* parameter) ...@@ -50,6 +55,10 @@ void rt_init_thread_entry(void* parameter)
rt_kprintf("TCP/IP initialized!\n"); rt_kprintf("TCP/IP initialized!\n");
} }
#endif #endif
#ifdef RT_USING_FINSH
finsh_system_init();
#endif
} }
int rt_application_init() int rt_application_init()
......
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
...@@ -92,11 +88,6 @@ void rtthread_startup(void) ...@@ -92,11 +88,6 @@ void rtthread_startup(void)
/* init application */ /* init application */
rt_application_init(); rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
/* init timer thread */ /* init timer thread */
rt_system_timer_thread_init(); rt_system_timer_thread_init();
......
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
/******************************************************************************* /*******************************************************************************
* Function Name : assert_failed * Function Name : assert_failed
......
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
......
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
......
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
#ifdef __CC_ARM #ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit; extern int Image$$RW_IRAM1$$ZI$$Limit;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册