Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
5c17c2e6
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5c17c2e6
编写于
2月 21, 2013
作者:
wuyangyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: bsp/stm32f107 add RT_USING_COMPONENTS_INIT.
上级
7bec8a24
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
125 addition
and
161 deletion
+125
-161
bsp/stm32f107/SConstruct
bsp/stm32f107/SConstruct
+2
-7
bsp/stm32f107/applications/application.c
bsp/stm32f107/applications/application.c
+21
-44
bsp/stm32f107/applications/startup.c
bsp/stm32f107/applications/startup.c
+36
-52
bsp/stm32f107/drivers/board.c
bsp/stm32f107/drivers/board.c
+17
-37
bsp/stm32f107/drivers/board.h
bsp/stm32f107/drivers/board.h
+1
-19
bsp/stm32f107/drivers/platform.c
bsp/stm32f107/drivers/platform.c
+22
-0
bsp/stm32f107/project.uvproj
bsp/stm32f107/project.uvproj
+18
-1
bsp/stm32f107/rtconfig.h
bsp/stm32f107/rtconfig.h
+8
-1
未找到文件。
bsp/stm32f107/SConstruct
浏览文件 @
5c17c2e6
...
...
@@ -28,10 +28,5 @@ Export('RTT_ROOT')
Export
(
'rtconfig'
)
# prepare building environment
objs
=
PrepareBuilding
(
env
,
RTT_ROOT
,
has_libcpu
=
False
)
# build program
env
.
Program
(
TARGET
,
objs
)
# end building
EndBuilding
(
TARGET
)
objs
=
PrepareBuilding
(
env
,
RTT_ROOT
)
DoBuilding
(
TARGET
,
objs
)
bsp/stm32f107/applications/application.c
浏览文件 @
5c17c2e6
/*
* File : application.c
* 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
* found in the file LICENSE in this distribution or at
...
...
@@ -21,67 +21,42 @@
#include <rtthread.h>
#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>
#include "stm32_eth.h"
#endif
#ifdef RT_USING_COMPONENTS_INIT
#include <components.h>
#endif
/* RT_USING_COMPONENTS_INIT */
void
rt_init_thread_entry
(
void
*
parameter
)
{
/* Filesystem Initialization */
#ifdef RT_USING_DFS
{
/* init the device filesystem */
dfs_init
();
#ifdef RT_USING_DFS_ELMFAT
/* init the elm chan FatFs filesystam*/
elm_init
();
{
extern
void
rt_platform_init
(
void
);
rt_platform_init
();
}
/* init sdcard driver */
rt_hw_msd_init
();
#ifdef RT_USING_COMPONENTS_INIT
/* initialization RT-Thread Components */
rt_components_init
();
#endif
/* 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
)
{
rt_kprintf
(
"File System initialized!
\n
"
);
}
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
();
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
;
...
...
@@ -96,7 +71,9 @@ int rt_application_init()
#endif
if
(
init_thread
!=
RT_NULL
)
{
rt_thread_startup
(
init_thread
);
}
return
0
;
}
...
...
bsp/stm32f107/applications/startup.c
浏览文件 @
5c17c2e6
/*
* File : startup.c
* 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
* found in the file LICENSE in this distribution or at
...
...
@@ -15,8 +15,6 @@
#include <rthw.h>
#include <rtthread.h>
#include "stm32f10x.h"
#include "board.h"
/**
...
...
@@ -26,17 +24,16 @@
/*@{*/
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
;
#define STM32_SRAM_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
#elif __ICCARM__
#pragma section="HEAP"
#define STM32_SRAM_BEGIN (__segment_end("HEAP"))
#else
extern
int
__bss_end
;
#define STM32_SRAM_BEGIN (&__bss_end)
#endif
/*******************************************************************************
...
...
@@ -50,11 +47,11 @@ extern int __bss_end;
*******************************************************************************/
void
assert_failed
(
u8
*
file
,
u32
line
)
{
rt_kprintf
(
"
\n\r
Wrong parameter value detected on
\r\n
"
);
rt_kprintf
(
" file %s
\r\n
"
,
file
);
rt_kprintf
(
" line %d
\r\n
"
,
line
);
rt_kprintf
(
"
\n\r
Wrong parameter value detected on
\r\n
"
);
rt_kprintf
(
" file %s
\r\n
"
,
file
);
rt_kprintf
(
" line %d
\r\n
"
,
line
);
while
(
1
)
;
while
(
1
)
;
}
/**
...
...
@@ -62,69 +59,56 @@ void assert_failed(u8* file, u32 line)
*/
void
rtthread_startup
(
void
)
{
/* init board */
rt_hw_board_init
();
/* init board */
rt_hw_board_init
();
/* show version */
rt_show_version
();
/* show version */
rt_show_version
();
/* init tick */
rt_system_tick_init
();
/* init tick */
rt_system_tick_init
();
/* init kernel object */
rt_system_object_init
();
/* init kernel object */
rt_system_object_init
();
/* init timer system */
rt_system_timer_init
();
/* init timer system */
rt_system_timer_init
();
#ifdef RT_USING_HEAP
#ifdef __CC_ARM
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
rt_system_heap_init
((
void
*
)
STM32_SRAM_BEGIN
,
(
void
*
)
STM32_SRAM_END
);
#endif
/* init scheduler system */
rt_system_scheduler_init
();
/* init scheduler system */
rt_system_scheduler_init
();
/* init all device */
rt_device_init_all
();
/* init all device */
rt_device_init_all
();
/* init application */
rt_application_init
();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
finsh_set_device
(
"uart1"
);
#endif
/* init application */
rt_application_init
();
/* init timer thread */
rt_system_timer_thread_init
();
/* init idle thread */
rt_thread_idle_init
();
/* init idle thread */
rt_thread_idle_init
();
/* start scheduler */
rt_system_scheduler_start
();
/* start scheduler */
rt_system_scheduler_start
();
/* never reach here */
return
;
/* never reach here */
return
;
}
int
main
(
void
)
{
/* disable interrupt first */
rt_hw_interrupt_disable
();
/* disable interrupt first */
rt_hw_interrupt_disable
();
/* startup RT-Thread RTOS */
rtthread_startup
();
/* startup RT-Thread RTOS */
rtthread_startup
();
return
0
;
return
0
;
}
/*@}*/
bsp/stm32f107/drivers/board.c
浏览文件 @
5c17c2e6
/*
* File : board.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 200
9
RT-Thread Develop Team
* COPYRIGHT (C) 200
6 - 2013
RT-Thread Develop Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
...
...
@@ -33,62 +33,42 @@
void
NVIC_Configuration
(
void
)
{
#ifdef VECT_TAB_RAM
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable
(
NVIC_VectTab_RAM
,
0x0
);
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable
(
NVIC_VectTab_RAM
,
0x0
);
#else
/* VECT_TAB_FLASH */
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable
(
NVIC_VectTab_FLASH
,
0x0
);
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable
(
NVIC_VectTab_FLASH
,
0x0
);
#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.
*
*/
void
rt_hw_timer_handler
(
void
)
{
/* enter interrupt */
rt_interrupt_enter
();
/* enter interrupt */
rt_interrupt_enter
();
rt_tick_increase
();
rt_tick_increase
();
/* leave interrupt */
rt_interrupt_leave
();
/* leave interrupt */
rt_interrupt_leave
();
}
/**
* 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 */
SysTick_Configuration
(
);
/* Configure the SysTick */
SysTick_Config
(
SystemCoreClock
/
RT_TICK_PER_SECOND
);
rt_hw_usart_init
();
rt_console_set_device
(
CONSOLE_DEVIC
E
);
rt_hw_usart_init
();
rt_console_set_device
(
RT_CONSOLE_DEVICE_NAM
E
);
}
/*@}*/
bsp/stm32f107/drivers/board.h
浏览文件 @
5c17c2e6
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 200
9
, RT-Thread Development Team
* COPYRIGHT (C) 200
6 - 2013
, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
...
...
@@ -40,27 +40,9 @@
#define STM32_SRAM_SIZE 64
#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
);
#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
);
/* SD Card init function */
void
rt_hw_msd_init
(
void
);
#endif
// <<< Use Configuration Wizard in Context Menu >>>
bsp/stm32f107/drivers/platform.c
0 → 100644
浏览文件 @
5c17c2e6
#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 */
}
bsp/stm32f107/project.uvproj
浏览文件 @
5c17c2e6
...
...
@@ -343,7 +343,7 @@
<MiscControls
/>
<Define>
STM32F10X_CL, USE_STDPERIPH_DRIVER
</Define>
<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>
</Cads>
<Aads>
...
...
@@ -413,6 +413,13 @@
<FilePath>
drivers\msd.c
</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>
platform.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
drivers\platform.c
</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>
serial.c
</FileName>
...
...
@@ -884,6 +891,16 @@
</File>
</Files>
</Group>
<Group>
<GroupName>
Components
</GroupName>
<Files>
<File>
<FileName>
components.c
</FileName>
<FileType>
1
</FileType>
<FilePath>
..\..\components\init\components.c
</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>
LwIP
</GroupName>
<Files>
...
...
bsp/stm32f107/rtconfig.h
浏览文件 @
5c17c2e6
...
...
@@ -28,7 +28,6 @@
/* #define RT_USING_TIMER_SOFT */
#define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 512
#define RT_TIMER_TICK_PER_SECOND 10
/* SECTION: IPC */
/* Using Semaphore*/
...
...
@@ -66,6 +65,14 @@
/* the buffer size of console*/
#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 */
#define RT_USING_FINSH
/* Using symbol table */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录