Skip to content

"Hacking" a Chinese LED display board with open-source FPGA tools, RISC-V and Rust 🦀

Notifications You must be signed in to change notification settings

roby2014/colorlight-riscv-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

colorlight-litex-rs

My adventure on trying to control a

Everything with open-source tools!

Contents

SoC

soc.py builds FPGA bitstream with LiteX containing a simple RISC-V SoC to run firmware.

Dependencies

Build

build bitstream and generate needed files with:

python3 soc.py --build --cpu-type vexriscv --csr-svd "./litex-pac/5a-75e_6.0.svd"

notes:

  • 5a-75e_6.0.svd will be overwritten and used later for the litex pac (peripheral access crate).
  • you can use --memory-x "../litex-pac/memory.x", however, I encountered many issues with the provided memory file, so I created my own one around regions.ld (see #firmware).

Flash

flash fpga with:

python3 soc.py --load --no-compile-software

Firmware

Firmware is built after SoC is also built, because it will depend on the memory regions defined at regions.ld (generated by LiteX).

Build

cd firmware
BUILD_DIR=../build/colorlight_5a_75e cargo build --release

Run / Simulate firmware

When running cargo run, by default, cargo will try to upload the generated .bin via firmware/.cargo/flash.sh. However, if you want to simulate, you can change config.runner to run firmware/.cargo/sim.sh.

DEVICE=/dev/ttyUSB0 cargo run

Make sure to adjust DEVICE to your needs, since firmware .bin is uploaded via UART.

PAC (Peripheral Access Crate)

When building the SoC, LiteX generates the svd file for us. With this, we can use svd2rust to create our PAC in order to access and manipulate the system. The PAC will use its build.rs to do this automatically.

References

About

"Hacking" a Chinese LED display board with open-source FPGA tools, RISC-V and Rust 🦀

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages