Saturday, June 24, 2006


1. Download SimpleScalar Tool Set
These can be found on the SimpleScalar website,

Need the following files before installing:


They can be found at the following locations:

simplesim & simpletools:

2. Untar the source code

Untar the source code into a simplesim directory

mkdir (chosen installation directory) (wherever you want to put can name it whatever)
tar xzvf (the z flag unzips a gzip file as well as untars it....
if you have straight tar files then use tar xvf )

In simpetools-2v0.tgz, there is a gcc-2.6.3 compiler. Since we don't need this, delete it.

rm -rf gcc-2.6.3

3. Install

(在Suse10.1的安裝光碟理好像沒有這個檔案,我是從Fedora Core5的光碟借來用的)
Check gcc version by entering "gcc -v". GCC 4.x will cause "invalid lvalue in increment" error
while installing gcc.
GCC 3.2 are included with the Fedora Core 4 installation CD or DVD.
Make sure to have the following RPM's installed.

For CD compat-gcc-32 (On disk 3)
compat-gcc-32-c++ (On disk 4)

Setup environment variables for easy install.

export HOST=i386-*-linux
export IDIR=/home/(your-login-name)/(chosen installation directory)

Install simpleutils.

cd $IDIR/simpleutils-990811
./configure --host=$HOST --target=sslittle-na-sstrix --with-gnu-as --with-gnu-ld --prefix=$IDIR
make install

(在Suse10.1會出現這個問題,不過在Fedora Core5就不會)
NOTE: about "../../src/ld/ldlex.l:577: error: `yy_current_buffer' undeclared (first use in this function)"
If you are getting `yy_current_buffer' undeclared errors, you are using a version of flex
which is too new, and buggy (for example 2.5.31).
We advise to uninstall flex and install the 'flex-old' package as a workaround)

Install simplesim.
cd $IDIR/simplesim-3.0
make config-pisa
make sim-tests

Install gcc.

cd $IDIR/gcc-
./configure --host=$HOST --target=sslittle-na-sstrix --with-gnu-as --with-gnu-ld --prefix=$IDIR
make LANGUAGES="c c++" CFLAGS="-O3" CC="gcc32"
make install LANGUAGES="c c++" CFLAGS="-O3" CC="gcc32"

NOTE: If GCC 3.2 are not installed previously, replacing CC="gcc32" with CC="gcc".

NOTE: At some point, the make will fail due to an error and stop compilation.
The followings changes should cause the make to complete successfully.
Some files are set to be read only, changing the parperity if the file need to be modified.

1. Open insn-output.c in a text editor. Ensure that all multi-line quotes that
are broken over several lines are properly escaped using the correct escape
character. In this case V "\".

2. On line 35 of objc/sendmsg.c, add the following "#define STRUCT_VALUE 0"

3. find "stdio.h" ($IDIR/sslittle-na-sstrix/include) at the right place in that file and delete __NORETURN

4. gcc/obstack.h, line 341. delete "(void **)" becomes "*(__o->next_free)++ = ((void *)datum); \"

5. gcc/cxxmain.c, line 2978. disable this line

6. One line 60 of protoize.c, replace the "#include " with
"#include ".

4. Verify

First verify that simplesim is installed correctly.

cd $IDIR/simplesim-3.0
./sim-outorder tests-pisa/bin.little/test-math

If results are generated from this, simplesim is most likely installed correctly.

Next verify that the cross-compiler is working. Create a basic C program (like the "hello world" program), name
it test.c, and place it in a new directory called dev.

cd $IDIR
mkdir dev
cd dev
(create test.c and place in $IDIR/dev)
cd $IDIR
bin/sslittle-na-sstrix-gcc -o test dev/test.c
simplesim-3.0/sim-outorder test

If some errors like "syntax error before ..." occur, sslittle-na-sstrix/include/stdlib, line 43,44, change into #define __NORETURN
and #define __CONSTVALUE

If results are generated from this, the cross compiler is most likely installed correctly.

No comments: