由于昨天一个疏忽,导致我 ubuntu 很多数据丢失,包括simplescalar,不得不重新安装。记录安装过程如下:
主要参考
【
http://www.igoy.in/simplescalar-installation-made-simple/
】
%——————————————————-%
SimpleScalar安装过程
Ubuntu 12.04 64 bit
%——————————————————-%
%——————————————————-%
必要文件:[下载链接
http://www.simplescalar.com]
Simpletools-2v0.tgz
Simplesim-3v0e.tar.gz
Simpleutils-990811.tar.gz 【
下载
】
Gcc-2.7.2.3.ss.tar.gz 【
下载
】
%——————————————————-%
%——————————————————-%
环境设置:
1.
$ uname -a
:查看内核版本和机器类型。
根据结果设定如下:
HOST=i686-pc-linux or HOST=i386-pc-linux
2. 导出环境变量:
$ export HOST=
i386-pc-linux 我的64位使用,没有问题
$ export IDIR=/home/YOUR_USER_NAME/simplescalar
$ export TARGET=sslittle-na-sstrix
3. 确保安装以下包 :
flex
bison
build-essential
sudo apt-get install <PACKAGE_NAME>
%——————————————————-%
%——————————————————-%
Installing Simple tools
1. 执行如下命令:
$ cd $IDIR
$ tar xzvf simpletools-2v0.tgz
$ rm -rf gcc-2.6.3
%——————————————————-%
%——————————————————-%
Installing SimpleUtils
1. 解压:
$ tar xzvf simpleutils-990811.tar.gz
$ cd simpleutils-990811
2. 修正代码错误:
在目录ld找到ldlex.l文件,修改所有的:
yy_current_buffer –> YY_CURRENT_BUFFER
3. 安装:
$ ./configure -host=$HOST -target=$TARGET -with-gnu-as -with-gnu-ld -prefix=$IDIR
$ make
$ make install
%——————————————————-%
%——————————————————-%
Installing Simulator
1. 执行以下命令
$ cd $IDIR
$ tar xzvf simplesim-3v0e.tgz
$ cd simplesim-3.0
$ make config-pisa 或者 make config-alpha(?)
$ make
%——————————————————-%
%——————————————————-%
Installing GCC Cross-Compiler
1. 解压:
$ cd $IDIR
$ tar xzvf gcc-2.7.2.3.ss.tar.gz
2. 配置:
$ cd gcc-2.7.2.3
$ export PATH=$PATH:/home/YOUR_USER_NAME/simplescalar/sslittle-na-sstrix/bin
$ ./configure -host=$HOST -target=$TARGET -with-gnu-as -with-gnu-ld -prefix=$IDIR
注意:修改Makefile第130行,在后面添加 -I/usr/include 【-I 大写的i】
3. 修改文件protoize.c第60行:
#include <varargs.h> –> #include <stdarg.h>
命令:
$ chmod +w protoize.c
$ gedit protoize.c
4. 修改文件obstack.h第341行:
*((void **)__o->next_free)++=((void *)datum);
–>
*((void **)__o->next_free++)=((void *)datum);
命令:
$ chmod +w obstack.h
$ gedit obstack.h
5. 复制补丁文件:
$ 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/
6. 下载文件ar-ranlib.tar.gz,解压将它的内容放到
$IDIR/sslittle-na-sstrix/bin中。
并且赋予这些文件可执行和可写权限:
chmod +w <filename>
chmod +x <filename>
**************************************************
7.
$ make
,解决出现的错误。
a. 编辑文件insn-output.c
$ gedit insn-output.c
在line 675, 750 and 823 之后增加 “\”
**************************************************
$ make
出错:
在objc/sendmsg.c, 35行处增加:
#define STRUCT_VALUE 0
执行:
$ chmod +w objc/sendmsg.c
$ gedit objc/sendmsg.c
**************************************************
$ make LANGUAGES=”c c++” CFLAGS=”-O” CC=”gcc”
**************************************************
修改cxxmain.c文件,删掉 2978-2979 行,即:
char * malloc ();
char * realloc ();
执行:
$ chmod +w cxxmain.c
$ gedit cxxmain.c
**************************************************
继续执行,应该没错了:
$ make LANGUAGES=”c c++” CFLAGS=”-O” CC=”gcc”
$ make install LANGUAGES=”c c++” CFLAGS=”-O” CC=”gcc”
到此,模拟器工具和编译器都安装好了!
%——————————————————-%
%——————————————————-%
测试:
编写测试程序:
$ cd $IDIR
$ gedit hello.c
#include<stdio.h>
int main (void)
{
printf(“My name is Yogesh Mhatre. I’m not a Coder, but I do like debugging errors.nI like blogging and sharring my minuscule knowledge to the world through it.\n”);
return 0;
}
编译运行:
$ $IDIR/bin/sslittle-na-sstrix-gcc -o hello hello.c
$ $IDIR/simplesim-3.0/sim-safe hell
得到输出:
sim: ** starting functional simulation **
My name is Yogesh Mhatre. I’m not a Coder, but I do like debugging errors.
I like blogging and sharring my minuscule knowledge to the world through it.
说明成功,一切正常!!
%——————————————————-%
以后数据要经常备份。