RISC-V技术论坛
直播中

rosa

13年用户 1297经验值
私信 关注
[经验]

RISC-V工具链搭建

1.RISC-V工具链安装

参考网站:https://github.com/chipsalliance/rocket-chip

1)下载rocket-chip


$ cdrocket-chip

$ gitsubmodule update --init

2)下载riscv-tools

$ git clone https://github.com/freechipsproject/rocket-tools
$ cd rocket-tools
$ gedit .gitmodules #查看每个子文件的下载源,然后使用下面的命令单个子模块进行克隆
$ git clone --recursive https://github.com/riscv/riscv-isa-sim.git(其余同理)
$ ......

对于riscv-gnu-tools可以直接拷贝之前已经下载好的文件到对应文件夹中。

3)设置环境变量

$ sudo gedit ~/.bashrc

在该文件末尾处添加

$ exportTOP=/home/pengl/fsf

$ exportRISCV=$TOP/riscv_install_tools

$ exportPATH=$PATH:$RISCV/bin

4) 工具链编译

$ cd ~/rocket-tools

安装依附包:sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev libusb-1.0-0-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev device-tree-compiler pkg-config libexpat-dev libfl-dev
$ sudoRISCV=/home/pengl/fsf/riscv_install_tools ./build.sh(若编译32位工具链,则使用./build-rv32ima.sh)

最终可以在~/fsf/riscv_install_tools/bin中产生riscv工具链和pkspike

至此,工具链生成完成。

2.Rocket-chip创建可以产生RTL的环境。

1)克隆和测试chiselfirrtl

$ git clone https://github.com/freechipsproject/chisel3.git
$ cd chisel3
$ sbt compile

产生FPGAVLSI可综合的verilog代码
$ cd vsim
$ make verilog #Default Config
$ make verilog CONFIG=freechips.rocketchip.system.DefaultConfig  ##Default Config
$ make verilog CONFIG=freechips.rocketchip.system.RoccExampleConfig  #RoccConfig


emulator下产生verilatorgenerated-src
1)rocket-chip目录下的MakefragCONFIG更改为*.RoccExampleConfig
2)rocket-chip/emulator下打开终端,运行make,产生verilatorgenerated-src两个文件夹;

3)如果在产生上面两个文件的时候发生错误,则将两个makefile文件拷贝出来,删除该emulator,再新建emulator,并将刚拷贝的两个makefile放入该新建文件夹,再运行make,运行成功。

更多回帖

发帖
×
20
完善资料,
赚取积分