搭建riscv环境

1.第一步 clone 需要的源文件(sudo apt install git   如果你没有git)  以下都是给予ubuntu18.04

$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
或者
$ git clone https://github.com/riscv/riscv-gnu-toolchain
$ cd riscv-gnu-toolchain
$ git submodule update --init --recursive

2.依赖项

$ sudo yum install autoconf automake libmpc-devel mpfr-devel gmp-devel gawk  bison flex texinfo patchutils gcc gcc-c++ zlib-devel expat-devel

3.installation(newlib) 构建newlib交叉编译器  我的内核使用32位所以下面介绍32位

cd riscv-gnu-toolchain
./configure --prefix=/opt/riscv --with-arch=rv32emc --with-abi=ilp32e
sudo make    # sudo needed if installing under default /opt/riscv location

4.构建linux交叉编译器32位

./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32d
make linux

可能出现的问题 centos和rhel编译器过久可能会失败

Troubleshooting Build Problems
Builds work best if installing into an empty directory. If you build a hard-float toolchain and then try to build a soft-float toolchain with the same --prefix directory, then the build scripts may get confused and exit with a linker error complaining that hard float code can't be linked with soft float code. Removing the existing toolchain first, or using a different prefix for the second build, avoids the problem. It is OK to build one newlib and one linux toolchain with the same prefix. But you should avoid building two newlib or two linux toolchains with the same prefix.

If building a linux toolchain on a MacOS system, or on a Windows system using the Linux subsystem or cygwin, you must ensure that the filesystem is case-sensitive. A build on a case-insensitive filesystem will fail when building glibc because *.os and *.oS files will clobber each other during the build eventually resulting in confusing link errors.

Centos (and RHEL) provide old GNU tools versions that may be too old to build a RISC-V toolchain. There is an alternate toolset provided that includes current versions of the GNU tools. This is the devtoolset provided as part of the Software Collection service. For more info, see the devtoolset-7 URL. There are various versions of the devtoolset that are available, so you can also try other versions of it, but we have at least one report that devtoolset-7 works.

参考网址

https://github.com/riscv/riscv-gnu-toolchain#installation-newlib

2021-5 注意:构建 sudo make 不使用 sudo linux  ,注意观察makefile 文件,使用clean 清除相关文件,相关文件夹应该有 777权限。在对应文件夹使用gcc进行编译生成对应文件。一遍后面可以使用。

gcc tools/bin2hex.c -o tools/bin2hex

 注意事项:编译器path需要永久写入。,tools安装目录不可删除,一般在根目录操作。从pc传送过来的压缩文件可能编码改变导致编译错误,尽量从linux下使用git。quartus 19以下linux版本在ubuntu18使用会报错。或者无法运行在ubuntu18.04。quartus 16.1  17.1能够在ubuntu 16下运行。ubuntu 16某些版本可能存在异常尽量使用ubuntu18。quartus 19在ubuntu某些步骤也会报错,具体解决办法各位自己解决。  目前博主已经成功配置使用。工具大小应该为5个gb左右。各位可以在国内网友那里要到已经clone成功的文件,然后解压在自己电脑配置。直接下载git zip文件  文件将会是残缺无法使用的。

在ubuntu20 部署qsys 会有两个错误 1.缺少libpng12-0 ,安装也会出错,因为老版本/lib /usr/lib是两个文件夹,新系统使用链接方式代替。出现此问题使用新的软件包解决。

sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update
sudo apt install libpng12-0

第二个错误

Gtk-Message: Failed to load module "canberra-gtk-module"  安装gtk和gtk3模块应该解决它
sudo apt install libcanberra-gtk-module libcanberra-gtk3-module
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值