Hello everyone! I’ve put together a bare-bones RISCV SOC based on Clifford Wolf’s excellent picorv32/picosoc. It will get you up and running with a 32-bit CPU executing instructions directly from SPI flash.
The code can be found in the new examples directory of the TinyFPGA BX repository: https://github.com/tinyfpga/TinyFPGA-BX/tree/master/examples/picosoc
You’ll need to install the icestorm toolchain if you want to build this project. The
icestorm_template goes through this process: https://github.com/tinyfpga/TinyFPGA-BX/blob/master/icestorm_template/README.md
You’ll also need the RISCV GCC toolchain installed to build the firmware: https://github.com/cliffordwolf/picorv32/blob/master/README.md#building-a-pure-rv32i-toolchain
Once you have both icestorm and RISCV gcc installed, you’ll be able to build and upload the SOC onto your TinyFPGA BX board with the following command:
The example itself is pretty simple. It gets you to a blinking LED using C code running on the PicoRV32 core. It is an excellent starting point for any project for which you would like to include a CPU core running C code along side your own custom hardware.
There are a few things I am looking for help with on this example:
- I’m not too sure the GCC linker script is correct. The instructions are executed directly from SPI flash, but statically initialized variables may not be getting initialized properly. I don’t have much experience with GCC linker scripts so any help is appreciated.
- It doesn’t currently support C++, but this is a limitation of the initialization code and linker script.
- There are two user peripherals built in: the hardware UART, and GPIO output. It would be nice to have the USB bootloader present as a serial peripheral as well and I may add it later.
- The Makefile could use some TLC to make it easier to add additional source files.