new makefile and avr-build
AVR Build / build (push) Failing after 22s

This commit is contained in:
Lukas
2026-04-29 15:58:19 +02:00
parent dc8f7424b9
commit 316cc44430
2 changed files with 20 additions and 42 deletions
+19 -41
View File
@@ -1,50 +1,28 @@
name: AVR Build
MCU ?= atmega644pa
F_CPU ?= 8000000UL
on:
push:
branches:
- dev
- live
- main
pull_request:
BUILD_TYPE ?= dev
VERSION ?= 0.1
PREFIX ?= ENO
jobs:
build:
runs-on: ubuntu-latest
CC = avr-gcc
OBJCOPY = avr-objcopy
steps:
- name: Checkout
uses: actions/checkout@v4
SRC = src/main.c
- name: Install AVR toolchain
run: |
apt-get update
apt-get install -y gcc-avr avr-libc binutils-avr make cppcheck
OUTDIR = build/$(BUILD_TYPE)
TARGET = $(OUTDIR)/$(PREFIX)_$(VERSION)
- name: Set build type from branch
id: vars
run: |
BRANCH="${GITHUB_REF_NAME}"
CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -Os -Wall -DVERSION=\"$(VERSION)\"
if [ "$BRANCH" = "dev" ]; then
echo "BUILD_TYPE=dev" >> $GITHUB_ENV
echo "PREFIX=DEV_ENO" >> $GITHUB_ENV
else
echo "BUILD_TYPE=live" >> $GITHUB_ENV
echo "PREFIX=ENO" >> $GITHUB_ENV
fi
all: $(TARGET).hex
echo "VERSION=${GITHUB_SHA::7}" >> $GITHUB_ENV
$(TARGET).elf: $(SRC)
@mkdir -p $(OUTDIR)
$(CC) $(CFLAGS) $< -o $@
- name: Code check
run: cppcheck --enable=all --error-exitcode=1 src/
$(TARGET).hex: $(TARGET).elf
$(OBJCOPY) -O ihex -R .eeprom $< $@
- name: Build firmware
run: |
make BUILD_TYPE=$BUILD_TYPE PREFIX=$PREFIX VERSION=$VERSION
- name: Upload hex
uses: actions/upload-artifact@v4
with:
name: firmware-${{ env.BUILD_TYPE }}
path: build/**/*.hex
size: $(TARGET).elf
avr-size $<