update: bsp/stm32f107 add RT_USING_COMPONENTS_INIT.
This commit is contained in:
parent
7bec8a242b
commit
5c17c2e698
|
@ -28,10 +28,5 @@ Export('RTT_ROOT')
|
||||||
Export('rtconfig')
|
Export('rtconfig')
|
||||||
|
|
||||||
# prepare building environment
|
# prepare building environment
|
||||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
objs = PrepareBuilding(env, RTT_ROOT)
|
||||||
|
DoBuilding(TARGET, objs)
|
||||||
# build program
|
|
||||||
env.Program(TARGET, objs)
|
|
||||||
|
|
||||||
# end building
|
|
||||||
EndBuilding(TARGET)
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : application.c
|
* File : application.c
|
||||||
* This file is part of RT-Thread RTOS
|
* This file is part of RT-Thread RTOS
|
||||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -21,67 +21,42 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
#ifdef RT_USING_DFS
|
#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>
|
#include <dfs_fs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_LWIP
|
#ifdef RT_USING_COMPONENTS_INIT
|
||||||
#include <lwip/sys.h>
|
#include <components.h>
|
||||||
#include <lwip/api.h>
|
#endif /* RT_USING_COMPONENTS_INIT */
|
||||||
#include <netif/ethernetif.h>
|
|
||||||
#include "stm32_eth.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void rt_init_thread_entry(void* parameter)
|
void rt_init_thread_entry(void* parameter)
|
||||||
{
|
{
|
||||||
/* Filesystem Initialization */
|
|
||||||
#ifdef RT_USING_DFS
|
|
||||||
{
|
{
|
||||||
/* init the device filesystem */
|
extern void rt_platform_init(void);
|
||||||
dfs_init();
|
rt_platform_init();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef RT_USING_DFS_ELMFAT
|
#ifdef RT_USING_COMPONENTS_INIT
|
||||||
/* init the elm chan FatFs filesystam*/
|
/* initialization RT-Thread Components */
|
||||||
elm_init();
|
rt_components_init();
|
||||||
|
#endif
|
||||||
/* init sdcard driver */
|
|
||||||
rt_hw_msd_init();
|
|
||||||
|
|
||||||
|
/* Filesystem Initialization */
|
||||||
|
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
|
||||||
|
{
|
||||||
/* mount sd card fat partition 1 as root directory */
|
/* mount sd card fat partition 1 as root directory */
|
||||||
if (dfs_mount("sd0", "/", "elm", 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 initialzation failed!\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* LwIP Initialization */
|
|
||||||
#ifdef RT_USING_LWIP
|
|
||||||
{
|
{
|
||||||
extern void lwip_sys_init(void);
|
rt_kprintf("File System initialzation failed!\n");
|
||||||
|
|
||||||
/* register ethernetif device */
|
|
||||||
eth_system_device_init();
|
|
||||||
|
|
||||||
rt_hw_stm32_eth_init();
|
|
||||||
/* 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 && RT_USING_DFS_ELMFAT */
|
||||||
}
|
}
|
||||||
|
|
||||||
int rt_application_init()
|
int rt_application_init(void)
|
||||||
{
|
{
|
||||||
rt_thread_t init_thread;
|
rt_thread_t init_thread;
|
||||||
|
|
||||||
|
@ -96,7 +71,9 @@ int rt_application_init()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (init_thread != RT_NULL)
|
if (init_thread != RT_NULL)
|
||||||
|
{
|
||||||
rt_thread_startup(init_thread);
|
rt_thread_startup(init_thread);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : startup.c
|
* File : startup.c
|
||||||
* This file is part of RT-Thread RTOS
|
* This file is part of RT-Thread RTOS
|
||||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
* COPYRIGHT (C) 2006 - 2013, RT-Thread Develop Team
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
#include "stm32f10x.h"
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,17 +24,16 @@
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
extern int rt_application_init(void);
|
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
|
#ifdef __CC_ARM
|
||||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||||
|
#define STM32_SRAM_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
|
||||||
#elif __ICCARM__
|
#elif __ICCARM__
|
||||||
#pragma section="HEAP"
|
#pragma section="HEAP"
|
||||||
|
#define STM32_SRAM_BEGIN (__segment_end("HEAP"))
|
||||||
#else
|
#else
|
||||||
extern int __bss_end;
|
extern int __bss_end;
|
||||||
|
#define STM32_SRAM_BEGIN (&__bss_end)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -78,14 +75,7 @@ void rtthread_startup(void)
|
||||||
rt_system_timer_init();
|
rt_system_timer_init();
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
#ifdef RT_USING_HEAP
|
||||||
#ifdef __CC_ARM
|
rt_system_heap_init((void*)STM32_SRAM_BEGIN, (void*)STM32_SRAM_END);
|
||||||
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
|
|
||||||
#elif __ICCARM__
|
|
||||||
rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
|
|
||||||
#else
|
|
||||||
/* init memory system */
|
|
||||||
rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* init scheduler system */
|
/* init scheduler system */
|
||||||
|
@ -97,12 +87,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 timer thread */
|
/* init timer thread */
|
||||||
rt_system_timer_thread_init();
|
rt_system_timer_thread_init();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : board.c
|
* File : board.c
|
||||||
* This file is part of RT-Thread RTOS
|
* This file is part of RT-Thread RTOS
|
||||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
* COPYRIGHT (C) 2006 - 2013 RT-Thread Develop Team
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -41,26 +41,6 @@ void NVIC_Configuration(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Function Name : SysTick_Configuration
|
|
||||||
* Description : Configures the SysTick for OS tick.
|
|
||||||
* Input : None
|
|
||||||
* Output : None
|
|
||||||
* Return : None
|
|
||||||
*******************************************************************************/
|
|
||||||
void SysTick_Configuration(void)
|
|
||||||
{
|
|
||||||
RCC_ClocksTypeDef rcc_clocks;
|
|
||||||
rt_uint32_t cnts;
|
|
||||||
|
|
||||||
RCC_GetClocksFreq(&rcc_clocks);
|
|
||||||
|
|
||||||
cnts = (rt_uint32_t)rcc_clocks.HCLK_Frequency / RT_TICK_PER_SECOND;
|
|
||||||
|
|
||||||
SysTick_Config(cnts);
|
|
||||||
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the timer interrupt service routine.
|
* This is the timer interrupt service routine.
|
||||||
*
|
*
|
||||||
|
@ -79,16 +59,16 @@ void rt_hw_timer_handler(void)
|
||||||
/**
|
/**
|
||||||
* This function will initial STM32 board.
|
* This function will initial STM32 board.
|
||||||
*/
|
*/
|
||||||
void rt_hw_board_init()
|
void rt_hw_board_init(void)
|
||||||
{
|
{
|
||||||
/* NVIC Configuration */
|
/* NVIC Configuration */
|
||||||
NVIC_Configuration();
|
NVIC_Configuration();
|
||||||
|
|
||||||
/* Configure the SysTick */
|
/* Configure the SysTick */
|
||||||
SysTick_Configuration();
|
SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND );
|
||||||
|
|
||||||
rt_hw_usart_init();
|
rt_hw_usart_init();
|
||||||
rt_console_set_device(CONSOLE_DEVICE);
|
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : board.h
|
* File : board.h
|
||||||
* This file is part of RT-Thread RTOS
|
* This file is part of RT-Thread RTOS
|
||||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
* COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -40,27 +40,9 @@
|
||||||
#define STM32_SRAM_SIZE 64
|
#define STM32_SRAM_SIZE 64
|
||||||
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
|
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
|
||||||
|
|
||||||
// <o> Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3
|
|
||||||
// <i>Default: 1
|
|
||||||
#define STM32_CONSOLE_USART 1
|
|
||||||
|
|
||||||
void rt_hw_board_init(void);
|
void rt_hw_board_init(void);
|
||||||
|
|
||||||
#if STM32_CONSOLE_USART == 0
|
|
||||||
#define CONSOLE_DEVICE "no"
|
|
||||||
#elif STM32_CONSOLE_USART == 1
|
|
||||||
#define CONSOLE_DEVICE "uart1"
|
|
||||||
#elif STM32_CONSOLE_USART == 2
|
|
||||||
#define CONSOLE_DEVICE "uart2"
|
|
||||||
#elif STM32_CONSOLE_USART == 3
|
|
||||||
#define CONSOLE_DEVICE "uart3"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void rt_hw_usart_init(void);
|
void rt_hw_usart_init(void);
|
||||||
|
|
||||||
/* SD Card init function */
|
|
||||||
void rt_hw_msd_init(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <<< Use Configuration Wizard in Context Menu >>>
|
// <<< Use Configuration Wizard in Context Menu >>>
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include <board.h>
|
||||||
|
|
||||||
|
#ifdef RT_USING_LWIP
|
||||||
|
#include "stm32_eth.h"
|
||||||
|
#endif /* RT_USING_LWIP */
|
||||||
|
|
||||||
|
void rt_platform_init(void)
|
||||||
|
{
|
||||||
|
#ifdef RT_USING_LWIP
|
||||||
|
/* initialize eth interface */
|
||||||
|
rt_hw_stm32_eth_init();
|
||||||
|
#endif /* RT_USING_LWIP */
|
||||||
|
|
||||||
|
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
|
||||||
|
/* init sdcard driver */
|
||||||
|
{
|
||||||
|
extern void rt_hw_msd_init(void);
|
||||||
|
rt_hw_msd_init();
|
||||||
|
}
|
||||||
|
#endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */
|
||||||
|
}
|
|
@ -343,7 +343,7 @@
|
||||||
<MiscControls />
|
<MiscControls />
|
||||||
<Define>STM32F10X_CL, USE_STDPERIPH_DRIVER</Define>
|
<Define>STM32F10X_CL, USE_STDPERIPH_DRIVER</Define>
|
||||||
<Undefine />
|
<Undefine />
|
||||||
<IncludePath>.;..\..\components\CMSIS\Include;..\..\components\dfs;..\..\components\dfs\include;..\..\components\finsh;..\..\components\net\lwip\src;..\..\components\net\lwip\src\arch\include;..\..\components\net\lwip\src\include;..\..\components\net\lwip\src\include\ipv4;..\..\components\net\lwip\src\include\netif;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;Libraries\STM32F10x_StdPeriph_Driver\inc;applications;drivers</IncludePath>
|
<IncludePath>.;..\..\components\CMSIS\Include;..\..\components\dfs;..\..\components\dfs\include;..\..\components\finsh;..\..\components\init;..\..\components\net\lwip\src;..\..\components\net\lwip\src\arch\include;..\..\components\net\lwip\src\include;..\..\components\net\lwip\src\include\ipv4;..\..\components\net\lwip\src\include\netif;..\..\include;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;Libraries\STM32F10x_StdPeriph_Driver\inc;applications;drivers</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
</Cads>
|
</Cads>
|
||||||
<Aads>
|
<Aads>
|
||||||
|
@ -413,6 +413,13 @@
|
||||||
<FilePath>drivers\msd.c</FilePath>
|
<FilePath>drivers\msd.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>platform.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>drivers\platform.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
<Files>
|
<Files>
|
||||||
<File>
|
<File>
|
||||||
<FileName>serial.c</FileName>
|
<FileName>serial.c</FileName>
|
||||||
|
@ -884,6 +891,16 @@
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>Components</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>components.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\..\components\init\components.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>LwIP</GroupName>
|
<GroupName>LwIP</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
/* #define RT_USING_TIMER_SOFT */
|
/* #define RT_USING_TIMER_SOFT */
|
||||||
#define RT_TIMER_THREAD_PRIO 4
|
#define RT_TIMER_THREAD_PRIO 4
|
||||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||||
#define RT_TIMER_TICK_PER_SECOND 10
|
|
||||||
|
|
||||||
/* SECTION: IPC */
|
/* SECTION: IPC */
|
||||||
/* Using Semaphore*/
|
/* Using Semaphore*/
|
||||||
|
@ -66,6 +65,14 @@
|
||||||
/* the buffer size of console*/
|
/* the buffer size of console*/
|
||||||
#define RT_CONSOLEBUF_SIZE 128
|
#define RT_CONSOLEBUF_SIZE 128
|
||||||
|
|
||||||
|
// <string name="RT_CONSOLE_DEVICE_NAME" description="console device name" default="uart3" />
|
||||||
|
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
||||||
|
// </section>
|
||||||
|
|
||||||
|
// <section name="RT_USING_COMPONENTS_INIT" description="Using components init" default="true" >
|
||||||
|
#define RT_USING_COMPONENTS_INIT
|
||||||
|
// </section>
|
||||||
|
|
||||||
/* SECTION: finsh, a C-Express shell */
|
/* SECTION: finsh, a C-Express shell */
|
||||||
#define RT_USING_FINSH
|
#define RT_USING_FINSH
|
||||||
/* Using symbol table */
|
/* Using symbol table */
|
||||||
|
|
Loading…
Reference in New Issue