From f32bd593c426755a140556ed1b5230447e5da726 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 22 Jun 2010 18:34:03 +0000 Subject: [PATCH] Add an advanced build option to force compiling and linking our reduced C library (probably useful for the sim). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27059 a1c6a512-1295-4272-9138-f99709370657 --- firmware/SOURCES | 33 ++++++++++++++++++++++----------- firmware/libc/memchr.c | 1 + firmware/libc/memcmp.c | 2 +- firmware/libc/memcpy.c | 2 +- firmware/libc/strchr.c | 1 + firmware/libc/strcmp.c | 1 + firmware/libc/strcpy.c | 1 + firmware/libc/strlen.c | 2 +- firmware/libc/strncmp.c | 1 + firmware/libc/strrchr.c | 1 + tools/configure | 9 +++++++-- 11 files changed, 38 insertions(+), 16 deletions(-) diff --git a/firmware/SOURCES b/firmware/SOURCES index bef2b772ad..53c38e0ee9 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -46,22 +46,41 @@ libc/strtok.c /* alsa on linux requires a more advanced sprintf, i.e. not ours */ libc/sprintf.c #endif /* PLATFORM_NATIVE || __MINGW32__ || __CYGWIN__ */ -#if (CONFIG_PLATFORM & PLATFORM_NATIVE) +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(HAVE_ROCKBOX_C_LIBRARY) libc/atoi.c + +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) +/* our ctype.[ch] comes from newlib and is incompitble with most desktop's ctype */ libc/ctype.c -libc/memcmp.c +#endif + libc/memchr.c +libc/memcmp.c + +#if !defined(CPU_SH) && !defined(CPU_COLDFIRE) && !defined(CPU_ARM) +#if !defined(CPU_MIPS) +libc/memcpy.c +libc/memset.c +#endif /* CPU_MIPS */ +libc/memmove.c +#endif /* CPU_* */ + libc/qsort.c libc/random.c libc/strcat.c libc/strchr.c libc/strcmp.c libc/strcpy.c + +#if !defined(CPU_SH) && !defined(CPU_COLDFIRE) +libc/strlen.c +#endif + libc/strncmp.c libc/strrchr.c libc/strstr.c libc/mktime.c -#endif /* !defined(SIMULATOR)*/ +#endif /* CONFIG_PLATFORM || HAVE_ROCKBOX_C_LIBRARY */ /* Common */ common/version.c @@ -414,7 +433,6 @@ target/coldfire/i2c-coldfire.c target/arm/support-arm.S target/arm/memcpy-arm.S target/arm/memmove-arm.S -libc/strlen.c #ifndef SIMULATOR target/arm/memset-arm.S target/arm/memset16-arm.S @@ -509,10 +527,7 @@ target/arm/crt0.S #elif defined(CPU_MIPS) #undef mips -/*target/mips/strlen.S*/ -libc/memmove.c common/memset16.c -libc/strlen.c target/mips/ffs-mips.S target/mips/memcpy-mips.S target/mips/memset-mips.S @@ -526,11 +541,7 @@ target/mips/ingenic_jz47xx/crt0.S #ifdef HAVE_PRIORITY_SCHEDULING common/ffs.c #endif -libc/memcpy.c -libc/memmove.c -libc/memset.c common/memset16.c -libc/strlen.c #if (CONFIG_PLATFORM & PLATFORM_NATIVE) crt0.S drivers/i2c.c diff --git a/firmware/libc/memchr.c b/firmware/libc/memchr.c index 26bdb9eea3..8b6b4d69d9 100644 --- a/firmware/libc/memchr.c +++ b/firmware/libc/memchr.c @@ -35,6 +35,7 @@ QUICKREF #include #include +#include "_ansi.h" /* for _DEFUN */ /* Nonzero if X is not aligned on a "long" boundary. */ #define UNALIGNED(X) ((long)X & (sizeof (long) - 1)) diff --git a/firmware/libc/memcmp.c b/firmware/libc/memcmp.c index 1535fcf5b5..c2fa1bf6b7 100644 --- a/firmware/libc/memcmp.c +++ b/firmware/libc/memcmp.c @@ -37,7 +37,7 @@ QUICKREF */ #include - +#include "_ansi.h" /* for _DEFUN */ /* Nonzero if either X or Y is not aligned on a "long" boundary. */ #define UNALIGNED(X, Y) \ diff --git a/firmware/libc/memcpy.c b/firmware/libc/memcpy.c index a89ac3c557..c5456ab41f 100644 --- a/firmware/libc/memcpy.c +++ b/firmware/libc/memcpy.c @@ -33,7 +33,7 @@ QUICKREF */ #include "config.h" -#include <_ansi.h> +#include "_ansi.h" /* for _DEFUN */ #include /* Nonzero if either X or Y is not aligned on a "long" boundary. */ diff --git a/firmware/libc/strchr.c b/firmware/libc/strchr.c index 96acf5edf6..ada6e2d098 100644 --- a/firmware/libc/strchr.c +++ b/firmware/libc/strchr.c @@ -35,6 +35,7 @@ QUICKREF #include #include +#include "_ansi.h" /* for _DEFUN */ /* Nonzero if X is not aligned on a "long" boundary. */ #define UNALIGNED(X) ((long)X & (sizeof (long) - 1)) diff --git a/firmware/libc/strcmp.c b/firmware/libc/strcmp.c index bbbf4b174a..d540fae7dd 100644 --- a/firmware/libc/strcmp.c +++ b/firmware/libc/strcmp.c @@ -37,6 +37,7 @@ QUICKREF #include #include +#include "_ansi.h" /* for _DEFUN */ /* Nonzero if either X or Y is not aligned on a "long" boundary. */ #define UNALIGNED(X, Y) \ diff --git a/firmware/libc/strcpy.c b/firmware/libc/strcpy.c index 077ae73cc6..035e2bda9e 100644 --- a/firmware/libc/strcpy.c +++ b/firmware/libc/strcpy.c @@ -34,6 +34,7 @@ QUICKREF #include #include +#include "_ansi.h" /* for _DEFUN */ /*SUPPRESS 560*/ /*SUPPRESS 530*/ diff --git a/firmware/libc/strlen.c b/firmware/libc/strlen.c index 4d33eafce6..649df6764b 100644 --- a/firmware/libc/strlen.c +++ b/firmware/libc/strlen.c @@ -32,7 +32,7 @@ QUICKREF */ #include "config.h" -#include <_ansi.h> +#include "_ansi.h" #include #include diff --git a/firmware/libc/strncmp.c b/firmware/libc/strncmp.c index b1d8d9d43a..315fae810a 100644 --- a/firmware/libc/strncmp.c +++ b/firmware/libc/strncmp.c @@ -38,6 +38,7 @@ QUICKREF #include #include +#include "_ansi.h" /* for _DEFUN */ /* Nonzero if either X or Y is not aligned on a "long" boundary. */ #define UNALIGNED(X, Y) \ diff --git a/firmware/libc/strrchr.c b/firmware/libc/strrchr.c index 31b0d049b3..0489edd499 100644 --- a/firmware/libc/strrchr.c +++ b/firmware/libc/strrchr.c @@ -34,6 +34,7 @@ QUICKREF */ #include +#include "_ansi.h" /* for _DEFUN */ char * _DEFUN (strrchr, (s, i), diff --git a/tools/configure b/tools/configure index 9f5b5cfdb4..277436d716 100755 --- a/tools/configure +++ b/tools/configure @@ -383,8 +383,9 @@ whichadvanced () { else interact=1 echo "" - echo "Enter your developer options (press enter when done)" - printf "(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile, (T)est plugins" + printf "Enter your developer options (press only enter when done)\n\ +(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile,\n\ +(T)est plugins, S(m)all C lib:" if [ "$memory" = "2" ]; then printf ", (8)MB MOD" fi @@ -425,6 +426,10 @@ whichadvanced () { echo "logf() support enabled" logf="yes" ;; + [Mm]) + echo "Using Rockbox' small C library" + extradefines="$extradefines -DHAVE_ROCKBOX_C_LIBRARY" + ;; [Tt]) echo "Including test plugins" extradefines="$extradefines -DHAVE_TEST_PLUGINS"