2023.08.21 运行开源代码lowRISC ibex的simple_system helloworld步骤及遇到问题

lowRISCV ibex
https://github.com/lowRISC/ibex/tree/master
https://github.com/lowRISC/ibex/blob/master/examples/simple_system/README.md
如有错误之处还请不吝赐教!

1、安装说明

下面将对安装环境说明:
在这里插入图片描述

2、安装verilator:

推荐用4.220,5.0x会遇到下面问题,当然可以通过verilaor编译选项忽略;
https://github.com/lowRISC/ibex/issues/2039

建议使用官网4.220的source编译,方法如下(可以直接git ,4.22.0版本再安装);
https://github.com/verilator/verilator/releases/tag/v4.220

Prerequisites:

sudo apt-get install git make autoconf g++ flex bison
sudo apt-get install libfl2  # Ubuntu only (ignore if gives error)
sudo apt-get install libfl-dev  # Ubuntu only (ignore if gives error)

如果是4.220版本,可以直接从这里下载:

 https://github.com/verilator/verilator/releases/tag/v4.220
unsetenv VERILATOR_ROOT  # For csh; ignore error if on bash
unset VERILATOR_ROOT  # For bash
autoconf        # Create ./configure script
./configure
make
sudo make install**

3、clone ibex &安装依赖包

①clone项目:

mkdir  ibex
cd  ibex
git clone https://github.com/lowRISC/ibex

②安装依赖包:

pip3 install --user -r python-requirements.txt

这里可能会出现Failed to connect to github.com port 443 after 21053 ms: Connection refused,需要多试几次;

这里python-requirements.txt是安装了fusesoc和依赖库;
这里需要说明fusesoc一定要0.1的版本,edalize一定要0.3.3的版本否则会出现不少问题!
所以只要最好严格按照python-requirements.txt下载就可以了.。

记得添加环境变量:fusesoc在~/.local/bin下

export PATH=$PATH:~/.local/bin

4、RISC-V Compiler Toolchain

网上很多博客要自己编译Toolchain,其实这里不用自己编译,否则会时间很长,我们可以直接下载编译gcc工具,增加环境变量即可,如ibex所说;

①直接从/lowrisc-toolchains下载放在~/ 下,然后解压:
https://github.com/lowRISC/lowrisc-toolchains/releases

tar -xf lowrisc-toolchain-gcc-rv32imcb-20230811-1.tar.xz

②添加环境变量$LRISCV_GCC

export LRISCV_GCC="~/lowrisc-toolchain-gcc-rv32imcb-20230811-1/bin/"
export PATH=$PATH:~/.local/bin:$LRISCV_GCC

5、其他

apt-get install libelf-dev
apt-get install srecord

到这里所有软件环境都配置成功喽!

6、运行Hello World

方法一:
在ibex根目录下运行:
①通过fusesoc建立Simple System仿真bin:

fusesoc --cores-root=. run --target=sim --setup --build lowrisc:ibex:ibex_simple_system --RV32E=0 --RV32M=ibex_pkg::RV32MFast

会遇到找不到anytree的问题,可以忽略;

②编译hello world:

make -C examples/sw/simple_system/hello_test

③运行仿真:

./build/lowrisc_ibex_ibex_simple_system_0/sim-verilator/Vibex_simple_system [-t] --meminit=ram,./examples/sw/simple_system/hello_test/hello_test.elf

会看到如下结果,发现performance counter跟官网描述不同,所以这里需要在①增加
–MHPMCounterNum=10;

方法二:
在ibex根目录下:
①编译:
make build-simple-system
②运行:
make run-simple-system

7、遇到的问题及解决

问题1:Performance Counters不对
在这里插入图片描述
这里如官网描述不符,原因是默认–MHPMCounterNum=0所以这里计数没有工作;
解决:
在这里插入图片描述
在这里增加–MHPMCounterNum=10,问题解决。
https://github.com/lowRISC/ibex/issues/1866

问题2:无法生成波形的问题

按照官网加[-t]选项,无法生成波形;
解决
这里尝试在运行时加**–trace --trace=sim.vcd**
在这里插入图片描述

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
引用:deb file:///mnt/iso/ubuntulucid main deb file:///mnt/iso/ubuntulucid restricted deb file:// #debian系列ISO源的固定格式 /mnt/iso #ISO镜像的挂载点(依各自挂载目录而定噢) ubuntu #ISO镜像中的ubuntu目录 lucid #发行版代号或昵称 引用:Quantal Quetzal 量子绿咬鹃 12.10 Precise Pangolin 精确的穿山甲 12.04 Oneiric Ocelot 白日梦的虎猫 11.10 Natty NARWHAL 聪慧的独角鲸 11.04 Maverick Meerkat 标新立异的狐獴 10.10 Lucid Lynx 清醒的雪地猞猁 10.04 Karmic Koala 幸运的考拉 9.10 Jaunty Jackalope 快活的鹿角兔 9.04 Intrepid Ibex 勇敢的无畏的野羊 8.10 Hardy Heron 坚强的苍鹭 8.04 Gutsy Gibbon 胆大的长臂猿 7.10 Feisty Fawn 烦躁不安的小鹿 7.04 Edgy Eft 尖利的小蜥蜴 6.10 Dapper Drake 整洁的帅气的公鸭 6.06 Breezy Badger 活泼的獾 5.10 Hoary Hedgehog 白发的刺猬 5.04 Warty Warthog 多疣的疣猪 4.10 ubuntu 10.04镜像源的格式是deb file:///mnt/iso/ubuntulucid main deb file:///mnt/iso/ubuntulucid restricted deb file:// #debian系列ISO源的固定格式 /mnt/iso #ISO镜像的挂载点(依各自挂载目录而定噢) ubuntu #ISO镜像中的ubuntu目录 lucid #发行版代号或昵称。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [apt-get Ubuntu本地ISO镜像入源](https://blog.csdn.net/transform74/article/details/81332955)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值