Main / CoursesAASimpleScalar

These are just meant as a reference for you when getting started with ubuntu and SimpleScalar. It is not meant to be a detailed set of instructions. It is basically from the history of commands I used when I was installing things on my laptop.

Installing some basic packages to get things started.

sudo apt-get install vim sudo apt-get install libnss3-1d libxss1 libcurl3 sudo apt-get install build-essential flex bison sudo apt-get install gcc-multilib g++-multilib

Start with the following files. The commands below assume we are in /home/seapahn/sim:

  • ar-ranlib.tar.gz
  • gcc-2.7.2.3.ss.tar.gz
  • simplesim-3v0e.tgz
  • simpletools-2v0.tgz
  • simpleutils-990811.tar.gz

Simpletools

tar -xzvf simpletools-2v0.tgz rm -r gcc-2.6.3/ tar -xzvf simpleutils-990811.tar.gz cd simpleutils-990811/ ./configure -host=i686-pc-linux -target=sslittle-na-sstrix -with-gnu-as -with-gnu-ld -prefix=/home/seapahn/sim/ make

  • ld/ldlex.l: Replace 'yy_current_buffer' with 'YY_CURRENT_BUFFER'

make make install cd ..

gcc (crosscompiler)

tar -xzvf gcc-2.7.2.3.ss.tar.gz cd gcc-2.7.2.3/ ./configure -host=i686-pc-linux -target=sslittle-na-sstrix -with-gnu-as -with-gnu-ld -prefix=/home/seapahn/sim/ cp patched/sys/cdefs.h ../sslittle-na-sstrix/include/sys/ cp ../sslittle-na-sstrix/lib/libc.a ../lib/ cp ../sslittle-na-sstrix/lib/crt0.o ../lib/ make

  • insn-output.c: Add '\' to end of lines 675, 750, and 823.

make

  • objc/sendmsg.c: Add '#define STRUCT_VALUE 0' to line 35.

cd .. tar -xzvf ar-ranlib.tar.gz mv ar sslittle-na-sstrix/bin/ mv ranlib sslittle-na-sstrix/bin/ cd gcc-2.7.2.3/ make

  • protoize.c: Replace '#include <varargs.h>' with '<stdarg.h>'
  • obstack.h: line 341: replace 'free)++' with 'free++)'

make make install cd ..

SimpleSim

tar -xzvf simplesim-3v0e.tgz cd simplesim-3.0/ make config-pisa make cd ..

Trying things out

  • Create sum.c
       #include <stdio.h>
       void main() {
         int i, sum=0;
         for (i=0; i<100; i++) sum += i;
         printf("sum: %d\n", sum);
       }

gcc sum.c -o sum ./sum sslittle-na-sstrix/bin/gcc sum.c -o sum.bin ./simplesim-3.0/sim-safe sum.bin ./simplesim-3.0/sim-safe -v sum.bin


apt-file is usefull (Google it)

sudo apt-get install apt-file apt-file update apt-file search stubs-32.h