Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46254178
rt-thread
提交
fbd620a7
R
rt-thread
项目概览
weixin_46254178
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
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,发现更多精彩内容 >>
提交
fbd620a7
编写于
2月 25, 2015
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Kernel] Move the components initailzation to the kernel
上级
afefbc0e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
207 addition
and
47 deletion
+207
-47
components/dfs/filesystems/skeleton/skeleton.c
components/dfs/filesystems/skeleton/skeleton.c
+2
-1
components/init/SConscript
components/init/SConscript
+0
-14
include/rtcomponents.h
include/rtcomponents.h
+6
-32
src/init.c
src/init.c
+199
-0
未找到文件。
components/dfs/filesystems/skeleton/skeleton.c
浏览文件 @
fbd620a7
/*
* File : skeleton.c
* This file is part of Device File System in RT-Thread RTOS
* COPYRIGHT (C) 2004-201
1
, RT-Thread Development Team
* COPYRIGHT (C) 2004-201
5
, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -100,3 +100,4 @@ int dfs_skt_init(void)
dfs_register
(
&
_skt_fs
);
return
0
;
}
INIT_FS_EXPORT
(
dfs_skt_init
);
components/init/SConscript
已删除
100644 → 0
浏览文件 @
afefbc0e
Import
(
'rtconfig'
)
from
building
import
*
cwd
=
GetCurrentDir
()
src
=
Glob
(
'*.c'
)
CPPPATH
=
[
cwd
]
if
rtconfig
.
CROSS_TOOL
==
'keil'
:
LINKFLAGS
=
' --keep __rt_init* '
else
:
LINKFLAGS
=
''
group
=
DefineGroup
(
'Components'
,
src
,
depend
=
[
'RT_USING_COMPONENTS_INIT'
],
CPPPATH
=
CPPPATH
,
LINKFLAGS
=
LINKFLAGS
)
Return
(
'group'
)
components/init/
components.h
→
include/rt
components.h
浏览文件 @
fbd620a7
/*
* File : components_init.h
* File : rtcomponents.h
* header for RT-Thread components
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team
* COPYRIGHT (C) 2012
-2015
, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -21,12 +22,11 @@
* Date Author Notes
* 2012-09-20 Bernard Change the name to components.h
* And all components related header files.
* 2015-02-06 Bernard Rename the components.h to rtcom.h
*/
#ifndef __COMPONENTS_INIT_H__
#define __COMPONENTS_INIT_H__
#include <rtthread.h>
#ifndef RTCOM_H__
#define RTCOM_H__
#ifdef RT_USING_FINSH
#include <finsh.h>
...
...
@@ -36,7 +36,6 @@
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <netif/ethernetif.h>
extern
void
lwip_system_init
(
void
);
#endif
#ifdef RT_USING_DFS
...
...
@@ -68,9 +67,6 @@ extern void lwip_system_init(void);
#endif
#endif
#ifdef RT_USING_NEWLIB
#include <libc.h>
#endif
#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif
...
...
@@ -79,27 +75,5 @@ extern void lwip_system_init(void);
#include <rtm.h>
#endif
#ifdef RT_USING_RTGUI
#include <rtgui/rtgui_system.h>
#endif
#ifdef __cplusplus
extern
"C"
{
#endif
/**
* Initializes board routine in RT-Thread.
*/
void
rt_components_board_init
(
void
);
/**
* Initializes components in RT-Thread
* notes: this function must be invoked in Init Thread
*/
void
rt_components_init
(
void
);
#ifdef __cplusplus
}
#endif
#endif
components/init/components
.c
→
src/init
.c
浏览文件 @
fbd620a7
/*
* File :
components
.c
* File :
init
.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012 - 201
3
, RT-Thread Development Team
* COPYRIGHT (C) 2012 - 201
5
, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -23,11 +23,36 @@
* And all components related header files.
* 2012-12-23 Bernard fix the pthread initialization issue.
* 2013-06-23 Bernard Add the init_call for components initialization.
* 2013-07-05 Bernard Remove initialization feature for MS VC++ compiler
* 2013-07-05 Bernard Remove initialization feature for MS VC++ compiler
* 2015-02-06 Bernard Remove the MS VC++ support and move to the kernel
*/
#include
"components.h"
#include
<rtthread.h>
#ifdef RT_USING_COMPONENTS_INIT
/*
* Components Initialization will initialize some driver and components as following
* order:
* rti_start --> 0
* BOARD_EXPORT --> 1
* rti_board_end --> 1.end
*
* DEVICE_EXPORT --> 2
* COMPONENT_EXPORT --> 3
* FS_EXPORT --> 4
* ENV_EXPORT --> 5
* APP_EXPORT --> 6
*
* rti_end --> 6.end
*
* These automatically initializaiton, the driver or component initial function must
* be defined with:
* INIT_BOARD_EXPORT(fn);
* INIT_DEVICE_EXPORT(fn);
* ...
* INIT_APP_EXPORT(fn);
* etc.
*/
static
int
rti_start
(
void
)
{
return
0
;
...
...
@@ -38,29 +63,28 @@ static int rti_board_end(void)
{
return
0
;
}
INIT_EXPORT
(
rti_board_end
,
"1.
post
"
);
INIT_EXPORT
(
rti_board_end
,
"1.
end
"
);
static
int
rti_end
(
void
)
{
return
0
;
}
INIT_EXPORT
(
rti_end
,
"7
"
);
INIT_EXPORT
(
rti_end
,
"6.end
"
);
/**
* RT-Thread Components Initialization for board
*/
void
rt_components_board_init
(
void
)
{
#ifndef _MSC_VER
#if RT_DEBUG_INIT
int
result
;
const
struct
rt_init_desc
*
desc
;
for
(
desc
=
&
__rt_init_desc_rti_start
;
desc
<
&
__rt_init_desc_rti_board_end
;
desc
++
)
{
rt_kprintf
(
"initialize %s"
,
desc
->
fn_name
);
result
=
desc
->
fn
();
rt_kprintf
(
":%d done
\n
"
,
result
);
}
int
result
;
const
struct
rt_init_desc
*
desc
;
for
(
desc
=
&
__rt_init_desc_rti_start
;
desc
<
&
__rt_init_desc_rti_board_end
;
desc
++
)
{
rt_kprintf
(
"initialize %s"
,
desc
->
fn_name
);
result
=
desc
->
fn
();
rt_kprintf
(
":%d done
\n
"
,
result
);
}
#else
const
init_fn_t
*
fn_ptr
;
...
...
@@ -69,7 +93,6 @@ void rt_components_board_init(void)
(
*
fn_ptr
)();
}
#endif
#endif
}
/**
...
...
@@ -77,18 +100,17 @@ void rt_components_board_init(void)
*/
void
rt_components_init
(
void
)
{
#ifndef _MSC_VER
#if RT_DEBUG_INIT
int
result
;
const
struct
rt_init_desc
*
desc
;
rt_kprintf
(
"do components intialization.
\n
"
);
for
(
desc
=
&
__rt_init_desc_rti_board_end
;
desc
<
&
__rt_init_desc_rti_end
;
desc
++
)
{
rt_kprintf
(
"initialize %s"
,
desc
->
fn_name
);
result
=
desc
->
fn
();
rt_kprintf
(
":%d done
\n
"
,
result
);
}
int
result
;
const
struct
rt_init_desc
*
desc
;
rt_kprintf
(
"do components intialization.
\n
"
);
for
(
desc
=
&
__rt_init_desc_rti_board_end
;
desc
<
&
__rt_init_desc_rti_end
;
desc
++
)
{
rt_kprintf
(
"initialize %s"
,
desc
->
fn_name
);
result
=
desc
->
fn
();
rt_kprintf
(
":%d done
\n
"
,
result
);
}
#else
const
init_fn_t
*
fn_ptr
;
...
...
@@ -97,81 +119,81 @@ void rt_components_init(void)
(
*
fn_ptr
)();
}
#endif
#else
#ifdef RT_USING_MODULE
rt_system_module_init
();
#endif
}
#ifdef RT_USING_USER_MAIN
void
rt_application_init
(
void
);
void
rt_hw_board_init
(
void
);
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init
();
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#ifndef RT_USING_HEAP
/* if there is not enble heap, we should use static thread and stack. */
ALIGN
(
8
)
static
rt_uint8_t
main_stack
[
2048
];
struct
rt_thread
main_thread
;
#endif
#ifdef RT_USING_LWIP
/* initialize lwip stack */
/* register ethernetif device */
eth_system_device_init
(
);
/* the system main thread */
void
main_thread_entry
(
void
*
parameter
)
{
extern
int
main
(
void
);
/* initialize lwip system */
lwip_system_init
();
rt_kprintf
(
"TCP/IP initialized!
\n
"
);
#endif
/* RT-Thread components initialization */
rt_components_init
();
#ifdef RT_USING_DFS
/* initialize the device file system */
dfs_init
();
/* invoke system main function */
main
();
}
#ifdef RT_USING_DFS_ELMFAT
/* initialize the elm chan FatFS file system*/
elm_init
();
#endif
void
rt_application_init
(
void
)
{
rt_thread_t
tid
;
#if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP)
/* initialize NFSv3 client file system */
nfs_init
();
#endif
#ifdef RT_USING_HEAP
tid
=
rt_thread_create
(
"main"
,
main_thread_entry
,
RT_NULL
,
2048
,
RT_THREAD_PRIORITY_MAX
/
3
,
20
);
RT_ASSERT
(
tid
!=
RT_NULL
);
#else
rt_err_t
result
;
#ifdef RT_USING_DFS_YAFFS2
dfs_yaffs2_init
();
tid
=
&
main_thread
;
result
=
rt_thread_init
(
tid
,
"main"
,
main_thread_entry
,
RT_NULL
,
2048
,
RT_THREAD_PRIORITY_MAX
/
3
,
20
);
RT_ASSERT
(
result
!=
RT_EOK
);
#endif
#ifdef RT_USING_DFS_UFFS
dfs_uffs_init
();
#endif
rt_thread_startup
(
tid
);
}
#ifdef RT_USING_DFS_JFFS2
dfs_jffs2_init
();
#endif
int
rtthread_startup
(
void
)
{
/* board level initalization
* NOTE: please initialize heap inside board initialization.
*/
rt_hw_board_init
();
#ifdef RT_USING_DFS_ROMFS
dfs_romfs_init
();
#endif
/* show RT-Thread version */
rt_show_version
();
#ifdef RT_USING_DFS_RAMFS
dfs_ramfs_init
();
#endif
/* timer system initialization */
rt_system_timer_init
();
#ifdef RT_USING_DFS_DEVFS
devfs_init
();
#endif
#endif
/* end of RT_USING_DFS */
/* scheduler system initialization */
rt_system_scheduler_init
();
#ifdef RT_USING_NEWLIB
libc_system_init
(
RT_CONSOLE_DEVICE_NAME
);
#else
/* the pthread system initialization will be initiallized in libc */
#ifdef RT_USING_PTHREADS
pthread_system_init
();
#endif
#endif
/* create init_thread */
rt_application_init
();
#ifdef RT_USING_RTGUI
rtgui_system_server_init
();
#endif
/* timer thread initialization */
rt_system_timer_thread_init
();
#ifdef RT_USING_USB_HOST
rt_usb_host_init
();
/* idle thread initialization */
rt_thread_idle_init
();
/* start scheduler */
rt_system_scheduler_start
();
/* never reach here */
return
;
}
#endif
#endif
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录