Skip to content

gcc compiler thing made of python scripts for Mini Risc-V implementation of rv32i ISA

Notifications You must be signed in to change notification settings

gbruner7607/Mini-Risc-V-gcc

Repository files navigation

GCC Compiler for Majumder's RISC-V Implementation

This collection of python scripts, as well as assembly and c header files lets you write a c program that compiles and assembles into binary data to be used on the MiniRisc-V Implementation.


Installation

In order for this compiler to work, you must have the riscv tool chain installed, specifically the one provided in UC-Berkeley's rocket-tools github repository. The repository can be found here. Installing the whole repository is not a bad idea, because it also comes with the spike simulator, which you can use to test your code before putting it on the RISC-V Core.

Installing the toolchain is as follows

$ git clone https://github.com/freechipsproject/rocket-tools
$ git submodule update --init --recursive
$ export RISCV=path/to/where/you/want/toolchain/installed

Next you must edit the first two build_project lines in build-rv32ima.sh to build for rv32i by replacing rv32ima with rv32i for the with-isa and with-arch parameters. '
Then just run that script.

$ ./build-rv32ima.sh  

After the toolchain is installed, you'll need to make sure that it's in your PATH environment variable. Append the following line to your ~/.bashrc:

export PATH="path/to/toolchain/bin:$PATH"

Usage

usage: Mini-Risc-V-gcc.py [-h] [-c] [-s] [-o OUTPUT] files [files ...]

positional arguments:
  files                 File Names (Takes .c and .s

optional arguments:
  -h, --help            show this help message and exit
  -c, --coe             generate .coe file instead of .hex file
  -s, --save_temps      save intermediate .s and .o files in same path as output
  -o OUTPUT, --output OUTPUT (defaults .o and .hex/.coe of first file input)

About

gcc compiler thing made of python scripts for Mini Risc-V implementation of rv32i ISA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published