Skip to content

Build All Windows

Build All Windows #33

Workflow file for this run

# Manually started action to build Picotool/OpenOCD for Windows and upload to an artifact
name: Build All Windows
on: [workflow_dispatch]
jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
matrix:
include:
- { sys: mingw64, env: x86_64 }
- { sys: mingw32, env: i686 }
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
install: development mingw-w64-${{matrix.env}}-make mingw-w64-${{matrix.env}}-pkg-config mingw-w64-${{matrix.env}}-autotools texinfo mingw-w64-${{matrix.env}}-hidapi git mingw-w64-${{matrix.env}}-toolchain patch mingw-w64-${{matrix.env}}-cmake pkg-config
- name: Build Picotool ${{matrix.env}}
run: |
pushd .
# Manually bring in libusb from upstream, mingw not finding it anymore
mkdir libusb
cd libusb
wget --quiet https://github.com/earlephilhower/pico-quick-toolchain/raw/master/blobs/libusb-1.0.27-windows.tar.bz2
tar jxf ./libusb-1.0.27-windows.tar.bz2
cd ..
export LIBUSB_ROOT=$PWD/libusb
if [ ${{matrix.env}} == i686 ]; then export LIBUSB1_LIBS="-L$PWD/libusb/MinGW32/static -lusb-1.0"; fi
if [ ${{matrix.env}} == x86_64 ]; then export LIBUSB1_LIBS="-L$PWD/libusb/MinGW64/static -lusb-1.0"; fi
# Get the SDK ready
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
git checkout 2.0.0
git submodule update --init
cd ..
# Check out this branch
git clone https://github.com/raspberrypi/picotool.git
cd picotool
git checkout 2.0.0
export gitrev=$(git rev-parse --short HEAD))
# Build!
mkdir build
cd build
cmake -G"MSYS Makefiles" -DLIBUSB_ROOT="$LIBUSB_ROOT" -DLIBUSB_INCLUDE_DIR="../libusb/include" -DLIBUSB_LIBRARIES="$LIBUSB1_LIBS" -DPICO_SDK_PATH=../../pico-sdk -S .. -B .
make VERBOSE=1 -j
strip picotool.exe
# Package
mkdir /tmp/picotool
cp /mingw*/bin/libhidapi*.dll /tmp/picotool/.
if [ ${{matrix.env}} == i686 ]; then cp $LIBUSB_ROOT/MinGW32/DLL/* /tmp/picotool/.; export pioarch=windows_x86; export piotup=i686-w64-mingw32; fi
if [ ${{matrix.env}} == x86_64 ]; then cp $LIBUSB_ROOT/MinGW64/dll/* /tmp/picotool/.; export pioarch=windows_amd64; export piotup=x86_64-w64-mingw32; fi
cp /mingw*/bin/libstdc++*.dll /tmp/picotool/.
cp /mingw*/bin/libwinpthread*.dll /tmp/picotool/.
cp /mingw*/bin/libgcc*.dll /tmp/picotool/.
cp -a picotool.exe /tmp/picotool/.
cp -a ../LICENSE.TXT /tmp/picotool/.
cp -a ../README.md /tmp/picotool/.
echo -e '{\n "description": "picotool-utility",\n "name": "tool-picotool-rp2040-earlephilhower",\n "system": [ "'$pioarch'" ],\n "url": "https://github.com/earlephilhower/pico-quick-toolchain",\n "version": "5.120300.'$(date +%y%m%d)'"\n}' > /tmp/picotool/package.json
pushd /tmp; zip -9 /tmp/$piotup.piocotool-$gitrev.$(date +%y%m%d).zip piocotool; popd
tar cvf ../../picotool.${{matrix.env}}.tar -C /tmp picotool*zip
popd
- name: Upload Picotool ${{matrix.env}}
uses: actions/upload-artifact@v4
with:
name: picotool.${{matrix.env}}.tar
path: picotool.${{matrix.env}}.tar
- name: Build OpenOCD ${{matrix.env}}
run: |
export LIBUSB_ROOT=$PWD/libusb
export LIBUSB1_CFLAGS=-I$PWD/libusb/include
if [ ${{matrix.env}} == i686 ]; then export LIBUSB1_LIBS="-L$PWD/libusb/MinGW32/static -lusb-1.0"; fi
if [ ${{matrix.env}} == x86_64 ]; then export LIBUSB1_LIBS="-L$PWD/libusb/MinGW64/static -lusb-1.0"; fi
git clone https://github.com/raspberrypi/openocd.git
pushd openocd
git checkout sdk-2.0.0
bash bootstrap
./configure --prefix=/tmp/openocd --enable-picoprobe --enable-cmsis-dap-v2 --enable-cmsis-dap \
--disable-dummy --disable-rshim --disable-ftdi --disable-stlink --disable-ti-icdi \
--disable-ulink --disable-usb-blaster-2 --disable-ft232r --disable-vsllink \
--disable-xds110 --disable-osbdm --disable-opendous --disable-aice --disable-usbprog \
--disable-rlink --disable-armjtagew --disable-nulink --disable-kitprog \
--disable-usb-blaster --disable-presto --disable-openjtag --disable-jlink \
--disable-parport --disable-parport-ppdev --disable-parport-giveio --disable-jtag_vpi \
--disable-jtag_dpi --disable-amtjtagaccel --disable-zy1000-master --disable-zy1000 \
--disable-ioutil --disable-bcm2835gpio --disable-imx_gpio --disable-ep93xx \
--disable-at91rm9200 --disable-gw16012 --disable-oocd_trace --disable-buspirate \
--disable-sysfsgpio --disable-xlnx-pcie-xvc --disable-minidriver-dummy \
--disable-remote-bitbang --disable-werror
# RP2040 has "UINT" but it's not defined anywhere here. Yay
echo "typedef unsigned int uint;" >> config.h
make -j
make install
echo Copying needed DLLs and packaging as tarball
cp /mingw*/bin/libhidapi*.dll /tmp/openocd/bin/.
if [ ${{matrix.env}} == i686 ]; then cp $LIBUSB_ROOT/MinGW32/DLL/* /tmp/openocd/bin/.; fi
if [ ${{matrix.env}} == x86_64 ]; then cp $LIBUSB_ROOT/MinGW64/dll/* /tmp/openocd/bin/.; fi
cp /mingw*/bin/libstdc++*.dll /tmp/openocd/bin/.
cp /mingw*/bin/libwinpthread*.dll /tmp/openocd/bin/.
cp /mingw*/bin/libgcc*.dll /tmp/openocd/bin/.
popd
strip /tmp/openocd/bin/openocd.exe
tar cvf openocd.${{matrix.env}}.tar -C /tmp openocd
- name: Upload OpenOCD ${{matrix.env}}
uses: actions/upload-artifact@v4
with:
name: openocd.${{matrix.env}}.tar
path: openocd.${{matrix.env}}.tar