RISC-V Toolchain for Unleashed

Is there a prebuilt toolchain for cross compiling Linux applications running on the Unleashed? I would like to build applications that use the full Linux GLIBC running on that board.

The system that ships with the Unleashed is a very minimal OS, not very useful for development work.

If you want to do real work on the Unleashed, then you need to install a real OS on it, like Debian, Ubuntu, OpenSuse, FreeBSD, OpenEmbedded/Yocto, buildroot, etc. They all come with compilers. OpenEmbedded/Yocto and buildroot use cross compilation, and will give you a cross compiler. Debian/Ubuntu/OpenSuse/FreeBSD work best if you build natively. Just install the compiler package and start building stuff. You can find pointers to OS distros here
https://github.com/riscv/riscv-wiki/wiki/RISC-V-Software-Status#operating-systems

We used github.com/sifive/freedom-u-sdk to build the system that comes with the board. If you check this out and build it you will get a cross compiler that should produce binaries that run on the board, but this is not the best way to use the board.

1 Like

Hi Jim. Is there a prebuilt version of the toolchain from freedom-u-sdk or do we have to build it from source?

We don’t have a prebuilt version of it. You will have to build it if you want it. The pre-built system really isn’t very useful. I’d suggest using one of the other solutions I mentioned.

We used github.com/sifive/freedom-u-sdk to build the system that comes with the board. If you check this out and build it you will get a cross compiler that should produce binaries that run on the board, but this is not the best way to use the board.

Hi, Jim, why you said freedom-u-sdk is not the best way to use the board? do you mean it’s better to use Debian, Ubuntu, OpenSuse, FreeBSD, OpenEmbedded/Yocto, buildroot, etc as you mentioned in last paragraph?

I said that the prebuilt system isn’t useful. freedom-u-sdk has gone through 3 major iterations. The first one, v1_0, is mostly non-upstream code, provides a very limited buildroot system, and not useful for real work. This is the one that ships with the board. The second one, archive/buildroot, is mostly upstream code with a better buildroot system, and u-boot support that can let you also boot a debian/fedora/etc rootfs. This is useful for real work. The third one, the current default branch, is an OpenEmbedded layer and this is also useful for real work.

Thank you, Jim. Your answer makes me know more history about freedom-u-sdk.

I am a newbie on riscv and trying to run Hifive Unleashed system on QEMU. So can we say freedom-u-sdk should be the most official sdk I can use to make all these elements (such as gcc/gdb/binutiles, linux, rootfs, bootloader, qemu and all I need) for this work?

I ask this due to I googled and see there are many solutions for this, besides buildroot, there are some different riscv sdks like meta-sifive, meta-riscv, freedom-u-sdk and etc, a bit of confused by this.

btw, why do you switch to openembedded, buildroot is not good enough? :wink: Will freedom-u-sdk continue supporting buildroot?

There are a great many ways to build and run linux. None of them are more official than any other. Just like there are many linux distros (debian, fedora, opensuse, etc) and none are more correct than the others. You just have to choose which one you want to use based on your requirements, and/or your personal preferences.

We are no longer working on the buildroot versions of freedom-u-sdk. Officially it is no longer supported, unofficially if you ask easy questions you will probably get answers. The upstream buildroot is still supported for RISC-V and there are probably people still working on it.

SiFive decided to standardize on OpenEmbedded for freedom-u-sdk. I wasn’t part of that discussion so I don’t know the exact details, but OpenEmbedded is widely used in industry and is well supported, so it is a reasonable choice.

OpenEmbedded is organized as layers. There is a core layer that has the base of the OS, and then layers that have optional features that sit on top of the core layer. meta-riscv is a RISC-V Foundation layer that sits on top of the base layers to add RISC-V specific support. meta-sifive is a SiFive layer that sits on top of meta-riscv and adds SiFive specific support. freedom-u-sdk is the SiFive linux distro that we support for running linux on the HiFive Unleashed board, and is currently implemented via the meta-sifive OpenEmbedded layer.

OpenEmbedded is nice if you want to build a system from scratch, and maybe customize exactly how it is built. If you just want to run linux and don’t need to build it, you could try one the desktop/server linux distros. Here are the fedora instructions for instance
https://fedoraproject.org/wiki/Architectures/RISC-V/Installing
And here are Debian instructions
https://wiki.debian.org/RISC-V