Skip to content

Commit

Permalink
Use riscv-none-elf from Xpack project.
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Sep 16, 2024
1 parent 5fb4414 commit 5c18dce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@ jobs:
- name: Cache Scala
uses: coursier/cache-action@v5
- name: Install dependencies
run: sudo apt install verilator gcc-riscv64-unknown-elf cmake -y
run: |
sudo apt install verilator cmake -y
wget -q --show-progress https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-2/xpack-riscv-none-elf-gcc-14.2.0-2-linux-x64.tar.gz -O gcc.tar.gz
tar xvf gcc.tar.gz --directory=/opt
echo "RISCV_TOOL_PATH_PREFIX=/opt/xpack-riscv-none-elf-gcc-14.2.0-2" >> $GITHUB_ENV
- name: Run Chisel unit tests
run: sbt 'test'
- name: Build emulator and SDK
run: source env.bash && cmake -Bbuild && cd build && make all install
- name: Run C tests
run: |
# Set environment to find RISC-V compiler
export RISCV_TOOL_PATH_PREFIX=~/riscv-embed-gcc
source env.bash
# Step into SDK and run tests
cd sdk && cmake -B build && cd build && make && ctest
- name: Run multithreaded C tests
run: |
# Set environment to find RISC-V compiler
export RISCV_TOOL_PATH_PREFIX=~/riscv-embed-gcc
source env.bash
# Run multiple tests with script
./scripts/run_multiple_tests.sh
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ For more information on the processor architecture:
# Tools and installation

## RISC-V Compiler
We use the Newlib version of RISC-V GCC which can be installed on Ubuntu with
We use the `riscv-none-elf-gcc` compiler provided by xPack project. To install this toolchain to `/opt/xpack-riscv-none-elf-gcc-14.2.0-2` perform the following steps.

```
sudo apt install gcc-riscv64-unknown-elf
wget -q --show-progress https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-2/xpack-riscv-none-elf-gcc-14.2.0-2-linux-x64.tar.gz -O gcc.tar.gz
tar xvf gcc.tar.gz --directory=/opt
```

Then add `export RISCV_TOOL_PATH_PREFIX=/opt/xpack-riscv-none-elf-gcc-14.2.0-2` to your `~/.bashrc`

There are also versions for macOS and Windows. Refer to the [documentation](https://xpack-dev-tools.github.io/riscv-none-elf-gcc-xpack/) for more information.

## Verilator
We use the `verilator` toolchain for running emulations of the core. Install it and check that the version is greater than 4.038.

Expand Down
2 changes: 1 addition & 1 deletion sdk/cmake/riscv-toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(RISCV_HOST_TAG linux)
set(RISCV_TOOL_PATH $ENV{RISCV_TOOL_PATH_PREFIX} CACHE PATH "RISC-V tool path" FORCE)

set(RISCV_TOOLCHAIN_ROOT "${RISCV_TOOL_PATH}/bin" CACHE PATH "RISC-V compiler path")
set(RISCV_TOOLCHAIN_PREFIX "riscv64-unknown-elf-" CACHE STRING "RISC-V toolchain prefix")
set(RISCV_TOOLCHAIN_PREFIX "riscv-none-elf-" CACHE STRING "RISC-V toolchain prefix")
set(CMAKE_FIND_ROOT_PATH ${RISCV_TOOLCHAIN_ROOT})
list(APPEND CMAKE_PREFIX_PATH "${RISCV_TOOLCHAIN_ROOT}")

Expand Down

0 comments on commit 5c18dce

Please sign in to comment.