[BSP] fix the finsh_system_init issue in BSP

This commit is contained in:
Bernard Xiong 2017-12-08 11:57:22 +08:00
parent 37c6eac27b
commit f74cde045b
20 changed files with 144 additions and 182 deletions

View File

@ -35,6 +35,11 @@
#include <rtgui/driver.h>
#endif
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
/* thread phase init */
void rt_init_thread_entry(void *parameter)
{
@ -97,6 +102,11 @@ void rt_init_thread_entry(void *parameter)
}
}
#endif
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init();
#endif
}
// init led

View File

@ -20,10 +20,6 @@
#include "board.h"
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
extern int Image$$RW_IRAM1$$ZI$$Limit;
@ -81,12 +77,6 @@ void rtthread_startup(void)
/* initialize application */
rt_application_init();
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init();
finsh_set_device( FINSH_DEVICE_NAME );
#endif
/* initialize timer */
rt_system_timer_init();

View File

@ -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 *******************/

View File

@ -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();

View File

@ -14,13 +14,23 @@
#include <rtthread.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
/**
* @addtogroup LPC2478
*/
/*@{*/
int rt_application_init()
{
return 0;
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
return 0;
}
/*@}*/

View File

@ -10,19 +10,13 @@
* Change Logs:
* Date Author Notes
* 2008-12-11 xuxinming first version
* 2010-4-3 LiJin add init soft timer thread
* 2010-4-3 LiJin add init soft timer thread
*/
#include <rthw.h>
#include <rtthread.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
extern int finsh_system_init(void);
#endif
#include <LPC24xx.h>
#include <board.h>
/**
* @addtogroup LPC2478
@ -30,9 +24,6 @@ extern int finsh_system_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
extern int Image$$RW_IRAM1$$ZI$$Limit;
@ -45,67 +36,61 @@ extern int __bss_end;
*/
void rtthread_startup(void)
{
/* init hardware interrupt */
rt_hw_interrupt_init();
/* init board */
rt_hw_board_init();
/* init tick */
rt_system_tick_init();
/* init kernel object */
rt_system_object_init();
rt_show_version();
/* init hardware interrupt */
rt_hw_interrupt_init();
/* init timer system */
rt_system_timer_init();
/* init board */
rt_hw_board_init();
/* init memory system */
/* init tick */
rt_system_tick_init();
/* init kernel object */
rt_system_object_init();
rt_show_version();
/* init timer system */
rt_system_timer_init();
/* init memory system */
#ifdef RT_USING_HEAP
#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
rt_system_heap_init((void*)&__bss_end, (void*)0x40010000);
rt_system_heap_init((void *)&__bss_end, (void *)0x40010000);
#endif
#endif
/* init scheduler system */
rt_system_scheduler_init();
/* init scheduler system */
rt_system_scheduler_init();
/* init application */
rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device("uart1");
#endif
/* init soft timer thread */
rt_system_timer_thread_init();
/* init application */
rt_application_init();
/* init idle thread */
rt_thread_idle_init();
/* init soft timer thread */
rt_system_timer_thread_init();
/* start scheduler */
rt_system_scheduler_start();
/* never reach here */
return ;
/* init idle thread */
rt_thread_idle_init();
/* start scheduler */
rt_system_scheduler_start();
/* never reach here */
return ;
}
#ifdef __CC_ARM
int main(void)
{
/* disable interrupt first */
rt_hw_interrupt_disable();
/* disable interrupt first */
rt_hw_interrupt_disable();
/* invoke rtthread_startup */
rtthread_startup();
return 0;
/* invoke rtthread_startup */
rtthread_startup();
return 0;
}
#endif

View File

@ -18,16 +18,16 @@
#include <shell.h>
#endif
extern int demo_init(void);
void rt_init_thread_entry(void* parameter)
{
#ifdef RT_USING_FINSH
/* initialization finsh shell Component */
finsh_system_init();
#endif
demo_init();
}
int rt_application_init()

View File

@ -5,7 +5,7 @@
*
* The license and distribution terms for this file may be
* 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:
* Date Author Notes

View File

@ -25,10 +25,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;

View File

@ -20,6 +20,11 @@
#include <board.h>
#include <rtthread.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_DFS
/* dfs init */
#include <dfs.h>
@ -41,6 +46,14 @@ void rt_init_thread_entry(void* parameter)
/* Filesystem Initialization */
#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 */
dfs_init();
@ -75,6 +88,13 @@ void rt_init_thread_entry(void* parameter)
rt_kprintf("TCP/IP initialized!\n");
}
#endif
rt_hw_rtc_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
}
int rt_application_init()

View File

@ -25,10 +25,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;
@ -96,26 +92,9 @@ void rtthread_startup(void)
/* init scheduler system */
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 */
rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device("uart1");
#endif
/* init timer thread */
rt_system_timer_thread_init();

View File

@ -23,6 +23,11 @@
#include "stm32f4xx_eth.h"
#endif
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_GDB
#include <gdb_stub.h>
#endif
@ -50,6 +55,11 @@ void rt_init_thread_entry(void* parameter)
rt_kprintf("TCP/IP initialized!\n");
}
#endif
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
}
int rt_application_init()
@ -65,5 +75,3 @@ int rt_application_init()
return 0;
}
/*@}*/

View File

@ -26,10 +26,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;
@ -88,12 +84,6 @@ void rtthread_startup(void)
/* init application */
rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
finsh_set_device( FINSH_DEVICE_NAME );
#endif
/* init timer thread */
rt_system_timer_thread_init();

View File

@ -26,10 +26,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;

View File

@ -16,6 +16,11 @@
#include <board.h>
#include <rtthread.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <lwip/api.h>
@ -50,6 +55,10 @@ void rt_init_thread_entry(void* parameter)
rt_kprintf("TCP/IP initialized!\n");
}
#endif
#ifdef RT_USING_FINSH
finsh_system_init();
#endif
}
int rt_application_init()

View File

@ -26,10 +26,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;
@ -92,11 +88,6 @@ void rtthread_startup(void)
/* init application */
rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
/* init timer thread */
rt_system_timer_thread_init();

View File

@ -26,11 +26,6 @@
/*@{*/
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

View File

@ -25,10 +25,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;

View File

@ -26,10 +26,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;

View File

@ -36,10 +36,6 @@
/*@{*/
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
extern int Image$$RW_IRAM1$$ZI$$Limit;