Giter Site home page Giter Site logo

lapnd / vexriscv-sim-helloworld Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thorkn/vexriscv-sim-helloworld

0.0 0.0 0.0 38 KB

Simulate a Vexriscv and run a hello world in it.

C 56.47% Java 5.52% Scala 25.25% Assembly 5.88% Makefile 6.87%

vexriscv-sim-helloworld's Introduction

Simulate a Vexriscv and run a hello world in it.

Here is what you can do with this repo:

  • Run a simulation of a Vexriscv.
  • Connect GDB to the Vexriscv via OpenOCD.
  • Compile a C "hello world" and load it into the Vexriscv.
  • Step through the "hello world" with GDB and see the UART output.

Prerequisites:

All the neccessary tools are contained in this Virtual Machine (VM):

Virtual Machine 2.0 (https://random-oracles.org/risc-v/)

Download the VM and follow the documentation for starting it up.

This project is tested with the QuantumRisc VM 2.0.

How to do this?

Start the Virtual Machine. From here on you work inside the QuantumRisc Virtual Machine (VM). The VM is based on Ubuntu 20.04 LTS and has a Gnome desktop.

0: Update Ubuntu and then clone this repository:

Open up a console and bring Ubuntu up to date. Then clone this respository.

sudo apt-get update
sudo apt-get upgrade

Then clone this respository.

git clone https://github.com/ThorKn/vexriscv-sim-helloworld.git

1: Build the Vexriscv and start the simulation:

Open up a console (Terminal). From the root folder of the repo, change to the folder vexriscv and start the Vexriscv Simulation.

cd vexriscv
sbt "runMain mupq.PQVexRiscvSim"

2: Connect OpenOCD (The Vexriscv version) to the Simulation:

Open up a new console (the second one). From the root folder of the repo, change to the folder vexriscv and connect OpenOCD to the Vexriscv Simulation. The OpenOCD configuration is stored in the file vexriscvsim.cfg.

cd vexriscv
openocd-vexriscv -f vexriscvsim.cfg

3: Build, upload and run the C application (a simple helloworld):

Open up a new console (the third one). From the root folder of the repo, change to the folder c_project. Build the application via the Makefile.

cd c_project
make

After building you can upload the application (main) to the Vexriscv via GDB:

riscv64-unknown-elf-gdb -tui -ex 'set remotetimeout 15' -ex 'target remote :3333' -ex 'load' -ex 'break main' -ex 'continue' main

When the application is loaded, you might want to set another breakpoint in the endless-loop inside the main:

b 11

Then you can continue the program for one run of the loop with GDB:

c

vexriscv-sim-helloworld's People

Contributors

thorkn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.