来自:
http://blog.ifeng.com/2132044.html
1、安装LINUX 操作系统:redhat5.5企业版。
2、安装软件MODELSIM6.51 ,启动LICENSE。
3、下载LEON3的相关软件包。
(b) sparc-elf-4.4.2-1.0.36b.tar.bz2
(e) libmpfr.so.1库的32bit包。
4、解压以上文件,并把b和d放在目录/opt下,并添加到配置文件.tcshrc里面。
5、make xconfig
• make xconfig to edit/change the config.vhd file and the LEON3 configuration
• make sure that you have at least one uart enabled
• enable the option "Accelerated uart tracing" in the "VHDL debugging" menu.
• don’t use ahbrom (internal prom) => address conflicts with memory ctrl
6、 Compile
a、gcc hello.c
Compile the application into on or more object file, but do not link:
$ sparc-elf-gcc -msoft-float -O2 hello.c -o hello.exe (资料上运行命令)
$sparc-elf-gcc -msoft-float -c -g -O2 hello.c (mkprom2 pdf上运行命令)
注:在编译的时候,gcc是需要libmpfr.so.1的库文件。
上面两条命令都可以,只是要对应下面的mkprom命令而已。
b、mkprom
-msoft-float Compile for hardware without a FPU.
-rmw Perform read-modify-write cycles during byte and halfword writes.
-nocomp Don.t compress application. Decreases loading time on the expense of PROM size.
-v Be verbose; reports compression statistics and compile commands
-ramsize size Defines the total available RAM in kBytes.
Used to initialize the in the memory configuration register( s). The default value is 2048 (2MByte).
$ mkprom2 -rmw -nocomp -msoft-float -dump dump.s -v -ramsize 1024 hello.exe
注:当数据量不大的时候就不需要压缩了。反之把-nocomp去掉,工具就会压 缩boot文件。
$ mkprom2 -freq 40 -rmw hello.o -dump dump.s -msoft-float(mkprom2 pdf上运行命令)
注:mkprom2命令先是初始化硬件,然后调用sparc-elf-gcc命令,同时添加很多参数来生成
prom.out程序。如下提示为:
LEON MKPROM prom builder for BCC v1.0.24
Copyright Gaisler Research 2004, all rights reserved.
section: .text at 0x40000000, size 19600 bytes
Uncoded stream length: 19600 bytes
Coded stream length: 10134 bytes
Compression Ratio: 1.934
section: .data at 0x40004c90, size 2796 bytes
Uncoded stream length: 2796 bytes
Coded stream length: 812 bytes
Compression Ratio: 3.443
creating LEON3 boot prom: prom.out
/opt/sparc-elf-3.2.3/bin/sparc-elf-gcc.exe -qprom -O2 -g -N -Tlinkprom -Ttext=0x0 dump.s
-lmkprom3 -o prom.out -msoft-float
注:最后一行不是执行命令,而是执行mkprom2后调用gcc及参数的显示而已。
c、objcopy
sparc-elf-objcopy -O srec prom.out prom.srec
7、 Simulation