Skip to content

Instantly share code, notes, and snippets.

@franzflasch
Last active January 21, 2024 06:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save franzflasch/02a8aeb2f6ec8e942b14ee9929db38e9 to your computer and use it in GitHub Desktop.
Save franzflasch/02a8aeb2f6ec8e942b14ee9929db38e9 to your computer and use it in GitHub Desktop.
crosstool-ng risc-v - sifive hifive1 configuration

Howto build a crosscompiler for risc-v sifive-hifive1 with crosstool-ng

Create working dir

mkdir risc-v-gcc
cd risc-v-gcc

Fetch crosstool-ng

git clone https://github.com/crosstool-ng/crosstool-ng.git

Prepare crosstool-ng

./bootstrap
./configure <optionally specify --prefix installdir>
make && make install

Configure toolchain

Use riscv32-unknown-elf sample config as a base

ct-ng riscv32-unknown-elf

Adapt configuration for the hifive1:

ct-ng menuconfig
  • Enable newlib build (C-library section)
  • Enable "Build a multilib toolchain" (Target options section)

Build toolchain

ct-ng build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment