Layers of Reflection

Thoughts on thinking about thinking

  • Home
  • Hobbies
  • Publications
  • Open Tabs
  • Contact
  • People

Linux on RISC-V ECP5 ULX3S FPGA via Litex

Back: FPGAs

I bought myself a Radiona ULX3S from CrowdSupply, which includes the 85k Lattice ECP5 FPGA, which can be programmed to simulate the open source 32-bit RISC-V CPU with a completely open source LiteX-yosys-nextpnr, toolchain. Here is a screenshot of it running Linux over the serial connection; note the riscv32 processor:

Feb. 3, 2025

The ECP5 is a 50Mhz FPGA, which I believe is why the system runs pretty slow.  I’m very excited about the purely open source toolchain, and I look forward to experimenting with faster and larger FPGAs using this toolchain in the future!

Here are the commands that I used on Ubuntu 24.04.1 LTS, while having the ULX3S connected via USB.

Install System Dependencies

sudo apt-get install python3-venv

Create Project Folder and Create Virtual Environment

mkdir litex-riscv-ulx3s && cd litex-riscv-ulx3s
python3 -m venv venv && source venv/bin/activate

Download and Setup Litex

wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
chmod a+x litex_setup.py && ./litex_setup.py --init --install
cd ..

Download and Setup RISC-V Compiler Toolchain

wget https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
tar zxf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
cd riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14
export PATH=$PATH:$PWD/bin
cd ..

Download and Setup and Program FPGA using Linux-on-Litex-VexRiscV

pip3 install meson ninja
git clone https://github.com/litex-hub/linux-on-litex-vexriscv.git
cd linux-on-litex-vexriscv
./make.py --board=ulx3s --device=LFE5U-85F --build --load

Booting Linux over Serial USB

The ULX3S does not support booting without an SD card inserted.  I used an 8GB SD card.

litex_term --images=images/boot.json /dev/ttyUSB0

After typing the above command, you will probably see no output.  You will need to press Return, which should show the Litex prompt.  At the Litex prompt, you will need to type the following to reboot the device and start the firmware and software uploads:

reboot

Next steps include writing the boot data to the SD card so that I don’t need to boot over the USB serial connection each time.

  • Recent Posts

    • MIT Moves Quickly to Remove Diversity, Equity, and Inclusion, Suppress First Amendment Rights
    • Our Economy, Our Country, Our Union
    • Thanks to the Recovery Community
    • Linux on RISC-V SoC in FPGA
    • No Hands
  • Recent Comments

    • Archives

      • April 2025
      • February 2025
      • February 2024
      • December 2022
      • November 2022
      • October 2022
      • December 2021
      • December 2016
      • September 2016
      • May 2016
      • March 2016
      • January 2016
      • December 2015
    • Categories

      • Addiction
      • Artificial Intelligence
      • Bike
      • Family
      • Graphics
      • Hardware
      • Politics
    • Meta

      • Log in
      • Entries feed
      • Comments feed
      • WordPress.org
    Proudly powered by WordPress Theme: Parament by Automattic.