Skip to content

Commit

Permalink
Attempt Windows toolchain build
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Aug 29, 2024
1 parent d897938 commit 63a716b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
bin/picotool-*-x64-win.zip
bin/pico-sdk-tools-*-x64-win.zip
bin/openocd-*-x64-win.zip
bin/riscv-toolchain-*-x64-win.zip
- name: Add Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -35,6 +36,7 @@ jobs:
bin/picotool-*-x64-win.zip
bin/pico-sdk-tools-*-x64-win.zip
bin/openocd-*-x64-win.zip
bin/riscv-toolchain-*-x64-win.zip
build_macos:
name: Build MacOS
Expand Down
21 changes: 20 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,16 @@ if (-not $SkipDownload) {
msys 'pacman --noconfirm -Suu'

msys "pacman -S --noconfirm --needed autoconf automake git libtool make pactoys pkg-config wget"
# Risc-V requirements
# base-devel minus texinfo
msys "pacman -S --noconfirm --needed base binutils bison diffstat diffutils dos2unix file flex gawk gettext grep make patch sed tar"
msys "pacman -S --noconfirm --needed curl python3 gmp gperf patchutils expat"
# pacboy adds MINGW_PACKAGE_PREFIX to package names suffixed with :p
msys "pacboy -S --noconfirm --needed cmake:p ninja:p toolchain:p libusb:p hidapi:p"
msys "pacboy -S --noconfirm --needed cmake:p ninja:p toolchain:p libusb:p hidapi:p libslirp:p mpc:p bc:p zlib:p mpfr:p"
}

if (-not (Test-Path ".\build\riscv-install\mingw$bitness")) {
msys "cd build && ../packages/windows/riscv/build-riscv-gcc.sh $bitness $mingw_arch"
}

if (-not (Test-Path ".\build\openocd-install\mingw$bitness")) {
Expand Down Expand Up @@ -297,3 +305,14 @@ $filename = 'openocd-{0}-{1}.zip' -f

Write-Host "Saving OpenOCD package to $filename"
exec { tar -a -cf "bin\$filename" -C "build\openocd-install\mingw$bitness\bin" * -C "..\share\openocd" "scripts" }

# Package Risc-V separately as well

$version = "14"

$filename = 'riscv-toolchain-{0}-{1}.zip' -f
$version,
$suffix

Write-Host "Saving Risc-V toolchain package to $filename"
exec { tar -a -cf "bin\$filename" -C "build\riscv-install" * }
19 changes: 19 additions & 0 deletions packages/windows/riscv/build-riscv-gcc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -euo pipefail

BITNESS=$1
ARCH=$2

INSTALLDIR="riscv-install"
rm -rf $INSTALLDIR
mkdir -p $INSTALLDIR

BUILDDIR=$(pwd)

cd riscv-gnu-toolchain
./configure --prefix=$BUILDDIR/$INSTALLDIR --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" --with-gcc-src=$BUILDDIR/gcc
make -j$(nproc) gcc
make -j$(nproc) gdb
make -j$(nproc) newlib
make -j$(nproc)

0 comments on commit 63a716b

Please sign in to comment.