Skip to content
Mateusz Hołenko edited this page Jun 14, 2019 · 5 revisions

Running test firmware in Renode

You can use Renode to emulte LiteX and run firmware without an actual hardware.

Currently VexRiscv and PicoRV32 cores are supported.

Download, Configure and Enter the Build Environment

First, clone the Build Environment repository and set it up:

git clone https://github.com/timvideos/litex-buildenv.git
cd litex-buildenv

# configure target
export CPU=vexriscv
export PLATFORM=arty
export TARGET=net

# download the environment
./scripts/download-env.sh

# enter it
source scripts/enter-env.sh

Boot over the network

Once you are in the Build Environment, type:

(LX P=arty C=vexriscv) $ ./scripts/build-renode.sh

The script will:

  • download the latest Renode (if not present in the system) and unpack it to build/renode,
  • build bios and the selected firmware for the configured platform,
  • generate Renode platform based on LiteX configuration and save it in build/arty_net_vexriscv/renode/litex_buildenv.repl,
  • generate Renode script and save it in build/arty_net_vexriscv/renode/litex_buildenv.resc,
  • create the TAP interface (shared between the host and Renode) - might require sudo permissions,
  • start the tftp server on that interface.

If you need to manually stop or start the tftp server (e.g. after a reboot), then you can use:

(LX P=arty C=vexriscv) $ make tftpd_stop          # Stop any previously run tftp server
(LX P=arty C=vexriscv) $ make tftpd_start         # Start the tftp server again

If you have a cloned repository of Renode you want to use, set RENODE_BIN environment variable before running the script:

export RENODE_BIN=/path/to/my/renode/clone/output/bin/Release/Renode.exe
(LX P=arty C=vexriscv) $ ./scripts/build-renode.sh

As a result of running ./scripts/build-renode.sh you should see two windows.

The one with the Renode logo is called monitor and is used to manage the emulation. For the details on how to use it, see Renode documentation.

The second one gives access to uart:

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|
 SoC BIOS / CPU: VexRiscv / 100MHz
(c) Copyright 2012-2018 Enjoy-Digital
(c) Copyright 2007-2018 M-Labs Limited
Built Jun 14 2019 09:49:23
BIOS CRC passed (7e6dcbfa)
Initializing SDRAM...
SDRAM now under software control
Read leveling:
m0, b0: |00000000000000000000000000000000| delays: -
m0, b1: |00000000000000000000000000000000| delays: -
m0, b2: |00000000000000000000000000000000| delays: -
m0, b3: |00000000000000000000000000000000| delays: -
m0, b4: |00000000000000000000000000000000| delays: -
m0, b5: |00000000000000000000000000000000| delays: -
m0, b6: |00000000000000000000000000000000| delays: -
m0, b7: |00000000000000000000000000000000| delays: -
best: m0, b0 delays: -
m1, b0: |00000000000000000000000000000000| delays: -
m1, b1: |00000000000000000000000000000000| delays: -
m1, b2: |00000000000000000000000000000000| delays: -
m1, b3: |00000000000000000000000000000000| delays: -
m1, b4: |00000000000000000000000000000000| delays: -
m1, b5: |00000000000000000000000000000000| delays: -
m1, b6: |00000000000000000000000000000000| delays: -
m1, b7: |00000000000000000000000000000000| delays: -
best: m1, b0 delays: -
SDRAM now under hardware control
Memtest OK
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Booting from flash...
Error: Invalid flash boot image length 0x00000000
Booting from network...
Local IP : 192.168.100.50
Remote IP: 192.168.100.100
Fetching from: UDP/6069
Successfully downloaded 57104 bytes from boot.bin over TFTP
Unable to download cmdline.txt over TFTP
No command line parameters found
Unable to download initrd.bin over TFTP
No initial ramdisk found
Executing booted program at 0x40000000
HDMI2USB firmware booting...
hardware version info
===============================================
           DNA: 0000000000000000
           MAC: Unknown
gateware version info
===============================================
      platform: 
        target: 
      revision: 0000000000000000000000000000000000000000
firmware version info
===============================================
      platform: arty
        target: net
    git commit: e7c34d210083c5f32db8e9d08af02eacee08e49e
    git branch: master
  git describe: v0.0.4-491-ge7c34d2-dirty
    git status:
    --
     ? ../../../../third_party/litex
    --
         built: Jun 14 2019 09:49:25
        uptime: 00:00:00
-----------------------------------------------
MDIO mode: 10Mbps / link: down
uIP init done with ip 192.168.100.50
Etherbone listening on port 1234
Telnet listening on port 23
H2U 00:00:00>

If you want to quit the emulation, just type q in the monitor window.

Clone this wiki locally