support auto initial.
This commit is contained in:
parent
8890e83aa9
commit
c44b02f08c
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
|
@ -11,6 +10,7 @@
|
|||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard the first version
|
||||
* 2013-07-12 aozima update for auto initial.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -21,21 +21,17 @@
|
|||
#include <board.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
/* dfs init */
|
||||
#include <dfs_init.h>
|
||||
/* dfs filesystem:ELM filesystem init */
|
||||
#include <dfs_elm.h>
|
||||
/* dfs Filesystem APIs */
|
||||
#include <dfs_fs.h>
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
#include <lwip/sys.h>
|
||||
#include <lwip/api.h>
|
||||
#include <netif/ethernetif.h>
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
|
@ -89,20 +85,21 @@ void cali_store(struct calibration_data *data)
|
|||
data->min_y,
|
||||
data->max_y);
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_USING_RTGUI */
|
||||
|
||||
void rt_init_thread_entry(void* parameter)
|
||||
{
|
||||
/* Filesystem Initialization */
|
||||
#ifdef RT_USING_DFS
|
||||
{
|
||||
/* init the device filesystem */
|
||||
dfs_init();
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
/* initialization RT-Thread Components */
|
||||
rt_components_init();
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_DFS_ELMFAT
|
||||
/* init the elm chan FatFs filesystam*/
|
||||
elm_init();
|
||||
#ifdef RT_USING_FINSH
|
||||
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif /* RT_USING_FINSH */
|
||||
|
||||
/* Filesystem Initialization */
|
||||
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
|
||||
/* mount sd card fat partition 1 as root directory */
|
||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
|
||||
{
|
||||
|
@ -110,37 +107,7 @@ void rt_init_thread_entry(void* parameter)
|
|||
}
|
||||
else
|
||||
rt_kprintf("File System initialzation failed!\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* LwIP Initialization */
|
||||
#ifdef RT_USING_LWIP
|
||||
{
|
||||
extern void lwip_sys_init(void);
|
||||
|
||||
/* register ethernetif device */
|
||||
eth_system_device_init();
|
||||
|
||||
#ifdef STM32F10X_CL
|
||||
rt_hw_stm32_eth_init();
|
||||
#else
|
||||
/* STM32F103 */
|
||||
#if STM32_ETH_IF == 0
|
||||
rt_hw_enc28j60_init();
|
||||
#elif STM32_ETH_IF == 1
|
||||
rt_hw_dm9000_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* re-init device driver */
|
||||
rt_device_init_all();
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
rt_kprintf("TCP/IP initialized!\n");
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_USING_DFS */
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
{
|
||||
|
@ -175,7 +142,7 @@ void rt_init_thread_entry(void* parameter)
|
|||
#endif /* #ifdef RT_USING_RTGUI */
|
||||
}
|
||||
|
||||
int rt_application_init()
|
||||
int rt_application_init(void)
|
||||
{
|
||||
rt_thread_t init_thread;
|
||||
|
||||
|
@ -184,8 +151,12 @@ int rt_application_init()
|
|||
/* init led thread */
|
||||
result = rt_thread_init(&led_thread,
|
||||
"led",
|
||||
led_thread_entry, RT_NULL,
|
||||
(rt_uint8_t*)&led_stack[0], sizeof(led_stack), 20, 5);
|
||||
led_thread_entry,
|
||||
RT_NULL,
|
||||
(rt_uint8_t*)&led_stack[0],
|
||||
sizeof(led_stack),
|
||||
20,
|
||||
5);
|
||||
if (result == RT_EOK)
|
||||
{
|
||||
rt_thread_startup(&led_thread);
|
||||
|
|
|
@ -24,10 +24,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;
|
||||
|
@ -76,14 +72,14 @@ void rtthread_startup(void)
|
|||
#if STM32_EXT_SRAM
|
||||
rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
|
||||
#else
|
||||
#ifdef __CC_ARM
|
||||
#ifdef __CC_ARM
|
||||
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
|
||||
#elif __ICCARM__
|
||||
#elif __ICCARM__
|
||||
rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
|
||||
#else
|
||||
#else
|
||||
/* init memory system */
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
|
||||
#endif
|
||||
#endif
|
||||
#endif /* STM32_EXT_SRAM */
|
||||
#endif /* RT_USING_HEAP */
|
||||
|
||||
|
@ -96,12 +92,6 @@ void rtthread_startup(void)
|
|||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
/* init finsh */
|
||||
finsh_system_init();
|
||||
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
|
||||
/* init idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard first implementation
|
||||
* 2013-07-12 aozima update for auto initial.
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
|
@ -19,6 +20,10 @@
|
|||
#include "stm32f10x_fsmc.h"
|
||||
#include "board.h"
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
#include <components.h>
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
/**
|
||||
* @addtogroup STM32
|
||||
*/
|
||||
|
@ -181,6 +186,10 @@ void rt_hw_board_init(void)
|
|||
|
||||
rt_hw_usart_init();
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -56,6 +56,9 @@
|
|||
/* Using Small MM */
|
||||
#define RT_USING_SMALL_MEM
|
||||
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System */
|
||||
#define RT_USING_DEVICE
|
||||
|
@ -78,12 +81,12 @@
|
|||
/* #define RT_USING_DFS */
|
||||
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
#define RT_DFS_ELM_WORD_ACCESS
|
||||
/* Reentrancy (thread safe) of the FatFs module. */
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
/* #define RT_DFS_ELM_USE_LFN 1 */
|
||||
/* #define RT_DFS_ELM_CODE_PAGE 936 */
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
/* Maximum sector size to be handled. */
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
|
|
Loading…
Reference in New Issue