Porting LiteX Vex-RISCV to icesugar pro

The board can be bought in taobao.

Install sbt tool

$ echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
$ echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
$ curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
$ sudo apt-get update
$ sudo apt-get install sbt

Install picocom

sudo apt-get install picocom

Install RISC-V toolchain

$ wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz
$ tar -xvf riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz
$ export PATH=$PATH:$PWD/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/

Install Verilator

$ sudo apt install verilator
$ sudo apt install libevent-dev libjson-c-dev

Install LiteX

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

Install Linux-on-LiteX-vexriscv

$ sudo apt install build-essential device-tree-compiler wget git python3-setuptools
$ git clone https://github.com/litex-hub/linux-on-litex-vexriscv
$ cd linux-on-litex-vexriscv

Testing the LiteX

$ ./sim.py

Build the bitstream file

$ ./make.py --board=name of board --cpu-count=8 --build

View the Linux on LiteX

$ sudo picocom -b 115200 /dev/ttyACM0

Run LiteX on fpga board

Port the .bit file into the board
.bit file path: linux-on-litex-vexriscv/build/NameOfBoard/gateware/
Port the BOARD.bit file into the board

Now you can see:

port is : /dev/ttyACM0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no

Type [C-a] [C-h] to see available commands
Terminal ready

    __   _ __      _  __
   / /  (_) /____ | |/_/
  / /__/ / __/ -_)>  <
 /____/_/\__/\__/_/|_|

Build your hardware, easily!

(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs

BIOS CRC passed (f39409fb)

LiteX git sha1: e8322587

–=============== SoC ==================–
CPU: VexRiscv SMP-LINUX @ 50MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 64KiB
SRAM: 6KiB
L2: 2KiB
FLASH: 32768KiB
SDRAM: 32768KiB 16-bit @ 50MT/s (CL-2 CWL-2)

–========== Initialization ============–
Initializing SDRAM @0x40000000…
Switching SDRAM to software control.
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)…
Write: 0x40000000-0x40200000 2.0MiB
Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)…
Write speed: 15.6MiB/s
Read speed: 20.1MiB/s

Initializing W25Q256 SPI Flash @0x02000000…
Enabling Quad mode…
SPI Flash clk configured to 25 MHz
Memspeed at 0x2000000 (Sequential, 4.0KiB)…
Read speed: 2.6MiB/s
Memspeed at 0x2000000 (Random, 4.0KiB)…
Read speed: 1.3MiB/s

–============== Boot ==================–
Booting from serial…
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Booting from SDCard in SD-Mode…
Booting from boot.json…
Booting from boot.bin…
SDCard boot failed.
No boot medium found

–============= Console ================–

litex>