Skip to content

Fayz2110/Executing-Assembly-on-SPIKE-RISC-V-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

INTRODUCTION

This repository contatins step by step commands to install RISC-V 32-bit toolchain, SPIKE simulator and to run a program on SPIKE simulator.

INSTALLING RISC-V TOOLCHAIN

First we have to download the RISC-V prebuilt toolchain, which can be downloaded from here Toolchain

Make a directory where you want to download the tooclchain

$ sudo mkdir /path/directory
$ cd Downloads
$ sudo tar -xzf TOOLCHAIN.tar.gz -C /path/directory
$ export PATH=$PATH:/path/directory/bin

Check wheather toolchain is downloaded or not.

riscv32-unknown-elf-gcc -v

Add the path variable in the end in .bashrc file and save it.

$ nano ~/.bashrc
$ export PATH=$PATH:/path/directory/bin

INSTALLING SPIKE

SPIKE RISC-V simulator can be downloaded from here SPIKE

Run the following commands, make sure in sixth command the path is correct of toolchain installation path.

$ apt-get install device-tree-compiler
$ git clone [email protected]:riscv-software-src/riscv-isa-sim.git
$ cd riscv-isa-sim
$ mkdir build
$ cd build
$ ../configure --prefix=/path/directory/bin
$ make
$ sudo make install
$ export PATH="/path/directory/riscv-isa-sim/build:$PATH"

Now add the path in .bashrc file

$ nano ~/.bashrc
$ export PATH="/path/directory/riscv-isa-sim/build:$PATH"

Now run to check if the SPIKE simulator is downloaded or not.

$ spike

ASSEMBLING THE CODE

The GCC compiler would generate an executable file SAMPLE, which will execute on spike

riscv32-unknown-elf-gcc -march=rv32i_zicsr -mabi=ilp32 -o SAMPLE exception_handling.S -nostartfiles -Tlink.ld

RUNNING ON SPIKE

Now we will run the executable file to execute for 32-bit architecture.

$ spike --isa=rv32i -d SAMPLE 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published