Asisi
Home
Copyright Robert Cragie 2004
Author | Date | Version |
Robert Cragie | 23 Mar 2004 | 0.3 Draft |
This document is a step-by-step guide to installing all the OpenCores tools for cross development for an OpenRISC OR1000 system.
Note: This has only been tested on a SuSE Linux 7.2 distribution with all appropriate developer tools installed. I cannot guarantee that this will work for other environments.
It is assumed that all commands are issued under a bash shell.
The following syntax indicates a command run as a normal user:
$ <command>
When the su command is shown as follows:
$ su
it is assumed that the correct superuser password will be entered at the prompt.
The following syntax indicates a command run as a superuser:
# <command>
It is often useful to capture the output of configuration and build runs. To do this, append the following to a configure or make command:
2>&1 | tee <logfile>
where <logfile> is the name of the file you wish to capture the output to.
Create the or1k-cvs directory and change to it:
$ cd ~
$ mkdir or1k-cvs; cd or1k-cvs
This will be the root directory for all the OpenCores source code and building.
Set up the environment variable for CVS and login:
$ export
CVSROOT=:pserver:anonymous@cvs.opencores.org:/cvsroot/anonymous
$ cvs login
When asked for the password, just press return. Now get the sources:
$ cvs -z9 co or1k/binutils
$ cvs -z9 co or1k/gcc-3.2.3
$ cvs -z9 co or1k/gdb-5.3
$ cvs -z9 co or1k/ecos-2.0
Make sure you are in the or1k directory:
$ cd ~/or1k-cvs/or1k
You can get newlib 1.11.0 here.
Unzip it:
$ tar xvzf newlib-1.11.0.tar.gz
As newlib is compiled as part of the GCC build, you need to move it into the GCC directory:
$ mv newlib-1.11.0/newlib gcc-3.2.3
$ mv newlib-1.11.0/libgloss gcc-3.2.3
These are necessary for code checked out around 04 Mar 2004.
This patch, (submitted by Heiko Panther) sorts out the targets correctly for OR32 GCC 3.2.3 and is necessary for the eCos build
This patch, corrects problems building gdb-5.3 using GCC 2.95.3. The file it patches also needs to be stripped of carriage returns (^M), so I am using perl -pe 's/\r\n/\n/' -i <file> to do this
$ patch -p0 < or32-gcc-3.2.3-target.patch
$ perl -pe 's/\r\n/\n/' -i gdb-5.3/gdb/or1k-tdep.c
$ patch -p0 < or32-gdb-5.3-or1k-tdep.c.patch
It is important to build everything strictly in the specified order.
Change to OR1K sources top level:
$ cd ~/or1k-cvs/or1k
Login as superuser to do all the building and installing:
$ su
First, make a build directory and change to it:
# mkdir b-b; cd b-b
Configure and build it:
# ../binutils/configure --target=or32-elf --prefix=/opt/or32-elf \
-v 2>&1 | tee configure.out
# make -w all install 2>&1 | tee make.out
You have to add the binaries you have just built to your path for GCC building:
# export PATH=/opt/or32-elf/bin:$PATH
Finally go up a directory:
# cd ..
First, make a build directory and change to it:
# mkdir b-gcc; cd b-gcc
Configure and build it:
# ../gcc-3.2.3/configure --target=or32-elf --prefix=/opt/or32-elf \
--enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib \
--with-gxx-include-dir=/opt/or32-elf/or32-elf/include \
-v 2>&1 | tee configure.out
# make -w all install 2>&1 | tee make.out
Finally go up a directory:
# cd ..
First, make a build directory and change to it:
# mkdir b-gdb; cd b-gdb
Configure and build it. Current version of readline has a configuration bug, so you must not specify the installation prefix while configuring the package and you have to copy the executable manually:
# ../gdb-5.3/configure --target=or32-elf
# make all
# cp gdb/gdb /opt/or32-elf/bin/or32-elf-gdb
Finally go up a directory:
# cd ..
Exit superuser:
# exit
You don't actually need to do this as the tools come prebuilt with the OpenCores eCos distribution. However, running of the command line configuration tool assumes the existence of libtcl.a and libtcl.so. These are not present, so links have to be created:
$ su
# ln -s /usr/lib/libtcl8.3.a /usr/lib/libtcl.a
# ln -s /usr/lib/libtcl8.3.so /usr/lib/libtcl.so
# exit
The tools will be in ~/or1k-cvs/or1k/ecos-2.0/tools/bin. Copy these to /usr/local/bin, which is in the default path:
$ cd ~
$ su
# cp or1k-cvs/or1k/ecos-2.0/tools/bin/ecosconfig /usr/local/bin
# cp or1k-cvs/or1k/ecos-2.0/tools/bin/configtool /usr/local/bin
# exit
You need to ensure that all executables built are in your PATH environment variable and you also need to set up the ECOS_REPOSITORY environment variable. This would be best done in your .bashrc file which resides in your home directory(~)
$ export PATH=/opt/or32-elf/bin:$PATH
$ export ECOS_REPOSITORY=$HOME/or1k-cvs/or1k/ecos-2.0/packages
Now logout and log back in again for these to take effect.