Skip to content

stm32l4: Added option bytes support for the STM32WBxx series (this ha… #726

stm32l4: Added option bytes support for the STM32WBxx series (this ha…

stm32l4: Added option bytes support for the STM32WBxx series (this ha… #726

name: build and upload
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# This controls the concurrency level for the jobs and how it's calculated
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a job for each supported OS in the form `build-<os>`
build-firmware:
# The type of runner that the job will run on
runs-on: ${{ matrix.os.id }}
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues
strategy:
matrix:
os:
- {id: ubuntu-22.04, name: jammy}
compiler:
- '12.2.Rel1'
probe:
- '96b_carbon'
- 'bluepill'
- 'ctxlink'
- 'f072'
- 'f3'
- 'f4discovery'
- 'hydrabus'
- 'launchpad-icdi'
- 'native'
- 'stlink'
- 'stlinkv3'
- 'swlink'
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Build a suitable runtime environment
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "$GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Setup and use a suitable ARM GCC for the firmware
- name: Setup ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: ${{ matrix.compiler }}
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
sudo python3 -m pip install --upgrade pip setuptools wheel
sudo python3 -m pip install meson ninja
working-directory: ${{ runner.temp }}
# Record the versions of all the tools used in the build
- name: Version tools
shell: bash
run: |
cc --version
arm-none-eabi-gcc --version
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
# Build the firmware for all platform variants (currently available)
- name: Build
run: |
meson setup build --cross-file cross-file/${{ matrix.probe }}.ini
meson compile -C build
mkdir src/artefacts
mv build/blackmagic_*_firmware.{elf,bin} src/artefacts
# Package up the artefacts and upload them
- name: Archive
uses: actions/upload-artifact@v4
with:
name: blackmagic_firmware-${{ matrix.probe }}
path: src/artefacts/*
if-no-files-found: error
# Package and upload logs if the build fails so we can dissect why
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-firmware-${{ matrix.probe }}
path: ${{ github.workspace }}/build/meson-logs/*
retention-days: 5
package-firmware:
runs-on: ubuntu-latest
needs: build-firmware
steps:
- name: Merge firmware artefacts
uses: actions/upload-artifact/merge@v4
with:
name: blackmagic_firmware
pattern: blackmagic_firmware-*
delete-merged: true
build-linux:
# The type of runner that the job will run on
runs-on: ${{ matrix.os.id }}
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues
strategy:
matrix:
os:
- {id: ubuntu-22.04, name: jammy}
compiler:
- 'clang-13' # Native Clang compiler for the CI image
- 'clang-18' # Latest Clang compiler from the apt mirror
- 'gcc-11' # Native GCC compiler for the CI image
- 'gcc-13' # Latest GCC compiler from the toolchain PPA
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Build a suitable runtime environment
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "$GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Install a suitable system compiler for the build
- name: Setup system GCC
if: startsWith(matrix.compiler, 'gcc')
shell: bash
run: |
CXX=${CC/#gcc/g++}
sudo apt-add-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install $CC $CXX
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "BUILD_OPTS=" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
- name: Setup system Clang
if: startsWith(matrix.compiler, 'clang')
shell: bash
run: |
wget https://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm-snapshot.gpg.key
rm llvm-snapshot.gpg.key
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }}${CC/#clang/} main"
sudo apt-get update
sudo apt-get install $CC
CXX=${CC/#clang/clang++}
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "BUILD_OPTS=-Dhidapi:b_lto=false -Dlibusb:b_lto=false" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
working-directory: ${{ runner.temp }}
# Install the dependencies needed for a full BMDA build
- name: Install dependencies
run: sudo apt-get -y install libudev-dev
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
sudo python3 -m pip install --upgrade pip setuptools wheel
sudo python3 -m pip install meson ninja
working-directory: ${{ runner.temp }}
# Record the versions of all the tools used in the build
- name: Version tools
shell: bash
run: |
$CC --version
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
# Build BMDA for Linux
- name: Build Linux BMDA
run: |
meson setup build $BUILD_OPTS
meson compile -C build
mkdir src/artefacts
mv build/blackmagic src/artefacts/blackmagic-bmda
# Package up the artefact and upload it
- name: Archive
uses: actions/upload-artifact@v4
with:
name: blackmagic_linux-${{ matrix.os.id }}-${{ matrix.compiler }}
path: src/artefacts/*
if-no-files-found: error
# Package and upload logs if the build fails so we can dissect why
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-linux-${{ matrix.os.id }}-${{ matrix.compiler }}
path: ${{ github.workspace }}/build/meson-logs/*
retention-days: 5
build-windows-mingw:
# Name the job more appropriately so we can tell which windows and which MinGW ABI is in use
name: 'build-mingw (${{ matrix.os }}, ${{ matrix.sys.abi }})'
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Set the shell so run steps will execute from in msys2 correctly by default
defaults:
run:
shell: msys2 {0}
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues
strategy:
matrix:
os:
- windows-2022
sys:
- {abi: ucrt64, env: ucrt-x86_64, compiler: gcc}
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Install a suitable system compiler for the build
- name: Use MinGW from MSYS
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys.abi}}
update: true
path-type: inherit
pacboy: >-
toolchain:p
meson:p
# Build a suitable runtime environment
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "$GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Configure the system toolchain environment
- name: Setup system GCC
if: matrix.sys.compiler == 'gcc'
run: |
CXX=${CC/#gcc/g++}
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
env:
CC: ${{ matrix.sys.compiler }}
- name: Setup system Clang
if: matrix.sys.compiler == 'clang'
run: |
CXX=${CC/#clang/clang++}
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
env:
CC: ${{ matrix.sys.compiler }}
# Record the versions of all the tools used in the build
- name: Version tools
run: |
$CC --version
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
# Build the default BMDA configuration
- name: Build full BMDA
run: |
meson setup build
meson compile -C build
mkdir src/artefacts
mv build/blackmagic.exe src/artefacts/blackmagic-bmda.exe
mv build/ftd2xx.dll src/artefacts
# Package up all the artefacts and upload them
- name: Archive firmware build artefacts as a zip
uses: actions/upload-artifact@v4
with:
name: blackmagic_${{ matrix.os }}-${{ matrix.sys.abi }}-${{ matrix.sys.compiler }}
path: src/artefacts/*
if-no-files-found: error
# Package and upload logs if the build fails so we can dissect why
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.os }}-${{ matrix.sys.abi }}-${{ matrix.sys.compiler }}
path: ${{ github.workspace }}/build/meson-logs/*
retention-days: 5
build-macos:
# Name the job more appropriately so we can tell which Xcode/macOS version is in use
name: 'build-macos (${{ matrix.os.id }})'
# The type of runner that the job will run on
runs-on: ${{ matrix.os.id }}
# Set the shell so run steps will execute inside the native environment
defaults:
run:
shell: bash
# We define a matrix of compilers and OS versions to build against so we can cover a variety of
# suitable compilation environments and early discover issues. The `build-and-upload`
# workflow contains an extended set.
strategy:
matrix:
os:
- {id: macos-12, name: '12'}
- {id: macos-13, name: '13'}
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Build a suitable runtime environment
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
# The GITHUB_WORKSPACE step here fixes https://github.com/actions/runner/issues/2058 which is an ongoing issue.
run: |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
# Install and setup a suitable Meson + Ninja
- name: Setup Meson + Ninja
run: |
brew install meson ninja
# Record the versions of all the tools used in the build
- name: Version tools
run: |
cc --version || true
ld --version || true
meson --version
ninja --version
# Checkout the repository and branch to build under the default location
- name: Checkout
uses: actions/checkout@v4
# Build the default BMDA configuration
- name: Build full BMDA
run: |
meson setup build
meson compile -C build
mkdir src/artefacts
mv build/blackmagic src/artefacts/blackmagic-bmda
# Package up the artefact and upload it
- name: Archive
uses: actions/upload-artifact@v4
with:
name: blackmagic_macos-${{ matrix.os.name }}
path: src/artefacts/*
if-no-files-found: error
# Package and upload logs if the build fails so we can dissect why
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-macos-${{ matrix.os.name }}
path: ${{ github.workspace }}/build/meson-logs/*
retention-days: 5