Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/workflows/build-firmware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Build Frozen Firmware

# This workflow builds custom CircuitPython firmware with PySquared libraries
# frozen (compiled into the firmware binary).
#
# Triggered on:
# - Push to tags matching v* (e.g., v2.0.0)
# - Manual workflow dispatch
#
# The workflow:
# 1. Sets up the ARM toolchain
# 2. Clones CircuitPython at a pinned version
# 3. Sets up frozen modules (PySquared + dependencies)
# 4. Builds firmware for all PROVES boards
# 5. Uploads firmware files as release artifacts

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
circuitpython_version:
description: 'CircuitPython version to build'
required: false
default: '9.2.0'

jobs:
build-firmware:
name: Build firmware for ${{ matrix.board }}
runs-on: ubuntu-latest

strategy:
matrix:
# Build firmware for all supported PROVES boards
# Note: Use standard Raspberry Pi Pico boards until custom PROVES
# board definitions are added to CircuitPython
board:
- raspberry_pi_pico
- raspberry_pi_pico_w

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install ARM toolchain and dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
git \
python3 \
python3-pip \
gcc-arm-none-eabi \
gettext

- name: Set CircuitPython version
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.circuitpython_version }}" >> $GITHUB_OUTPUT
else
echo "version=9.2.0" >> $GITHUB_OUTPUT
fi

- name: Build firmware
run: |
cd firmware
make setup CIRCUITPYTHON_VERSION=${{ steps.version.outputs.version }}

# Note: add_dependencies.py needs to be updated to actually add submodules
# For now, we just link PySquared
# ./add_dependencies.py # This would add all dependencies

# Build firmware
make firmware BOARD=${{ matrix.board }}

- name: Upload firmware artifact
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.board }}
path: firmware/build/${{ matrix.board }}-frozen-*.uf2
if-no-files-found: error

- name: Create release (if tag)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: firmware/build/${{ matrix.board }}-frozen-*.uf2
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Job to verify firmware can be built
verify-build:
name: Verify firmware build system
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip

- name: Test dependency parser
run: |
cd firmware
python3 add_dependencies.py --list

- name: Verify Makefile targets
run: |
cd firmware
make help
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ If you want to contribute to PySquared, follow these steps:
## Documentation

- [Getting Started](https://proveskit.github.io/pysquared/getting-started/)
- [Frozen Modules](https://proveskit.github.io/pysquared/frozen-modules/) - Build custom CircuitPython firmware
- [Design Guide](https://proveskit.github.io/pysquared/design-guide/)
- [Configuration](https://proveskit.github.io/pysquared/api/#pysquared.config)
- [Error Handling & Logging](https://proveskit.github.io/pysquared/api/#pysquared.logger)
Expand Down
Loading