[En-Nut-Discussion] linux build fixes and namespace clash work-arounds.

Theodore A. Roth troth at openavr.org
Tue Aug 12 01:06:12 CEST 2003


Hi,

The attached patch gets the latest cvs to build on linux and works
around some namespace clashes with avr-libc.

gcc-3.3.1, binutils-cvs-head, avr-libc-cvs-head

Ted Roth
-------------- next part --------------
2003-08-11  Theodore A. Roth  <troth at openavr.org>

Fix compile on linux:
	* Makefile (all): Add $(MAKE_CRUROM) command.
	* configure (UserConf.mk): Fix BURNFLAGS and CRUROM.
	Add output for MAKE_CRUROM.

Fix clashes with current avr-libc:
	* app/httpd/httpserv.c (ShowForm): Avoid strtok_r clash with avr-libc.
	* crt/strtok_r.c: Avoid strtok_r clash with avr-libc.
	* include/strtok_r.h: Avoid strtok_r clash with avr-libc.
	* os/nutinit.c: Avoid XRAMEND clash with avr-libc.

Index: Makefile
===================================================================
RCS file: /cvsroot/ethernut/nut/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile	9 May 2003 14:40:23 -0000	1.1.1.1
+++ Makefile	11 Aug 2003 22:48:31 -0000
@@ -87,6 +87,7 @@ all:
 	$(MAKE) -C net
 	$(MAKE) -C pro
 	$(MAKE) -C crt
+	$(MAKE_CRUROM)
 
 install:
 	$(MAKE) -C os install
Index: configure
===================================================================
RCS file: /cvsroot/ethernut/nut/configure,v
retrieving revision 1.1
diff -u -p -r1.1 configure
--- configure	10 May 2003 17:08:17 -0000	1.1
+++ configure	11 Aug 2003 22:48:32 -0000
@@ -77,8 +77,9 @@ done
 cat <<EOF > UserConf.mk
 MCU=$DEV
 BURN=uisp
-BURNFLAGS=-dprog=$UISP_PROG --erase --upload --verify -if\$(TARG)
-CRUROM = \$(top_srcdir)/tools/linux/crurom
+BURNFLAGS=-dprog=$UISP_PROG --erase --upload --verify -if=\$(TARG)
+CRUROM = \$(top_srcdir)/tools/crurom/crurom
+MAKE_CRUROM = \$(MAKE) -C \$(top_srcdir)/tools/crurom
 EOF
 
 echo "Your system is now configured to build for $DEV."
Index: app/httpd/httpserv.c
===================================================================
RCS file: /cvsroot/ethernut/nut/app/httpd/httpserv.c,v
retrieving revision 1.2
diff -u -p -r1.2 httpserv.c
--- app/httpd/httpserv.c	7 Aug 2003 08:27:58 -0000	1.2
+++ app/httpd/httpserv.c	11 Aug 2003 22:48:34 -0000
@@ -383,8 +383,8 @@ int ShowForm(FILE * stream, REQUEST * re
         /* Extract 3 parameters. */
         qp = req->req_query;
         for (i = 0; i < 3; i++) {
-            c[i] = strtok_r(&qp, "=");
-            p[i] = strtok_r(&qp, "&");
+            c[i] = PS_strtok_r(&qp, "=");
+            p[i] = PS_strtok_r(&qp, "&");
         }
 
         /* Send the parameters back to the client. */
Index: crt/strtok_r.c
===================================================================
RCS file: /cvsroot/ethernut/nut/crt/strtok_r.c,v
retrieving revision 1.2
diff -u -p -r1.2 strtok_r.c
--- crt/strtok_r.c	20 Jul 2003 16:02:32 -0000	1.2
+++ crt/strtok_r.c	11 Aug 2003 22:48:48 -0000
@@ -163,7 +163,7 @@ char *strsep_r(char **pp_str, const char
  * stored in *str. The first character not a delimiter character from the original 
  * value of *str is returned.
  */
-char *strtok_r(char **pp_str, const char *p_delim)
+char *PS_strtok_r(char **pp_str, const char *p_delim)
 {
     register const char *sp;
     char *p_ch;
Index: include/strtok_r.h
===================================================================
RCS file: /cvsroot/ethernut/nut/include/strtok_r.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 strtok_r.h
--- include/strtok_r.h	9 May 2003 14:41:03 -0000	1.1.1.1
+++ include/strtok_r.h	11 Aug 2003 22:48:49 -0000
@@ -8,7 +8,7 @@
 //                                                                          //
 //--------------------------------------------------------------------------//
 
-char * strtok_r(  char ** pp_str, const char * p_delim );
+char * PS_strtok_r(  char ** pp_str, const char * p_delim );
 char * strsep_r(  char ** pp_str, const char * p_delim );
 char * strsep_rs( char ** pp_str, const char * p_delim, char * p_term );
 
Index: os/nutinit.c
===================================================================
RCS file: /cvsroot/ethernut/nut/os/nutinit.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 nutinit.c
--- os/nutinit.c	9 May 2003 14:41:51 -0000	1.1.1.1
+++ os/nutinit.c	11 Aug 2003 22:48:50 -0000
@@ -57,6 +57,7 @@
 
 #include <sys/confos.h>
 
+#undef XRAMEND
 #define XRAMEND ((volatile u_char *)0x7FFF)
 
 #ifdef __GNUC__


More information about the En-Nut-Discussion mailing list