From 169357de41c01791304e4f42edfe2bcd7ad0d03e Mon Sep 17 00:00:00 2001 From: CaffeLatteIV Date: Thu, 20 Nov 2025 19:34:12 +0100 Subject: [PATCH 1/2] Feat: Implement support for 'riscv64-elf-gcc' toolchain This commit introduces logic to detect and utilize the 'riscv64-elf-gcc' compiler, commonly provided by Arch Linux and other distributions for RISC-V embedded development. The existing build system logic primarily checks for the 'riscv32-unknown-linux-gnu-gcc' and 'riscv64-unknown-elf-gcc' toolchains. The modified search priority is: 1. Risc-V 32 bit: `riscv32-unknown-linux-gnu-gcc` 2. Risc-V 64 bit: `riscv64-unknown-elf-gcc` 3. Risc-V (arch) 64 bit: `riscv64-elf-gcc` I would also suggest that this order can be upgraded by searching for the Risc-V 64 bit before searching for the 32 bit one. **Notes:** The Linux-targeting toolchain, 'riscv64-linux-gnu-gcc', is also available on arch, further testing is needed to assess its suitability versus the 'elf' variant for specific build configurations targeting full operating systems. --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5da1a1d..4d5a362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,13 +23,17 @@ configure_file(config.h.in config.h) set(XT_PREFIXES ${RISCV_TOOL_PREFIX}) if(NOT XT_PREFIXES) - find_program(GCC_TEST riscv32-unknown-linux-gnu-gcc) - if (GCC_TEST) + find_program(GCC_TEST_32 riscv32-unknown-linux-gnu-gcc) + find_program(GCC_TEST_64 riscv64-unknown-elf-gcc) + if (GCC_TEST_32) set(XT_PREFIXES riscv32-unknown-linux-gnu- ${XT_PREFIXES}) - else () + elseif (GCC_TEST_64) set(XT_PREFIXES riscv64-unknown-elf- ${XT_PREFIXES}) + else () + set(XT_PREFIXES riscv64-elf- + ${XT_PREFIXES}) endif() endif() From ee045f46daba06d72176efca017571f5c7856b65 Mon Sep 17 00:00:00 2001 From: Mattia Babbini Date: Thu, 20 Nov 2025 20:58:47 +0100 Subject: [PATCH 2/2] Update README with Arch Linux build instructions Added installation instructions for Arch Linux and emulator usage. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 3290cde..dcfa300 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,18 @@ SPDX-License-Identifier: GPL-3.0-or-later mkdir -p build && cd build && cmake .. && make && sudo make install ``` +#### Compilare l'emulatore su Arch Linux +Installazione delle dipendenze: +```bash +sudo pacman -S riscv64-elf-gcc boost +``` +Clonazione e compilazione di uriscv: +```bash +git clone https://github.com/virtualsquare/uriscv +cd uriscv +mkdir -p build && cd build && cmake .. && make && sudo make install +``` + ### Eseguire l'emulatore ```bash uriscv-cli