Renode, Fomu and EtherBone bridge example

This tutorial shows how to run a hybrid simulation where part of the platform is run in Renode and part on FPGA hardware.

System architecture

The system architecture consists of three main parts:

  • FOMU - Lattice iCE40UP5K-based board with RGB LED, connected to the host machine over USB;
  • EtherBone bridge, translating wishbone packets between TCP and USB;
  • Renode simulating the LiteX platform, running Zephyr OS that controls the RGB LED.

Prerequisites

Simulation

For the simulation part, you need to build Renode from sources according to the building instructions.

Hardware

For the hardware part, you need to have the FOMU board.

FOMU needs to be flashed with the Foboot bitstream containing the ValentyUSB IP core with a USB-Wishbone bridge. The prebuilt version of the bitstream is hosted by Antmicro.

EtherBone bridge

In order to connect Renode to FOMU you need to download the EtherBone-to-USB bridge shipped with LiteX.

Clone the repository and initialize the environment:

git clone https://github.com/enjoy-digital/litex
cd litex
./litex_setup.py init  # this will clone dependencies
export PYTHONPATH=`pwd`:`pwd`/litex:`pwd`/migen

Loading the bitstream

Download and make iceprog - open source programming software for Lattice iCE40:

git clone https://github.com/cliffordwolf/icestorm
cd icestorm/iceprog
make

Download the prebuilt bitstream:

wget https://antmicro.com/projects/renode/foboot-bitstream.bin-s_104250-fc5f419372eb9a3a0baa5556483163bcfccb7d33 -O foboot-bitstream.bin

Note

You can also build the bitstream yourself by following the instructions on the Foboot page.

Program the FPGA:

sudo iceprog foboot-bitstream.bin

Note

For convenience you can use the Fomu Programmer - the Open Hardware programming board for FOMU by Antmicro.

Runnning the demo

Plug FOMU into a USB port and verify that it has been recognized by looking at dmesg logs:

[65038.250957] usb 2-1: new full-speed USB device number 16 using xhci_hcd
[65038.409283] usb 2-1: New USB device found, idVendor=1209, idProduct=5bf0, bcdDevice= 1.01
[65038.409286] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[65038.409287] usb 2-1: Product: Fomu DFU Bootloader v1.7.2-3-g9013054
[65038.409288] usb 2-1: Manufacturer: Foosn

Start the EtherBone bridge from the LiteX repository:

cd litex
sudo python3 litex/tools/litex_server.py --usb --usb-vid 0x1209 --usb-pid 0x5bf0

Run the Zephyr OS image in simulation using the script shipped with Renode:

(monitor) start @scripts/complex/fomu/renode_etherbone_fomu.resc

Now you can control the HW LED form Zephyr’s shell using special commands:

uart:~$ led_toggle
uart:~$ led_breathe
led_toggle
toggles the green led
led_breathe
makes the blue led blink with a fade-in/fade-out effect