搭建riscv環境

1.第一步 clone 須要的源文件(sudo apt install git   若是你沒有git)  如下都是給予ubuntu18.04linux

$ 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.依賴項c++

$ 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位git

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位github

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

可能出現的問題 centos和rhel編譯器太久可能會失敗ubuntu

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.

參考網址centos

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

 注意事項:編譯器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文件  文件將會是殘缺沒法使用的。ide

相關文章
相關標籤/搜索