提交 a9952648 编写于 作者: B Bernard Xiong

Merge pull request #360 from BernardXiong/master

[LIBC] Use RT_USING_LIBC instead of libs option for each compiler
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
/* SECTION: the runtime libc library */ /* SECTION: the runtime libc library */
/* the runtime libc library */ /* the runtime libc library */
#define RT_USING_NEWLIB #define RT_USING_LIBC
#define RT_USING_PTHREADS #define RT_USING_PTHREADS
/* Using Module System */ /* Using Module System */
......
...@@ -87,8 +87,8 @@ ...@@ -87,8 +87,8 @@
// </section> // </section>
// <section name="LIBC" description="C Runtime library setting" default="always" > // <section name="LIBC" description="C Runtime library setting" default="always" >
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" /> // <bool name="RT_USING_LIBC" description="Using C library" default="true" />
#define RT_USING_NEWLIB #define RT_USING_LIBC
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" /> // <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
#define RT_USING_PTHREADS #define RT_USING_PTHREADS
// </section> // </section>
......
...@@ -87,20 +87,7 @@ ...@@ -87,20 +87,7 @@
#define FINSH_USING_DESCRIPTION #define FINSH_USING_DESCRIPTION
/* SECTION: libc management */ /* SECTION: libc management */
#ifdef __CC_ARM #define RT_USING_LIBC
/* #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
/* SECTION: device filesystem */ /* SECTION: device filesystem */
/* #define RT_USING_DFS */ /* #define RT_USING_DFS */
......
...@@ -103,8 +103,8 @@ ...@@ -103,8 +103,8 @@
// </section> // </section>
// <section name="LIBC" description="C Runtime library setting" default="always" > // <section name="LIBC" description="C Runtime library setting" default="always" >
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" /> // <bool name="RT_USING_LIBC" description="Using C library" default="true" />
#define RT_USING_NEWLIB #define RT_USING_LIBC
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" /> // <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
#define RT_USING_PTHREADS #define RT_USING_PTHREADS
// </section> // </section>
......
# for libc component # for libc component
import os import os
Import('RTT_ROOT') Import('rtconfig')
from building import *
objs = [] objs = []
list = os.listdir(os.path.join(RTT_ROOT, 'components', 'libc'))
for d in list: if GetDepend('RT_USING_LIBC'):
path = os.path.join(RTT_ROOT, 'components', 'libc', d) if rtconfig.PLATFORM == 'gcc':
if os.path.isfile(os.path.join(path, 'SConscript')): objs = objs + SConscript('newlib/SConscript')
objs = objs + SConscript(os.path.join(d, 'SConscript')) elif rtconfig.PLATFORM == 'armcc':
objs = objs + SConscript('armlibc/SConscript')
else:
if rtconfig.PLATFORM == 'gcc':
objs = objs + SConscript('minilibc/SConscript')
Return('objs') Return('objs')
Import('rtconfig')
from building import * 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') src = Glob('*.c')
cwd = GetCurrentDir()
CPPPATH = [cwd] 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') Return('group')
...@@ -2,12 +2,12 @@ Import('RTT_ROOT') ...@@ -2,12 +2,12 @@ Import('RTT_ROOT')
from building import * from building import *
src = Glob('*.c') src = Glob('*.c')
CPPPATH = [RTT_ROOT + '/components/libc/minilibc'] cwd = GetCurrentDir()
CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_MINILIBC'] CPPDEFINES = ['RT_USING_MINILIBC']
group = DefineGroup('minilibc', src,
depend = ['RT_USING_MINILIBC'], group = DefineGroup('libc', src, depend = ['RT_USING_MINILIBC'],
CPPPATH = CPPPATH, CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
CPPDEFINES = CPPDEFINES
)
Return('group') Return('group')
Import('rtconfig')
from building import * from building import *
if GetDepend('RT_USING_NEWLIB') and rtconfig.CROSS_TOOL != 'gcc': src = Glob('*.c')
print '================ERROR============================'
print 'Please use GNU GCC compiler if using newlib'
print '================================================='
exit(0)
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd] CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_NEWLIB']
# link with libc and libm: # link with libc and libm:
# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in # libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
...@@ -17,7 +12,7 @@ CPPPATH = [cwd] ...@@ -17,7 +12,7 @@ CPPPATH = [cwd]
# been referenced. So setting this won't result in bigger text size. # been referenced. So setting this won't result in bigger text size.
LIBS = ['c', 'm'] LIBS = ['c', 'm']
group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'], group = DefineGroup('newlib', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, LIBS = LIBS) CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
Return('group') Return('group')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册