Ubuntu 14.10 Installation Simplescalar

Source: Internet
Author: User
Tags pow

After two days of installation, finally put the Simplescalar installation success, the installation process in the Internet to find a lot of information, but many are about the low version of the Ubuntu installation process, and follow these tutorials are not installed successfully, to record the installation of problems and solutions.

First, install the reference article

Http://godblesstangkk.blogspot.com/2013/01/install-simplescalar-30-on-ubuntu-1204.html

Second, installation environment information

The installed computer system is a ubuntu14.10 64-bit operating system, such as:

Third, the installation process

1, download the installation file, you can download: HTTP://PAN.BAIDU.COM/S/1GDUH9SF

The downloaded package contains 4 required tar packages for installation (Simplesim-3v0e.tgaz, Simpletools-2v0.tgz,simpleutils-990811.tar.gz,gcc-2.7.2.3.ss.tar.gz) and a folder (install needed), The install needed folder contains two files Ar and ranlib, and these two files will be used when installing gcc-2.7.2.3 later.

2. Setting Environment variables

1> compile the. bashrc file under the user directory, add the following statement at the end of the secondary file:

Export idir=/any/directory/you/choose/(the directory you want to install yourself)

Export Host=i686-pc-linux

Export Target=sslittle-na-sstrix

Note: Idir is the Software installation directory, choose their own installation directory; The i686 in host specifies the architecture of the emulator target CPU, the other possible values are "arm", "MIPS", "i386" and so on, the PC specifies the company, Linux specifies your operating system, the other possible values are "Solaris", "GNU", etc. The target part specifies whether the system is stored with a large tail end or a small end segment.

2> Create the folder you want to install, you can create it by using "mkdir $IDIR", and then move all of the installed tar packages to the directory.

3> update the software on your PC using sudo apt-get update.

Then install the following package (you can install it using the instructions sudo apt-get install <package name> ):

Build-essential

Flex

Bison

gcc-multilib(do not install first)

g++-multilib(do not install first)

Note: Install the above three packages first (build-essential, Flex, Bison), gcc-multilib and g++-multilib do not install, because I installed the two packages directly, Causes some errors when installing gcc-2.7.2.3, because installing gcc-multilib and g++-multilib directly installs GCC that updates your system. Since my GCC is version 4.9 before installing these two packages, GCC becomes 5.2.1 after installation, so the guess is that the GCC version is too high, and the specific errors are mentioned later.

3, Decompression Simpletools-2v0

Execute the following command:

CD $IDIR

Tar Xvfz simpletools-2v0.tgz

RM-RF gcc-2.6.3 (Delete this folder because the new version of GCC will be installed, that is gcc-2.7.2.3)

After completing this instruction, you will get the Ssbig-na-sstrix and Sslittle-na-sstrix folders in the $idir directory, which contain an include folder and a Lib folder.

4, Installation SimpleUtils-990811

Execute the following command:

CD $IDIR

Tar Xvfz simpleutils-990811.tar.gz

CD simpleutils-990811

Then modify the Ldlex.l file in the LD directory to replace "Yy_current_buffer" in this file with Yy_current_buffer ".

Then go back to the simpleutils-990811 directory and execute the following command:

./confing--host= $HOST--target= $TARGET--with-gnu-as--with-gnu-ld--prefix= $IDIR

Make

Make install

After executing these commands, the $idir directory will have bin, Lib, include, man, Share folder (in fact there are f2c-1994.09.27 and glibc-1.09 two folders), in addition, in the Sslittle-na-sstrix folder more than a bin folder)

5, Installation simplesim-3v03

First, unzip the file simplesim-3v0e.tgz and execute the following command:

CD $IDIR

Tar Xvfz simplesim-3v0e.tgz

CD simplesim-3.0

Make Config-pisa

Make

Note: Where make Config-pisa instructions are selected according to their own needs, if you need alpha results, change the target configuration, and you need make clean and then in make Config-alpha.

If these commands are executed successfully, you will see the message "My work was done here ...".

You can then run the emulator and run the following command:

./sim-safe Tests/bin.little/test-math

Then you will see information like the following:

SIM: * * Starting functional Simulation * *
POW (12.0, 2.0) = = 144.000000
POW (10.0, 3.0) = = 1000.000000
POW (10.0,-3.0) = = 0.001000

...

6, install the GCC cross compiler (this is the most error-prone place)

First unzip the file and run the following command:

CD $IDIR

Tar Xvfz gcc-2.7.2.3.ss.tar.gz

CD gcc-2.7.2.3

./configure--host= $HOST--target= $TARGET--with-gnu-as--with-gnu-ld--prefix= $IDIR

At this point, we can not compile, because the various incompatibilities can cause a lot of errors, we first to modify the source program.

1> let us have write permission to the current directory, execute the following command

chmod-r +w. (Don't forget the little dot in the back ".")

2> Modify Makefile file, add "-I/usr/include" at the end of line 130

3> Modify the protoize.c file to change the <varargs.h> of line 60 to <stdarg.h>

4> Modify the Obstack.h file, at 341 lines, change * (void *) __o->next_free) + + to * ((void *) __o->next_ free++)

5> Run the following command ( Note that it is still in the $idir/gcc-2.7.2.3 directory)

CP./patched/sys/cdefs.h. /sslittle-na-sstrix/include/sys/cdefs.h
Cp.. /SSLITTLE-NA-SSTRIX/LIB/LIBC.A. /lib/
Cp.. /SSLITTLE-NA-SSTRIX/LIB/CRT0.O. /lib/

And then start compiling:

Make languages= "C C + +" cflags= "-o" cc= "gcc"

An error occurs where the error is insn-output.c file, edit the file, and add a backslash "\" at the end of line No. 675, 750, 823. (Note: If you make a clean and then have a re-create, you need to modify the file again because this file was generated during the compilation process)

Note: If you installed Gcc-multilib and g++-multilib at the beginning, if your GCC becomes version 5.0 then a "recipe for target" will appear at the time of compilation. /cc1plus ' failed ' such error, after I made clean, and then the GCC version changed to 4.9, there is no such error, so this error may be caused by the GCC version.

Then make again:

Make languages= "C C + +" cflags= "-o" cc= "gcc"

An error appears, similar to the following information:

* * * * Buffer Overflow detected * * *:/home/tangkk/simplescalar/sslittle-na-sstrix/bin/ar terminated "

To fix this error, install the two files in the installer needed file in the package and put the two files (AR and ranlib) in the $idir/sslittle-na-sstrix/bin directory. Then modify their permissions so that they become executables, using the following directives:

CD $IDIR/sslittle-na-sstrix/bin/

chmod +x ar ranlib

Then go back to the gcc.2.7.2.3 directory and compile again:

Make languages= "C C + +" cflags= "-o" cc= "gcc"

Then if the "recipe for target ' libgcc1.null ' failed" error occurs, then the gcc-multilib is then recompiled and there will be no such error.

Then execute the compile command:

At this point, if the file about CXXMAIN.C error, You can modify the Cxxmain.c file, the inside of the No. 2978 and 2979 comments out , and then recompile.

There should be no mistake at this time.

7. Make Enquire

Also under the $idir/simplescalar/gcc-2.7.2.3 directory, execute the following command:

Make Enquire

If the "undefined reference to ' __isoc99_sscanf" error occurs, the makefile file needs to be modified, and after the No. 995 line "$ (enquire_cflags)", add "-d_gnu_ SOURCE ", and then recompile.

Execute make Enquire

If the "/bin/sh:1: Cc:not found" error occurs, then you need to modify the makefile, in line 60th, modify CC=CC to CC=GCC, and then execute make enquire.

And then we're done compiling.

Then execute the following command to install the cross-compiler:

.. /simplesim-3.0/sim-safe./enquire-f > Float.h-cross (This process seems to take a long time, I have been running for an afternoon, it is not over)
Make languages= "C C + +" cflags= "-o" cc= "gcc" Install

8. Testing

You can write a Hello World program to test.

Write a hello.c file with the following contents:

#include <stdio.h>

Main () {

printf ("Hello world!\n");

}

Then use the cross compiler to compile it. The command is as follows:

$IDIR/bin/sslittle-na-sstrix-gcc–o Hello hello.c

(if this fails, try going to the bin folder above, assuming that the hello.c file is in the $idir directory, use the command "./sslittle-na-sstrix-gcc-o. /hello. /HELLO.C " to run, if still failed, may be the environment variable chaos problem, close and restart the terminal, and then try again)

If you see the following information:

SIM: * * Starting Functional Simulation * *Hello world!The instructions have been installed successfully!

Ubuntu 14.10 Installation Simplescalar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.