1. build the toolchain and gdb mips simulator
TARGET=mips-tx39-elf # Target processor
GNUTOOLS=$HOME/newlib/gnutools # Directory for final tools
SRC=$HOME/newlib # Directory for source
BUILD=$HOME/newlib/build # Directory for intermediate build files
BINUTILS=binutils-2.15
GCC=gcc-3.4.1
NEWLIB=newlib-1.12.0
GDB=gdb-6.0
export PATH="$GNUTOOLS/bin:$PATH"
GNUCONFIG="--target=$TARGET --prefix=$GNUTOOLS"
GCCFLAGS="--with-newlib --with-gnu-as --with-gnu-ld"
mkdir -p $SRC $BUILD/binutils $BUILD/gcc $BUILD/newlib $GNUTOOLS
build mips tx39 toolchain as below:
cd $SRC
tar jxvf $BINUTILS.tar.bz2
tar jxvf $GCC.tar.bz2
tar xvfz $NEWLIB.tar.gz
tar zxvf $GDB.tar.gz
cd $BUILD/binutils && rm -rf *
$SRC/$BINUTILS/configure $GNUCONFIG
make all install
cd $BUILD/gcc && rm -rf *
$SRC/$GCC/configure $GNUCONFIG $GCCFLAGS --without-headers --enable-languages=c
make all install
cd $BUILD/newlib && rm -rf *
$SRC/$NEWLIB/configure $GNUCONFIG
make all install
cd $BUILD/gcc && rm -rf *
$SRC/$GCC/configure $GNUCONFIG $GCCFLAGS --with-headers=$GNUTOOLS/$TARGET/include --enable-languages=c,c++
make all install
cd $BUILD/gdb && rm -rf *
$SRC/$GDB/configure --target=mipstx39-rtems --prefix=$GNUTOOLS
make all install
2.edit test.c and build
mips-tx39-elf-gcc -o testmips test.c -T./jmr3904app.ld
3./home/acer/newlib/gnutools_mips_rtems/bin/mipstx39-rtems-gdb testmips
target sim --board=jmr3904
load
run