From 087c06673508785d83f479aa32b1116608f61a96 Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Thu, 25 Nov 2010 23:36:54 +0000 Subject: [PATCH] add some newlib leaked function. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1116 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/dev3210/SConscript | 3 +++ bsp/dev3210/SConstruct | 2 ++ bsp/dev3210/newlib_stub.c | 32 ++++++++++++++++++++++++++++++++ bsp/dev3210/rtconfig.h | 8 +++++++- bsp/dev3210/rtconfig.py | 2 +- 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 bsp/dev3210/newlib_stub.c diff --git a/bsp/dev3210/SConscript b/bsp/dev3210/SConscript index fb50794533..a255a06b5a 100644 --- a/bsp/dev3210/SConscript +++ b/bsp/dev3210/SConscript @@ -2,6 +2,9 @@ Import('RTT_ROOT') from building import * 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 = File(src_bsp + src_drv) CPPPATH = [RTT_ROOT + '/bsp/dev3210'] diff --git a/bsp/dev3210/SConstruct b/bsp/dev3210/SConstruct index 061f726069..c5288c33a1 100644 --- a/bsp/dev3210/SConstruct +++ b/bsp/dev3210/SConstruct @@ -20,6 +20,8 @@ Export('rtconfig') # prepare building environment objs = PrepareBuilding(env, RTT_ROOT) +# libc testsuite +objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0) # build program env.Program(TARGET, objs) diff --git a/bsp/dev3210/newlib_stub.c b/bsp/dev3210/newlib_stub.c new file mode 100644 index 0000000000..0ac10667fc --- /dev/null +++ b/bsp/dev3210/newlib_stub.c @@ -0,0 +1,32 @@ +#include + +#include +#include +#include + +/* 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; +} diff --git a/bsp/dev3210/rtconfig.h b/bsp/dev3210/rtconfig.h index 4df6acb53d..9b507d266b 100644 --- a/bsp/dev3210/rtconfig.h +++ b/bsp/dev3210/rtconfig.h @@ -66,6 +66,11 @@ #define RT_USING_CONSOLE #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 */ /* Using FinSH as Shell*/ #define RT_USING_FINSH @@ -75,8 +80,9 @@ #define FINSH_DEVICE_NAME "uart" /* SECTION: device filesystem support */ -/* #define RT_USING_DFS */ +#define RT_USING_DFS #define RT_USING_DFS_ELMFAT +#define RT_USING_DFS_ROMFS /* the max number of mounted filesystem */ #define DFS_FILESYSTEMS_MAX 2 diff --git a/bsp/dev3210/rtconfig.py b/bsp/dev3210/rtconfig.py index 0a582912d1..07f52db140 100644 --- a/bsp/dev3210/rtconfig.py +++ b/bsp/dev3210/rtconfig.py @@ -20,7 +20,7 @@ OBJCPY = PREFIX + 'objcopy' READELF = PREFIX + 'readelf' 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' LFLAGS = DEVICE + ' -EL -Wl,--gc-sections,-Map=rtthread-3210.map,-cref,-u,Reset_Handler -T dev3210_ram.lds'