diff --git a/bsp/at91sam9260/rtconfig.h b/bsp/at91sam9260/rtconfig.h
index 176c84c0a0b..4a4b08d0ab7 100755
--- a/bsp/at91sam9260/rtconfig.h
+++ b/bsp/at91sam9260/rtconfig.h
@@ -64,7 +64,7 @@
/* SECTION: the runtime libc library */
/* the runtime libc library */
-#define RT_USING_NEWLIB
+#define RT_USING_LIBC
#define RT_USING_PTHREADS
/* Using Module System */
diff --git a/bsp/mini2440/rtconfig.h b/bsp/mini2440/rtconfig.h
index 2e4c05bbce6..b85996ab246 100644
--- a/bsp/mini2440/rtconfig.h
+++ b/bsp/mini2440/rtconfig.h
@@ -87,8 +87,8 @@
//
//
-//
-#define RT_USING_NEWLIB
+//
+#define RT_USING_LIBC
//
#define RT_USING_PTHREADS
//
diff --git a/bsp/stm32f0x/rtconfig.h b/bsp/stm32f0x/rtconfig.h
index c96e27df30e..f72cdfa6d39 100644
--- a/bsp/stm32f0x/rtconfig.h
+++ b/bsp/stm32f0x/rtconfig.h
@@ -87,20 +87,7 @@
#define FINSH_USING_DESCRIPTION
/* SECTION: libc management */
-#ifdef __CC_ARM
-/* #define RT_USING_MINILIBC */
-/* #define RT_USING_NEWLIB */
-#endif
-
-#ifdef __ICCARM__
-/* #define RT_USING_MINILIBC */
-/* #define RT_USING_NEWLIB */
-#endif
-
-#ifdef __GNUC__
-/* #define RT_USING_MINILIBC */
-#define RT_USING_NEWLIB
-#endif
+#define RT_USING_LIBC
/* SECTION: device filesystem */
/* #define RT_USING_DFS */
diff --git a/bsp/zynq7000/rtconfig.h b/bsp/zynq7000/rtconfig.h
index bc015321d0d..bf078f70456 100644
--- a/bsp/zynq7000/rtconfig.h
+++ b/bsp/zynq7000/rtconfig.h
@@ -103,8 +103,8 @@
//
//
-//
-#define RT_USING_NEWLIB
+//
+#define RT_USING_LIBC
//
#define RT_USING_PTHREADS
//
diff --git a/components/libc/SConscript b/components/libc/SConscript
index 19494ea7c21..799ecccb365 100644
--- a/components/libc/SConscript
+++ b/components/libc/SConscript
@@ -1,13 +1,18 @@
# for libc component
import os
-Import('RTT_ROOT')
+Import('rtconfig')
+
+from building import *
objs = []
-list = os.listdir(os.path.join(RTT_ROOT, 'components', 'libc'))
-for d in list:
- path = os.path.join(RTT_ROOT, 'components', 'libc', d)
- if os.path.isfile(os.path.join(path, 'SConscript')):
- objs = objs + SConscript(os.path.join(d, 'SConscript'))
+if GetDepend('RT_USING_LIBC'):
+ if rtconfig.PLATFORM == 'gcc':
+ objs = objs + SConscript('newlib/SConscript')
+ elif rtconfig.PLATFORM == 'armcc':
+ objs = objs + SConscript('armlibc/SConscript')
+else:
+ if rtconfig.PLATFORM == 'gcc':
+ objs = objs + SConscript('minilibc/SConscript')
Return('objs')
diff --git a/components/libc/armlibc/SConscript b/components/libc/armlibc/SConscript
index 11aba6b4f85..29f342a1c1f 100644
--- a/components/libc/armlibc/SConscript
+++ b/components/libc/armlibc/SConscript
@@ -1,16 +1,12 @@
-Import('rtconfig')
from building import *
-if GetDepend('RT_USING_ARM_LIBC') and rtconfig.CROSS_TOOL != 'keil':
- print '================ERROR=============================='
- print 'Please use ARM CC compiler if using ARM C library'
- print '==================================================='
- exit(0)
-
-cwd = GetCurrentDir()
src = Glob('*.c')
+cwd = GetCurrentDir()
+
CPPPATH = [cwd]
+CPPDEFINES = ['RT_USING_ARM_LIBC']
-group = DefineGroup('libc', src, depend = ['RT_USING_ARM_LIBC'], CPPPATH = CPPPATH)
+group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
+ CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')
diff --git a/components/libc/minilibc/SConscript b/components/libc/minilibc/SConscript
index 42f41a311dc..b0c82a71259 100644
--- a/components/libc/minilibc/SConscript
+++ b/components/libc/minilibc/SConscript
@@ -2,12 +2,12 @@ Import('RTT_ROOT')
from building import *
src = Glob('*.c')
-CPPPATH = [RTT_ROOT + '/components/libc/minilibc']
+cwd = GetCurrentDir()
+
+CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_MINILIBC']
-group = DefineGroup('minilibc', src,
- depend = ['RT_USING_MINILIBC'],
- CPPPATH = CPPPATH,
- CPPDEFINES = CPPDEFINES
- )
+
+group = DefineGroup('libc', src, depend = ['RT_USING_MINILIBC'],
+ CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')
diff --git a/components/libc/newlib/SConscript b/components/libc/newlib/SConscript
index ae8e8756e1f..574c2a8d1ff 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')