Howto for cross-compiling gcc 2.95.1 under Solaris 2.6 for VxWork s PowerPC 603e target
Wooldridge, Philip J (Philip)
pjwooldridge@lucent.com
Mon Jan 13 05:17:00 GMT 2003
With help from various email archives I succeeded in generating a PowerPC cross compiler for VxWorks based on Tornado 2 from Wind River. I though it might be useful to publish a 'howto':
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Prerequisites:
--------------
I used the following additional gnu tools:
make version 3.8 (Simple ../configure [--prefix=...])
binutils (2.13.2) (see 'Compiling binutils, below)
Native gcc installation, version 3.2 (Simple ../configure [--prefix=...], make, make install)
Existing VxWorks installation pointed to by WIND_BASE environment variable.
PATH set up to include the resultant bin directory first.
With these installed, gcc-2.95.1.tar.gz was untarred into its default directory gcc-2.95.1, referred to from now on as 'srcdir'.
A directory, objppc, was created under 'srcdir' and the following configure line was used from within objppc.
The target directory, defined by --prefix in the configure line, will be referred to as 'tgtdir'.
../configure --host=sparc-sun-solaris2.6 --target=powerpc-wrs-vxworks --prefix=$HOME/gnu --with-cpu=603e --enable-languages=c,c++ --with-headers=$WIND_BASE/target/h
The following changes can be made to files in the installation (diff -c output, + denotes new lines, ! denotes changed line) prior to running make:
-------------------------------------------------------------------------------------
libchill/fileio.h: Defined R_OK, W_OK
-----------------
#define TEST_FLAG(Xloc,Flag) (((Xloc)->flags) & (Flag))
#define SET_FLAG(Xloc,Flag) (Xloc)->flags |= (Flag)
#define CLR_FLAG(Xloc,Flag) (Xloc)->flags = ((Xloc)->flags & ~(Flag))
+ #define R_OK 4
+ #define W_OK 8
Boolean
__isassociated( Association_Mode* the_assoc, char* file, int line );
------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
libchill/basicio.c: Fixed open by adding final mode (0666) parameter in two places.
-------------------
if( TEST_FLAG( the_access, IO_INDEXED ) )
{
! if( (the_assoc->handle = open( the_assoc->pathname, DirMode[the_usage] , 0666)) == -1 )
CHILLEXCEPTION( file, line, CONNECTFAIL, OPEN_FAILS );
/* Set base index. */
--- 365,371 ----
if( TEST_FLAG( the_access, IO_INDEXED ) )
{
! if( (the_assoc->handle = open( the_assoc->pathname, DirMode[the_usage] )) == -1 )
CHILLEXCEPTION( file, line, CONNECTFAIL, OPEN_FAILS );
/* Set base index. */
***************
*** 407,413 ****
CHILLEXCEPTION( file, line, CONNECTFAIL, BUFFER_ALLOC );
memset (the_assoc->bufptr, 0, sizeof (readbuf_t));
}
! if( (the_assoc->handle = open( the_assoc->pathname, SeqMode[the_usage], 0666 )) == -1 )
CHILLEXCEPTION( file, line, CONNECTFAIL, OPEN_FAILS );
/* Set base index. */
--- 407,413 ----
CHILLEXCEPTION( file, line, CONNECTFAIL, BUFFER_ALLOC );
memset (the_assoc->bufptr, 0, sizeof (readbuf_t));
}
! if( (the_assoc->handle = open( the_assoc->pathname, SeqMode[the_usage] )) == -1 )
CHILLEXCEPTION( file, line, CONNECTFAIL, OPEN_FAILS );
/* Set base index. */
------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
libf2c/libU77/datetime_.c: #undef HAVE_GETTIMEOFDAY, HAVE_TIMES and HAVE_GETRUSAGE
--------------------------
# include <time.h>
# endif
#endif
+ #ifdef __vxworks
+ #undef HAVE_GETTIMEOFDAY
+ #undef HAVE_TIMES
+ #undef HAVE_GETRUSAGE
+ #endif
#include "f2c.h"
#ifdef KR_headers
------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
libf2c/libU77/dtime_.c: #undef HAVE_GETTIMEOFDAY, HAVE_TIMES and HAVE_GETRUSAGE
-----------------------
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
+ #ifdef __vxworks
+ #undef HAVE_GETTIMEOFDAY
+ #undef HAVE_GETRUSAGE
+ #undef HAVE_TIMES
+ #endif
#if HAVE_GETRUSAGE
# include <sys/time.h>
# include <sys/resource.h>
------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
libf2c/libU77/etime_.c: #undef HAVE_GETTIMEOFDAY, HAVE_TIMES and HAVE_GETRUSAGE
-----------------------
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
+ #ifdef __vxworks
+ #undef HAVE_GETTIMEOFDAY
+ #undef HAVE_GETRUSAGE
+ #undef HAVE_TIMES
+ #endif
#if HAVE_GETRUSAGE
# include <sys/time.h>
# include <sys/resource.h>
------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
libf2c/libU77/sys_clock_.c: #undef HAVE_GETTIMEOFDAY, HAVE_TIMES and HAVE_GETRUSAGE
---------------------------
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+ #ifdef __vxworks /* PJW hack */
+ #undef HAVE_GETTIMEOFDAY
+ #undef HAVE_TIMES
+ #undef HAVE_GETRUSAGE
+ #endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
libio/gen-params: Changed HAVE_PRINTF_FP and HAVE_LONG_DOUBLE_IO to 0
-----------------
if ${CC} dummy.c >/dev/null 2>&1 ; then
! echo "#define ${macro_prefix}HAVE_PRINTF_FP 0"
! echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 0"
else
echo "#define ${macro_prefix}HAVE_PRINTF_FP 0"
echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 0"
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
tgtdir/powerpc-wrs-vxworks/sys-include/sys/stat.h: included vxWorks.h
-----------------
extern "C" {
#endif
+ #include "vxWorks.h"
+
#if ((CPU_FAMILY==I960) && (defined __GNUC__))
#pragma align 1 /* tell gcc960 not to optimize alignments */
#endif /* CPU_FAMILY==I960 */
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
libio/gen-params: Changed HAVE_PRINTF_FP and HAVE_LONG_DOUBLE_IO to 0
-----------------
if ${CC} dummy.c >/dev/null 2>&1 ; then
! echo "#define ${macro_prefix}HAVE_PRINTF_FP 0"
! echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 0"
else
echo "#define ${macro_prefix}HAVE_PRINTF_FP 0"
echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 0"
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
tgtdir/powerpc-wrs-vxworks/sys-include/types/vxArch.h: Undef'd _BIG/LITTLE_ENDIAN -----------------------------------------------------
#endif
#define WV_INSTRUMENTATION
+ #ifdef _BIG_ENDIAN
+ #undef _BIG_ENDIAN
+ #endif
+ #ifdef _LITTLE_ENDIAN
+ #undef _LITTLE_ENDIAN
+ #endif
#define _BIG_ENDIAN 1234
#define _LITTLE_ENDIAN 4321
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
tgtdir/powerpc-wrs-vxworks/sys-include/arch/ppc/toolPpc.h: Add stdarg.h ---------------------------------------------------------
#endif
#if !defined(_DIAB_TOOL) && !defined(_GREEN_TOOL) && !defined(_GNU_TOOL)
- #include <stdarg.h> /* added by PJW */
#define _GNU_TOOL
#endif
------------------------------------------------------------------------------------
Touch the following files:
tgtdir/powerpc-wrs-vxworks/sys-include/strings.h
tgtdir/powerpc-wrs-vxworks/sys-include/sys/time.h
tgtdir/powerpc-wrs-vxworks/sys-include/sys/param.h
Then run make.
If successful, run make install.
Installation of binutils:
-------------------------
Untar into 'srcdir' (binutils-2.13.2)
cd 'srcdir'
Verify that a directory for Gnu make is included at the front of the PATH.
Run the following configure line, where prefix directory can be changed to suit the installation
configure --host=sparc-sun-solaris2.6 --target=powerpc-wrs-vxworks -prefix=$HOME/gnu --with-cpu=603e.
Run make followed by make install.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
---
Phil Wooldridge
More information about the Gcc-bugs
mailing list