Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e87561b37
|
@@ -0,0 +1,66 @@
|
|||||||
|
name: Build and Release Firmware
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
TARGET: thumbv8m.main-none-eabihf
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust Toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
- name: Install cargo-binutils
|
||||||
|
run: cargo install cargo-binutils
|
||||||
|
- name: Build Firmware Binaries
|
||||||
|
run: |
|
||||||
|
cd firmware
|
||||||
|
|
||||||
|
# Array of "variant_name:features"
|
||||||
|
VARIANTS=(
|
||||||
|
"cs4398:cs4398,hid"
|
||||||
|
"ak4490:ak4490,hid"
|
||||||
|
"evk:evk,hid"
|
||||||
|
)
|
||||||
|
|
||||||
|
mkdir -p ../dist
|
||||||
|
|
||||||
|
for entry in "${VARIANTS[@]}"; do
|
||||||
|
IFS=":" read -r name features <<< "$entry"
|
||||||
|
echo "Building variant: $name with features: $features"
|
||||||
|
|
||||||
|
# 1. Compile release binary
|
||||||
|
cargo build --release --target ${{ env.TARGET }} --no-default-features --features "$features"
|
||||||
|
|
||||||
|
# 2. Paths setup
|
||||||
|
ELF_PATH="../target/${{ env.TARGET }}/release/guac"
|
||||||
|
HEX_PATH="../target/${{ env.TARGET }}/release/guac-${name}.hex"
|
||||||
|
RENAMED_ELF="../target/${{ env.TARGET }}/release/guac-${name}.elf"
|
||||||
|
|
||||||
|
# 3. Create .hex file via rust-objcopy
|
||||||
|
cargo objcopy --release --target ${{ env.TARGET }} --no-default-features --features "$features" -- -O ihex "$HEX_PATH"
|
||||||
|
cp "$ELF_PATH" "$RENAMED_ELF"
|
||||||
|
|
||||||
|
# 4. Package ELF and HEX into target-specific ZIP
|
||||||
|
ZIP_NAME="guac-firmware-${name}.zip"
|
||||||
|
zip -j "../dist/${ZIP_NAME}" "$RENAMED_ELF" "$HEX_PATH"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Create Gitea Release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
files: dist/*.zip
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "1.95.0"
|
||||||
|
targets = ["thumbv8m.main-none-eabihf"]
|
||||||
|
components = ["llvm-tools-preview"]
|
||||||
Reference in New Issue
Block a user