This is a fork of femtorv which is directly ported to work on IceSugar-nano FPGA boards. Kudos to the original authors.
This repository contains RISCV processor that can be packed withing 1200LUTs with rv32i tool chain. There are bunch of firmware examples to try. You can use the docker enronment direclty without installing any dependancies.
Follow the steps to build usign the docker environemt. (You should have the docker deamon installed on your system)
- Clone the repository
git clone https://github.com/Archfx/sweetRV
- Pull the docker image from docker-hub
docker pull archfx/ice40tools
- Set the expected location to mount with the container
export LOC=/sweetRV
- Run the Docker image
docker run -t -p 6080:6080 -v "${PWD}/:/$LOC" -w /$LOC --name ice40tools archfx/ice40tools
- Connect to the docker image
docker exec -it ice40tools /bin/bash
g++ -I../../LIBFEMTORV32/ ../../LIBFEMTORV32/femto_elf.c firmware_words.cpp -o firmware_words -fpermissive -DSTANDALONE_FEMTOELF
Now the environment is ready. Next, we need to compile the firmware. This step will take the assembly files/ c source files and generate a hex file that is the firmware for our processor.
$ cd FIRMWARE/EXAMPLES
$ make hello.hex
This will generate the hex file of the firmware. Next we need to build the hardware with inbuilt firmware. For that follow the below steps from the main folder.
$ make ICESUGAR_NANO
This will produce the file femtosoc.bin
at the home folder. You can directly upload this to the FPGA by drag and drop.
Firmware contains different example applications which you can run on your FPGA. In order to talk with processor using UART you need to install a terminal emulator application (screen/picocom).
Below are the steps for the screen
terminal to talk with your processor. Use command + a + \
to exit.
- on Mac
brew install screen
/opt/homebrew/Cellar/screen/4.9.0_1/bin/screen /dev/tty.usbmodem102 115200
- on Ubuntu
apt-get install screen
screen /dev/ttyUSB1 115200