Skip to content

Commit a995264

Browse files
committed
Merge pull request #360 from BernardXiong/master
[LIBC] Use RT_USING_LIBC instead of libs option for each compiler
2 parents 3729264 + 692e597 commit a995264

File tree

8 files changed

+33
-50
lines changed

8 files changed

+33
-50
lines changed

bsp/at91sam9260/rtconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
/* SECTION: the runtime libc library */
6666
/* the runtime libc library */
67-
#define RT_USING_NEWLIB
67+
#define RT_USING_LIBC
6868
#define RT_USING_PTHREADS
6969

7070
/* Using Module System */

bsp/mini2440/rtconfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
// </section>
8888

8989
// <section name="LIBC" description="C Runtime library setting" default="always" >
90-
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" />
91-
#define RT_USING_NEWLIB
90+
// <bool name="RT_USING_LIBC" description="Using C library" default="true" />
91+
#define RT_USING_LIBC
9292
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
9393
#define RT_USING_PTHREADS
9494
// </section>

bsp/stm32f0x/rtconfig.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,7 @@
8787
#define FINSH_USING_DESCRIPTION
8888

8989
/* SECTION: libc management */
90-
#ifdef __CC_ARM
91-
/* #define RT_USING_MINILIBC */
92-
/* #define RT_USING_NEWLIB */
93-
#endif
94-
95-
#ifdef __ICCARM__
96-
/* #define RT_USING_MINILIBC */
97-
/* #define RT_USING_NEWLIB */
98-
#endif
99-
100-
#ifdef __GNUC__
101-
/* #define RT_USING_MINILIBC */
102-
#define RT_USING_NEWLIB
103-
#endif
90+
#define RT_USING_LIBC
10491

10592
/* SECTION: device filesystem */
10693
/* #define RT_USING_DFS */

bsp/zynq7000/rtconfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
// </section>
104104

105105
// <section name="LIBC" description="C Runtime library setting" default="always" >
106-
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" />
107-
#define RT_USING_NEWLIB
106+
// <bool name="RT_USING_LIBC" description="Using C library" default="true" />
107+
#define RT_USING_LIBC
108108
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
109109
#define RT_USING_PTHREADS
110110
// </section>

components/libc/SConscript

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# for libc component
22
import os
3-
Import('RTT_ROOT')
3+
Import('rtconfig')
4+
5+
from building import *
46

57
objs = []
6-
list = os.listdir(os.path.join(RTT_ROOT, 'components', 'libc'))
78

8-
for d in list:
9-
path = os.path.join(RTT_ROOT, 'components', 'libc', d)
10-
if os.path.isfile(os.path.join(path, 'SConscript')):
11-
objs = objs + SConscript(os.path.join(d, 'SConscript'))
9+
if GetDepend('RT_USING_LIBC'):
10+
if rtconfig.PLATFORM == 'gcc':
11+
objs = objs + SConscript('newlib/SConscript')
12+
elif rtconfig.PLATFORM == 'armcc':
13+
objs = objs + SConscript('armlibc/SConscript')
14+
else:
15+
if rtconfig.PLATFORM == 'gcc':
16+
objs = objs + SConscript('minilibc/SConscript')
1217

1318
Return('objs')

components/libc/armlibc/SConscript

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
Import('rtconfig')
21
from building import *
32

4-
if GetDepend('RT_USING_ARM_LIBC') and rtconfig.CROSS_TOOL != 'keil':
5-
print '================ERROR=============================='
6-
print 'Please use ARM CC compiler if using ARM C library'
7-
print '==================================================='
8-
exit(0)
9-
10-
cwd = GetCurrentDir()
113
src = Glob('*.c')
4+
cwd = GetCurrentDir()
5+
126
CPPPATH = [cwd]
7+
CPPDEFINES = ['RT_USING_ARM_LIBC']
138

14-
group = DefineGroup('libc', src, depend = ['RT_USING_ARM_LIBC'], CPPPATH = CPPPATH)
9+
group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
10+
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
1511

1612
Return('group')

components/libc/minilibc/SConscript

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ Import('RTT_ROOT')
22
from building import *
33

44
src = Glob('*.c')
5-
CPPPATH = [RTT_ROOT + '/components/libc/minilibc']
5+
cwd = GetCurrentDir()
6+
7+
CPPPATH = [cwd]
68
CPPDEFINES = ['RT_USING_MINILIBC']
7-
group = DefineGroup('minilibc', src,
8-
depend = ['RT_USING_MINILIBC'],
9-
CPPPATH = CPPPATH,
10-
CPPDEFINES = CPPDEFINES
11-
)
9+
10+
group = DefineGroup('libc', src, depend = ['RT_USING_MINILIBC'],
11+
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
1212

1313
Return('group')

components/libc/newlib/SConscript

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
Import('rtconfig')
21
from building import *
32

4-
if GetDepend('RT_USING_NEWLIB') and rtconfig.CROSS_TOOL != 'gcc':
5-
print '================ERROR============================'
6-
print 'Please use GNU GCC compiler if using newlib'
7-
print '================================================='
8-
exit(0)
9-
3+
src = Glob('*.c')
104
cwd = GetCurrentDir()
11-
src = Glob('*.c')
5+
126
CPPPATH = [cwd]
7+
CPPDEFINES = ['RT_USING_NEWLIB']
138

149
# link with libc and libm:
1510
# libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
1611
# recent GCC tool chains. The linker would just link in the functions that have
1712
# been referenced. So setting this won't result in bigger text size.
1813
LIBS = ['c', 'm']
1914

20-
group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'],
21-
CPPPATH = CPPPATH, LIBS = LIBS)
15+
group = DefineGroup('newlib', src, depend = ['RT_USING_LIBC'],
16+
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
2217

2318
Return('group')

0 commit comments

Comments
 (0)