提交 6c83ff6e 编写于 作者: B Bernard Xiong

Merge remote-tracking branch 'coding/master'

/*
* File : crt.cpp
* This file is part of Device File System in RT-Thread RTOS
* COPYRIGHT (C) 2008-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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2015-03-07 Bernard Add copyright header.
*/
#include <rtthread.h> #include <rtthread.h>
#include "crt.h" #include "crt.h"
......
/*
* File : crt.h
* This file is part of Device File System in RT-Thread RTOS
* COPYRIGHT (C) 2008-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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2015-03-07 Bernard Add copyright header.
*/
#ifndef CRT_H_ #ifndef CRT_H_
#define CRT_H_ #define CRT_H_
......
/* /*
* File : crt_init.c * File : crt_init.c
* This file is part of Device File System in RT-Thread RTOS * This file is part of Device File System in RT-Thread RTOS
* COPYRIGHT (C) 2008-2011, RT-Thread Development Team * COPYRIGHT (C) 2008-2015, RT-Thread Development Team
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
......
...@@ -623,7 +623,6 @@ int list_mod_detail(const char *name) ...@@ -623,7 +623,6 @@ int list_mod_detail(const char *name)
return 0; return 0;
} }
FINSH_FUNCTION_EXPORT(list_mod_detail, list module objects in system) FINSH_FUNCTION_EXPORT(list_mod_detail, list module objects in system)
MSH_CMD_EXPORT(list_mod_detail, list module objects in system)
#endif #endif
long list(void) long list(void)
......
...@@ -18,32 +18,38 @@ ...@@ -18,32 +18,38 @@
#endif #endif
void libc_system_init(const char* tty_name) int libc_system_init(void)
{ {
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
int fd; int fd;
struct rt_device *console_dev;
#ifndef RT_USING_DFS_DEVFS #ifndef RT_USING_DFS_DEVFS
#error Please enable devfs by defining RT_USING_DFS_DEVFS in rtconfig.h #error Please enable devfs by defining RT_USING_DFS_DEVFS in rtconfig.h
#endif #endif
/* initialize console device */ console_dev = rt_console_get_device();
rt_console_init(tty_name); if (console_dev)
{
/* initialize console device */
rt_console_init(console_dev->parent.name);
/* open console as stdin/stdout/stderr */ /* open console as stdin/stdout/stderr */
fd = open("/dev/console", O_RDONLY, 0); /* for stdin */ fd = open("/dev/console", O_RDONLY, 0); /* for stdin */
fd = open("/dev/console", O_WRONLY, 0); /* for stdout */ fd = open("/dev/console", O_WRONLY, 0); /* for stdout */
fd = open("/dev/console", O_WRONLY, 0); /* for stderr */ fd = open("/dev/console", O_WRONLY, 0); /* for stderr */
/* skip warning */ /* skip warning */
fd = fd; fd = fd;
}
#endif #endif
/* set PATH and HOME */ /* set PATH and HOME */
putenv("PATH=/"); putenv("PATH=/bin");
putenv("HOME=/"); putenv("HOME=/home");
#ifdef RT_USING_PTHREADS #ifdef RT_USING_PTHREADS
pthread_system_init(); pthread_system_init();
#endif #endif
} }
INIT_COMPONENT_EXPORT(libc_system_init);
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
#include <sys/time.h> #include <sys/time.h>
#define MILLISECOND_PER_SECOND 1000UL #define MILLISECOND_PER_SECOND 1000UL
#define MICROSECOND_PER_SECOND 1000000UL #define MICROSECOND_PER_SECOND 1000000UL
#define NANOSECOND_PER_SECOND 1000000000UL #define NANOSECOND_PER_SECOND 1000000000UL
#define MILLISECOND_PER_TICK (MILLISECOND_PER_SECOND / RT_TICK_PER_SECOND) #define MILLISECOND_PER_TICK (MILLISECOND_PER_SECOND / RT_TICK_PER_SECOND)
#define MICROSECOND_PER_TICK (MICROSECOND_PER_SECOND / RT_TICK_PER_SECOND) #define MICROSECOND_PER_TICK (MICROSECOND_PER_SECOND / RT_TICK_PER_SECOND)
#define NANOSECOND_PER_TICK (NANOSECOND_PER_SECOND / RT_TICK_PER_SECOND) #define NANOSECOND_PER_TICK (NANOSECOND_PER_SECOND / RT_TICK_PER_SECOND)
void libc_system_init(const char* tty_name); int libc_system_init(void);
/* some time related function */ /* some time related function */
int libc_set_time(const struct timespec *time); int libc_set_time(const struct timespec *time);
......
/*
* File : components.h
* header for RT-Thread components
* This file is part of RT-Thread RTOS
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* 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
* 2015-03-22 Bernard Keep the compatibility.
*/
#ifndef COMPONENTS_H__
#define COMPONENTS_H__
#ifdef RT_USING_FINSH
#include <finsh.h>
#include <shell.h>
#endif
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <netif/ethernetif.h>
#endif
#ifdef RT_USING_DFS
#include <dfs_init.h>
#include <dfs_fs.h>
#ifdef RT_USING_DFS_ELMFAT
#include <dfs_elm.h>
#endif
#if defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS)
#include <dfs_nfs.h>
#endif
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
#ifdef RT_USING_DFS_DEVFS
#include <devfs.h>
#endif
#ifdef RT_USING_DFS_UFFS
#include <dfs_uffs.h>
#endif
#ifdef RT_USING_DFS_JFFS2
#include <dfs_jffs2.h>
#endif
#ifdef RT_USING_DFS_YAFFS2
#include <dfs_yaffs2.h>
#endif
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
#endif
#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif
#ifdef RT_USING_MODULE
#include <rtm.h>
#endif
#endif
...@@ -437,6 +437,11 @@ void rt_module_unload_sethook(void (*hook)(rt_module_t module)); ...@@ -437,6 +437,11 @@ void rt_module_unload_sethook(void (*hook)(rt_module_t module));
void rt_module_init_object_container(struct rt_module *module); void rt_module_init_object_container(struct rt_module *module);
rt_err_t rt_module_destroy(rt_module_t module); rt_err_t rt_module_destroy(rt_module_t module);
/*
* application module system initialization
*/
int rt_system_module_init(void);
/*@}*/ /*@}*/
#endif #endif
...@@ -455,10 +460,10 @@ void rt_interrupt_leave(void); ...@@ -455,10 +460,10 @@ void rt_interrupt_leave(void);
*/ */
rt_uint8_t rt_interrupt_get_nest(void); rt_uint8_t rt_interrupt_get_nest(void);
/** #ifdef RT_USING_COMPONENTS_INIT
* application module void rt_components_init(void);
*/ void rt_components_board_init(void);
int rt_system_module_init(void); #endif
/** /**
* @addtogroup KernelService * @addtogroup KernelService
......
...@@ -5,8 +5,13 @@ from building import * ...@@ -5,8 +5,13 @@ from building import *
src = Glob('*.c') src = Glob('*.c')
CPPPATH = [RTT_ROOT + '/include'] CPPPATH = [RTT_ROOT + '/include']
if rtconfig.CROSS_TOOL == 'keil' and GetDepend('RT_USING_MODULE') == True: if rtconfig.CROSS_TOOL == 'keil':
LINKFLAGS = ' --keep __rtmsym_* ' # add more link flags for module and components_init.
LINKFLAGS = ''
if GetDepend('RT_USING_MODULE'):
LINKFLAGS = ' --keep __rtmsym_* '
if GetDepend('RT_USING_COMPONENTS_INIT'):
LINKFLAGS = ' --keep __rt_init* '
else: else:
LINKFLAGS = '' LINKFLAGS = ''
......
...@@ -40,7 +40,7 @@ SConscript_com = '''# RT-Thread building script for component ...@@ -40,7 +40,7 @@ SConscript_com = '''# RT-Thread building script for component
from building import * from building import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = Glob('*.c') src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd] CPPPATH = [cwd]
group = DefineGroup('COMPONENT_NAME', src, depend = [''], CPPPATH = CPPPATH) group = DefineGroup('COMPONENT_NAME', src, depend = [''], CPPPATH = CPPPATH)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册