Browse Source

add some newlib leaked function.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1116 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong@gmail.com 14 years ago
parent
commit
087c066735
5 changed files with 45 additions and 2 deletions
  1. 3 0
      bsp/dev3210/SConscript
  2. 2 0
      bsp/dev3210/SConstruct
  3. 32 0
      bsp/dev3210/newlib_stub.c
  4. 7 1
      bsp/dev3210/rtconfig.h
  5. 1 1
      bsp/dev3210/rtconfig.py

+ 3 - 0
bsp/dev3210/SConscript

@@ -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']

+ 2 - 0
bsp/dev3210/SConstruct

@@ -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 - 0
bsp/dev3210/newlib_stub.c

@@ -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;
+}

+ 7 - 1
bsp/dev3210/rtconfig.h

@@ -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

+ 1 - 1
bsp/dev3210/rtconfig.py

@@ -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'