Skip to content

Commit

Permalink
[Core] Fix RISC-V toolchain installation
Browse files Browse the repository at this point in the history
The risc-v toolchain is only available on distributions based on Debian 11+
so we check for their availability before installing them.
  • Loading branch information
KarlK90 authored and zvecr committed Nov 20, 2021
1 parent 32215d5 commit 59914fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions platforms/chibios/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ ifeq ($(strip $(MCU)), risc-v)
endif
endif

# Default to compiling with picolibc for RISC-V targets if available,
# which is available by default on current (bullseye) debian based systems.
# Default to compiling with picolibc for RISC-V targets if available, which
# is available by default on distributions based on Debian 11+.
ifeq ($(shell $(TOOLCHAIN)gcc --specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
# Toolchain specific Compiler flags
# Note that we still link with our own linker script
Expand Down
14 changes: 10 additions & 4 deletions util/install/debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ _qmk_install_prepare() {
_qmk_install() {
echo "Installing dependencies"

sudo apt-get -yq install \
sudo apt-get --quiet --yes install \
build-essential clang-format diffutils gcc git unzip wget zip \
python3-pip binutils-avr gcc-avr avr-libc binutils-arm-none-eabi \
gcc-arm-none-eabi libnewlib-arm-none-eabi avrdude dfu-programmer \
dfu-util teensy-loader-cli libhidapi-hidraw0 libusb-dev \
picolibc-riscv64-unknown-elf gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf
dfu-util teensy-loader-cli libhidapi-hidraw0 libusb-dev

python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt
# RISC-V toolchains with picolibc support are only available for distributions based on Debian 11+.
if sudo apt-get install --simulate --quiet --yes picolibc-riscv64-unknown-elf gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf > /dev/null 2>&1; then
sudo apt-get --quiet --yes install picolibc-riscv64-unknown-elf \
gcc-riscv64-unknown-elf \
binutils-riscv64-unknown-elf
fi

python3 -m pip install --user -r "$QMK_FIRMWARE_DIR"/requirements.txt
}

0 comments on commit 59914fe

Please sign in to comment.