There is no active support anymore for this repository. Nevertheless, it can still be used as it is.
This repository, maintained by SiFive Inc, makes it easy to get started developing software for the Freedom E and Freedom S Embedded RISC-V Platforms. This SDK is intended to work on any target supported by SiFive's distributions of the RISC-V GNU Toolchain.
Documentation for Freedom E SDK is available here
Freedom E SDK was recently transitioned to using the Freedom Metal compatibility library. If you're looking for the old Freedom E SDK, software examples, and board support files, you can find those on the v1_0 branch.
Freedom Metal (Documentation) is a library developed by SiFive for writing portable software for all of SiFive's RISC-V IP, RISC-V FPGA evaluation images, and development boards. Programs written against the Freedom Metal API are intended to build and run for all SiFive RISC-V targets. This makes Freedom Metal suitable for writing portable tests, bare metal application programming, and as a hardware abstraction layer for porting operating systems to RISC-V.
bsp/
)
bsp/<target>/
. For example, the HiFive 1
board support files for Freedom Metal are entirely within bsp/sifive-hifive1/
and consist of the following:metal/machine/platform.h
.FreeRTOS-metal/
):
software/
)
To use this SDK, you will need the following software available on your machine:
Details on installing the RISC-V and Segger software follow.
The RISC-V GNU Toolchain and OpenOCD are available from the SiFive Website at
https://www.sifive.com/software
For OpenOCD and/or RISC-V GNU Toolchain, download the .tar.gz for your platform,
and unpack it to your desired location. Then, use the RISCV_PATH
and
RISCV_OPENOCD_PATH
variables when using the tools:
cp openocd-<date>-<platform>.tar.gz /my/desired/location/
cp riscv64-unknown-elf-gcc-<date>-<platform>.tar.gz /my/desired/location
cd /my/desired/location
tar -xvf openocd-<date>-<platform>.tar.gz
tar -xvf riscv64-unknown-elf-gcc-<date>-<platform>.tar.gz
export RISCV_OPENOCD_PATH=/my/desired/location/openocd
export RISCV_PATH=/my/desired/location/riscv64-unknown-elf-gcc-<date>-<version>
The RISC-V QEMU Emulator is available from the SiFive Website at
https://www.sifive.com/software
Download the .tar.gz for your platform and unpack it to your desired location. Then, add QEMU to your path:
cp riscv-qemu-<version>-<date>-<platform>.tar.gz /my/desired/location
tar -xvf riscv-qemu-<version>-<date>-<platform>.tar.gz
export PATH=$PATH:/my/desired/location/riscv-qemu-<version>-<date>-<platform>/bin
Some targets supported by Freedom E SDK (like the SiFive HiFive1 Rev B) use Segger J-Link OB for programming and debugging. If you intend to use these targets, install the Segger J-Link Software and Documentation Pack for your machine:
Segger J-Link Software Downloads
This repository can be cloned by running the following commands:
git clone --recursive https://github.com/sifive/freedom-e-sdk.git
cd freedom-e-sdk
The --recursive
option is required to clone the git submodules included in the
repository. If at first you omit the --recursive
option, you can achieve
the same effect by updating submodules using the command:
git submodule update --init --recursive
If you'd like to update your SDK to the latest version:
git pull origin master
git submodule update --init --recursive
Freedom E SDK includes a number of Python scripts used during the build process
to parameterize the build of Freedom Metal to the target. The dependencies of
these scripts are tracked in requirements.txt
. Freedom E SDK manages its own
virtualenv, but there are some options which allow users to configure the
virtualenv to best suit your needs.
By default, Freedom E SDK will download Python packages from the Python Package Index when it creates the virtualenv. If you prefer to download dependencies ahead-of-time, you can run
make pip-cache
to download all Python packages. This mechanism downloads all of the dependencies pre-compiled for all platforms and Python versions supported by Freedom E SDK, so if you're trying to bring up Freedom E SDK on a system without an internet connection you can create the "pip cache" and then copy it to the connectionless machine with Freedom E SDK.
The location of the "pip cache" can be controlled with the environment variable
FREEDOM_E_SDK_PIP_CACHE_PATH
export FREEDOM_E_SDK_PIP_CACHE_PATH=/path/to/pip-cache
By default, the virtualenv is created in the venv
folder at the root of
Freedom E SDK. To change the location of the virtualenv, set the environment
variable FREEDOM_E_SDK_VENV_PATH
export FREEDOM_E_SDK_VENV_PATH=/path/to/venv
To compile a bare-metal RISC-V program:
make [PROGRAM=hello] [TARGET=freedom-e310-arty] [CONFIGURATION=debug] software
The square brackets in the above command indicate optional parameters for the
Make invocation. As you can see, the default values of these parameters tell
the build script to build the hello
example for the freedom-e310-arty
target
with the debug
configuration. If, for example, you wished to build the
timer-interrupt
example for the S51 Arty FPGA Evaluation target,
with the release
configuration, you would instead run the command
make PROGRAM=timer-interrupt TARGET=coreip-s51-arty CONFIGURATION=release software
Building a benchmark program is slightly special in that certain section is required to be loaded in specific memory region. A specialize linker file has been created for its optimal run.
make PROGRAM=dhrystone TARGET=coreip-e31-arty LINK_TARGET=ramrodata software
A link target exist specificly for freertos, even if default target might work on some examples. Here is an exemple of use :
make PROGRAM=example-freertos-blinky-pmp TARGET=sifive-hifive1-revb LINK_TARGET=freertos software
make [PROGRAM=hello] [TARGET=sifive-hifive1] [CONFIGURATION=debug] upload
make [PROGRAM=hello] [TARGET=sifive-hifive1] [CONFIGURATION=debug] debug
make [PROGRAM=hello] [TARGET=sifive-hifive1] [CONFIGURATION=debug] clean
You can export a program to a standalone project directory using the standalone
target. The resulting project will be locked to a specific TARGET
. Note
that this functionality is only supported for Freedom Metal programs, not the
Legacy Freedom E SDK.
STANDALONE_DEST
is a required argument to provide the desired project location.
make [PROGRAM=hello] [TARGET=sifive-hifive1] [INCLUDE_METAL_SOURCES=1] STANDALONE_DEST=/path/to/desired/location standalone
Run make help
for more commands.
Documentation, Forums, and much more available at