Skip to content

Latest commit

 

History

History
84 lines (58 loc) · 3.73 KB

readme.md

File metadata and controls

84 lines (58 loc) · 3.73 KB

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