RUST Procedure PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

RUST PROCEDURE

● For the riscv tool chain go to “https://gitlab.com/shaktiproject/software/riscv-


tools” and follow all the steps:-
○ git clone “https://gitlab.com/shaktiproject/software/riscv-tools.git”
○ cd riscv-tools
○ git submodule update --init --recursive
○ export SHAKTITOOLS=<give the path to install riscv toolchain>
○ SHAKTITOOLS=/PATH/OF/TOOL
○ export PATH=$PATH:$SHAKTITOOLS/bin
○ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SHAKTITOOLS/lib
○ export PATH=$PATH:$SHAKTITOOLS/riscv64-unknown-elf/bin
○ export PATH=$PATH:$SHAKTITOOLS/riscv32-unknown-elf/bin
● For running we need riscv32-unknown-linux-gcc so, just follow
○ Go inside of the riscv-tools then riscv-gnu-toolchain i.e,
cd riscv-tools/riscv-gnu-toolchain
○ To build the linux cross compiler, pick an install path say choose /opt/riscv
Type: ./configure --prefix=/opt/riscv
make linux
○ After compilation of above steps:
Type: ./configure --prefix=/opt/risccT --with-arch=rT2ggc --with-abi=ilp2gd
make linux
● After completing the above steps riscv32-unknown-linux-gcc will come if its not come
just export the path i.e, export PATH=$PATH:/opt/riscv/bin and test again.
● Now set up RUST environment:
○ Type: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh (Just install
default version i.e, by pressing 1)
○ Now after completing these steps export the PATH i.e,
export PATH=$PATH:/home/<user>/.cargo/bin
Now all the commands of rust are available i.e, rustc; rustup; cargo\
● To run the above code we need riscv32imac-unknown-none-elf
○ Type: rustup target add riscv32imac-unknown-none-elf
○ Just for checking, Type: rustup target list it will write installed by the side of it.
● Now the final steps we have to install QEMU, Follow the steps below,
○ git clone git://git.qemu.org/qemu.git
○ cd qemu
○ git checkout stable-2.9
○ git submodule init
○ git submodule update --recursive
○ git submodule status --recursive
○ mkdir build ( QEMU is installed in a directory named build which is a sub
directory of the directory that contains your local copy of the QEMU source
code repository. Your command line environment should currently be inside
this build directory. )
○ sudo apt-get install build-essential zlib1g-dev pkg-config libglib2.0-dev

1
binutils-dev libboost-all-dev autoconf libtool libssl-dev libpixman-1-dev
libpython-dev python-pip python-capstone virtualenv
○ cd build
○ ../configure
○ make
● Git Clone: “https://github.com/tomoyuki-nakabayashi/riscv-rust-hello”
○ cd riscv-rust-hello
○ env CC=riscv32-unknown-linux-gnu-gcc cargo run

After this Hello from Rust! is there on the console…

You might also like