add some newlib leaked function.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1116 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2010-11-25 23:36:54 +00:00
parent 872a503a9c
commit 087c066735
5 changed files with 45 additions and 2 deletions

View File

@ -2,6 +2,9 @@ Import('RTT_ROOT')
from building import * from building import *
src_bsp = ['application.c', 'startup.c', 'board.c'] src_bsp = ['application.c', 'startup.c', 'board.c']
if GetDepend('RT_USING_NEWLIB'):
src_bsp = src_bsp + ['newlib_stub.c']
src_drv = ['uart.c', 'lnn800x480.c'] src_drv = ['uart.c', 'lnn800x480.c']
src = File(src_bsp + src_drv) src = File(src_bsp + src_drv)
CPPPATH = [RTT_ROOT + '/bsp/dev3210'] CPPPATH = [RTT_ROOT + '/bsp/dev3210']

View File

@ -20,6 +20,8 @@ Export('rtconfig')
# prepare building environment # prepare building environment
objs = PrepareBuilding(env, RTT_ROOT) objs = PrepareBuilding(env, RTT_ROOT)
# libc testsuite
objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
# build program # build program
env.Program(TARGET, objs) env.Program(TARGET, objs)

32
bsp/dev3210/newlib_stub.c Normal file
View File

@ -0,0 +1,32 @@
#include <rtthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
/* some newlib leaked function in CodeSourcery G++ Lite for MIPS version */
int
getpid()
{
return 0;
}
int
gettimeofday(struct timeval *__tp, void *__tzp)
{
struct timespec tp;
if (libc_get_time(&tp) == 0)
{
if (__tp != RT_NULL)
{
__tp->tv_sec = tp.tv_sec;
__tp->tv_usec = tp.tv_nsec * 1000UL;
}
return tp.tv_sec;
}
return 0;
}

View File

@ -66,6 +66,11 @@
#define RT_USING_CONSOLE #define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLEBUF_SIZE 128
/* SECTION: the runtime libc library */
/* the runtime libc library */
#define RT_USING_NEWLIB
#define RT_USING_PTHREADS
/* SECTION: finsh, a C-Express shell */ /* SECTION: finsh, a C-Express shell */
/* Using FinSH as Shell*/ /* Using FinSH as Shell*/
#define RT_USING_FINSH #define RT_USING_FINSH
@ -75,8 +80,9 @@
#define FINSH_DEVICE_NAME "uart" #define FINSH_DEVICE_NAME "uart"
/* SECTION: device filesystem support */ /* SECTION: device filesystem support */
/* #define RT_USING_DFS */ #define RT_USING_DFS
#define RT_USING_DFS_ELMFAT #define RT_USING_DFS_ELMFAT
#define RT_USING_DFS_ROMFS
/* the max number of mounted filesystem */ /* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 2 #define DFS_FILESYSTEMS_MAX 2

View File

@ -20,7 +20,7 @@ OBJCPY = PREFIX + 'objcopy'
READELF = PREFIX + 'readelf' READELF = PREFIX + 'readelf'
DEVICE = ' -mips2' DEVICE = ' -mips2'
CFLAGS = DEVICE + ' -EL -G0 -DRT_USING_MINILIBC -mno-abicalls -fno-pic -fno-builtin -fno-exceptions -ffunction-sections -fomit-frame-pointer' CFLAGS = DEVICE + ' -EL -G0 -mno-abicalls -fno-pic -fno-builtin -fno-exceptions -ffunction-sections -fomit-frame-pointer'
AFLAGS = ' -c' + DEVICE + ' -EL -fno-pic -fno-builtin -mno-abicalls -x assembler-with-cpp' AFLAGS = ' -c' + DEVICE + ' -EL -fno-pic -fno-builtin -mno-abicalls -x assembler-with-cpp'
LFLAGS = DEVICE + ' -EL -Wl,--gc-sections,-Map=rtthread-3210.map,-cref,-u,Reset_Handler -T dev3210_ram.lds' LFLAGS = DEVICE + ' -EL -Wl,--gc-sections,-Map=rtthread-3210.map,-cref,-u,Reset_Handler -T dev3210_ram.lds'