SIMPLESCALAR AND SIMPLESCALAR GCC INSTALLATION FAQ ...The burden of compiling an old cross-compiler for PISA Architecture... During this installation FAQ, you will use environment variables. Thoses variables should be registered on each terminal you use (i.e : don't change terminals, don't restart). PRELIMINARIES 1. Install an old gcc with your distrib tools I tried and it worked with gcc-2.96. You can try with some other, but the patches given could (and will) be slightly different than mine. YOU ARE NOW WARNED. Don't try something too new (like gcc-4.xx) because the patches for simplescalar won't be googleizable and don't try with something older than gcc-2.7.2.3 because it will be really tricky. 2. Register CC environment variable export CC=gcc-x.xx The command for registering environment variable might be different if you are using another shell than bash. 3. Download the files from http://www.simplescalar.com gcc-2.7.2.3.ss.tar.gz simplesim-3v0d.tgz simpletools-2v0.tgz simpleutils-990811.tar.gz 4. Register $IDIR environment variable export IDIR=/YourInstallDir The command for registering environment variable might be different if you are using another shell than bash. 5. Gunzip & untar all files in directory $IDIR. You can try something else but it will be at your own risks and, besides, it's already complicated enough. Believe me. 6. Remove directories gcc-2.6.3 because of its deprecation. BINUTILS 7. Change directory cd $IDIR/simpleutils-990811/ 8. Configure ./configure --target=sslittle-na-sstrix --with-gnu-as --with-gnu-ld --prefix=$IDIR 9. Build make If this command breaks, apply on of those patches and try again: -In simpleutils-990811/binutils/arparse.y, insert a semicolon (;) in row 77 -In simpleutils-990811/ld/ldgram.y, insert a semicolon (;) in row 168 10. Install make install SIMPLESIM 11. Change directory cd $IDIR/simplesim-3.0 12. Configure make config-pisa 13. Build make 14. Test it make sim-tests SIMPLESCALAR GCC 15. Register PATH environment variable export PATH=$PATH:$IDIR/sslittle-na-sstrix/bin The command for registering environment variable might be different if you are using another shell than bash. This is EXTREMELY important because building gcc will need the binutils we just compiled. Don't use $IDIR/bin! ($IDIR/bin are binaries for the cross-compiler and $IDIR/sslittle-na-sstrix/bin are binaries to build the cross-compiler) 16. Change directory cd $IDIR/gcc-2.7.2.3 17. Configure ./configure --target=sslittle-na-sstrix --with-gnu-as --with-gnu-ld --prefix=$IDIR 18. Build make CC=$CC If this command breaks (it will!), apply one of those patches and try again: - In libgcc2.c, add "#define BITS_PER_UNIT 8" to the 98th line. - In insn-output.c, add line breaks ('\') after each of the three FIXME (line 675, 750 and 823) - To fix __NORETURN bug (it breaks the parse of $IDIR/sslittle-na-sstrix/include/stdio.h), update the original cdefs.h (under $IDIR/sslittle-na-sstrix/include/sys) with patched one (under $IDIR/gcc-2.7.2.3/patched/sys). Some installation guides advice you to remove all references (slittle-na-sstrix/include/stdio.h line 167 and sslittle-na-sstrix/include/setjmp.h lines 64, 85, 86 and 99) to __NORETURN instead, but I think the patch is better. - In objc/sendmsg.c, add "#define STRUCT_VALUE 0" at line 35 - In protoize.c, replace "#include " at line 60 with "#include ". - In bc-typecd.def, change SFtype to DFtype at line 17 - If you get an "invalid lvalue in increment" in decl.c, edit obstack.h at line 341 and change "*((void **)__o->next_free)++=((void *)datum);\" to "*((void **)__o->next_free++)=((void *)datum);\" If, for some reason, you are building gcc-2.6.3 (and not gcc-2.7.2.3), you can get additionnal errors like : - In file cccp.c, change "extern char *sys_errlist[];" for "extern __const char *__const sys_errlist[];" at line 194 - In file sdbout.c, change "#include " for "#include " at line 57 - In file gcc.c, change "extern char *sys_errlist[];" for "extern __const char *__const sys_errlist[];" at line 172 - In file g++.c, change "extern char *sys_errlist[];" for "extern __const char *__const sys_errlist[];" at line 90 If you have any other error, try google on it. If google returns nothing, change your gcc and pray. 19. Build the program to get data on the FPU make enquire 20. Remove old FPU configuration file rm float.h-cross 21. Generate new FPU configuration file using the simulator $IDIR/simplesim-3.0/sim-safe ./enquire -f > float.h-cross In some installation guide (including the official one), you will see a >! redirection. This won't work (and won't warn you) if you don't have tcsh. 22. Install make install AND THE LAST : SUPPORT FORTRAN 23. Change directory cd $IDIR/f2c-1994.09.27 24. Edit Makefile and change ssbig-na-sstrix-f77 to sslittle-na-sstrix-f77 at line 4 24. Build make 25. Install make install PREFIX=$IDIR TEST IT / USE IT 23. Change directory cd $IDIR 24. Create some code Create an helloworld.c with some custom code of yours 25. Cross-Compile Compile with bin/sslittle-na-sstrix-gcc helloworld.c -o helloworld 26. Simulate Simulate with simplesim-3.0/sim-fast helloworld April 12th, 2006 Frederic de Mesmay, Alchemy, INRIA I like to thank Pan Yu, Sascha Gottfried, Kenji Kise and an unknown chinese guy for their installation guides.