A simple RISC-V toolchain containing ANSI C to RV64I compiler built from scratch, RV assembler and RV software emulator that takes binary file as input. Built on top of it is Qt application with interactive text field, compile button and text box to show assembly output. Additionaly, it highlights which ANSI C lines compiled into which assembly lines of code.
Compiler relays on yacc and lex as frontend tools for parsing and lexical analaysis of input code. Before buiding the project, make sure you have installed yacc and lex:
yacc
andlex
(also known asbison
andflex
)
# For yacc (bison) and lex (flex), check the version using
bison --version
flex --version
# Update package lists
sudo apt update
# Install yacc (bison) and lex (flex)
sudo apt install bison flex
# Clone the repository
git clone https://github.com/davidvidovic/riscv-toolchain.git
To compile input source code, edit input.c
file and run run.sh
bash script from terminal.
To run Qt app, an app should be first built from Qt Creator using .pro
file in folder app
.
Examples of app usage: