This Repository contains some software examples for use with the HiFive1-Board of SiFive and our binary-compatible Riscv-VP (repo). Here, an old version of the freedom-e-sdk of SiFive is pinned and used for buildin/uploading programs.
-
Prerequisites on ubuntu (see https://github.com/sifive/freedom-e-sdk):
sudo apt-get install autoconf automake libmpc-dev libmpfr-dev libgmp-dev gawk bison flex texinfo libtool libusb-1.0-0-dev make g++ pkg-config libexpat1-dev zlib1g-dev
-
Clone and update the sifive--hifive1 repository:
cd freedom-e-sdk git submodule update --init --recursive
-
Build your own toolchain or download and unpack a pre-build riscv-multilib toolchain, e.g. available from:
And make sure that the env variable RISCV_PATH is pointing to your toolchain-dir (without
/bin
)example:
export RISCV_PATH="/opt/riscv"
-
Build openocd (if you want to load a program on the board) in sifive--hifive1/freedom-e-sdk/:
make openocd # need only to be done once
-
Build and upload a program to the board:
make upload-snake
Optional: If you have the
hifive-vp
from the riscv-vp repository in your path, you may also start the simulation by typingmake sim-snake
-
Show program output:
screen /dev/ttyUSB1 115200
In case screen does not work use (this may happen when running screen a second time):
`cat /dev/ttyUSB1 # NOTE: need to run screen once before this command works`
Press the reset button on the board to restart (and thus see output). NOTE: /dev/ttyUSB0 is the debug interface.
To use Zephyr, see zephyr/RREADME.rst. (Install OS Packages, pip packages) To build for HiFive1, use example zephyrrc file, modify for your paths, rename to ~/.zephyrrc and source it(?). Source zephyr-env.sh. Then build your project:
mkdir build && cmake .. -DBOARD=$BOARD
make -j6
Basically the same procedure as freedom-e-sdk, but manual.
$ ${SDK_PATH}/work/build/openocd/prefix/bin/openocd -f ${SDK_PATH}/bsp/env/freedom-e300-hifive1/openocd.cfg &
$ riscv32-unknown-elf-gdb
set remotetimeout 240
target extended-remote localhost:3333
monitor reset halt
monitor flash protect 0 64 last off
load zephyr/zephyr.elf
monitor resume
FreeRTOS example uses 14.7kiB out of 16kiB RAM (with 2k stack):
size RISCV_HiFive1_GCC.elf -d
text data bss dec hex filename
17079 1076 13953 32108 7d6c RISCV_HiFive1_GCC.elf
Zephyr uses with the philosophers demo:
Memory region Used Size Region Size %age Used
ROM: 22960 B 12 MB 0.18%
RAM: 9440 B 16 KB 57.62%
IDT_LIST: 553 B 2 KB 27.00%
This work was supported in part by the German Federal Ministry of Education and Research (BMBF) within the project SATiSFy under contract no. 16KIS0821K.