summaryrefslogtreecommitdiff
path: root/components/libc/newlib
diff options
context:
space:
mode:
author陈豪 | Jacob Chen <[email protected]>2015-03-29 18:35:44 +0800
committer陈豪 | Jacob Chen <[email protected]>2015-03-29 18:35:44 +0800
commit9a4dacaad743801c9be2dbae49251c4e1b8f99a9 (patch)
tree34def3bef5c5fc4a9b7594eba5a2729f8c86aab0 /components/libc/newlib
parentdaac5388afe5a18d51e9839719de8423b62b00c1 (diff)
parent5af7abd8c2e8b8a39c0bf096bdf9b5cb08f266fa (diff)
Merge pull request #3 from RT-Thread/master
111
Diffstat (limited to 'components/libc/newlib')
-rw-r--r--components/libc/newlib/SConscript15
-rw-r--r--components/libc/newlib/libc.c14
2 files changed, 18 insertions, 11 deletions
diff --git a/components/libc/newlib/SConscript b/components/libc/newlib/SConscript
index ae8e8756e1..574c2a8d1f 100644
--- a/components/libc/newlib/SConscript
+++ b/components/libc/newlib/SConscript
@@ -1,15 +1,10 @@
-Import('rtconfig')
from building import *
-if GetDepend('RT_USING_NEWLIB') and rtconfig.CROSS_TOOL != 'gcc':
- print '================ERROR============================'
- print 'Please use GNU GCC compiler if using newlib'
- print '================================================='
- exit(0)
-
+src = Glob('*.c')
cwd = GetCurrentDir()
-src = Glob('*.c')
+
CPPPATH = [cwd]
+CPPDEFINES = ['RT_USING_NEWLIB']
# link with libc and libm:
# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
@@ -17,7 +12,7 @@ CPPPATH = [cwd]
# been referenced. So setting this won't result in bigger text size.
LIBS = ['c', 'm']
-group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'],
- CPPPATH = CPPPATH, LIBS = LIBS)
+group = DefineGroup('newlib', src, depend = ['RT_USING_LIBC'],
+ CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
Return('group')
diff --git a/components/libc/newlib/libc.c b/components/libc/newlib/libc.c
index f7bb8e3f9b..73270969b8 100644
--- a/components/libc/newlib/libc.c
+++ b/components/libc/newlib/libc.c
@@ -9,6 +9,15 @@
#include <pthread.h>
#endif
+#ifdef RT_USING_DFS
+#include <dfs_posix.h>
+
+#ifdef RT_USING_DFS_DEVFS
+#include <devfs.h>
+#endif
+
+#endif
+
void libc_system_init(const char* tty_name)
{
#ifdef RT_USING_DFS
@@ -18,13 +27,16 @@ void libc_system_init(const char* tty_name)
#error Please enable devfs by defining RT_USING_DFS_DEVFS in rtconfig.h
#endif
- /* init console device */
+ /* initialize console device */
rt_console_init(tty_name);
/* open console as stdin/stdout/stderr */
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 stderr */
+
+ /* skip warning */
+ fd = fd;
#endif
/* set PATH and HOME */