diff --git a/.github/workflows/pioasm_outputs.yml b/.github/workflows/pioasm_outputs.yml new file mode 100644 index 000000000..a75036e45 --- /dev/null +++ b/.github/workflows/pioasm_outputs.yml @@ -0,0 +1,30 @@ +name: Check pioasm output files +on: [push, pull_request] + +jobs: + check-pioasm-outputs: + # Prevent running twice for PRs from same repo + if: github.repository_owner == 'raspberrypi' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) + runs-on: [self-hosted, Linux, X64] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Checkout pico-sdk/develop + uses: actions/checkout@v4 + with: + repository: raspberrypi/pico-sdk + ref: develop + path: pico-sdk + + - name: Rebuild pioasm outputs + run: PICO_SDK_PATH=${{github.workspace}}/pico-sdk ./update_pioasm_outputs.sh + + - name: Check pioasm outputs for changes + run: | + if git status --porcelain | grep -q '^ M'; then + echo "::error title=outdated-files::Autogenerated pioasm output files are out of date - update by running update_pioasm_outputs.sh" + exit 1 + fi + diff --git a/pio/squarewave/generated/squarewave.pio.h b/pio/squarewave/generated/squarewave.pio.h index 7bcdc191e..0806ac240 100644 --- a/pio/squarewave/generated/squarewave.pio.h +++ b/pio/squarewave/generated/squarewave.pio.h @@ -1,6 +1,6 @@ -// -------------------------------------------------- // -// This file is autogenerated by pioasm; do not edit! // -// -------------------------------------------------- // +// ------------------------------------------------------------------------ // +// This file is autogenerated by pioasm version 2.2.1-develop; do not edit! // +// ------------------------------------------------------------------------ // #pragma once diff --git a/pio/squarewave/generated/squarewave_wrap.pio.h b/pio/squarewave/generated/squarewave_wrap.pio.h index 17ceee3cb..cb15e1a45 100644 --- a/pio/squarewave/generated/squarewave_wrap.pio.h +++ b/pio/squarewave/generated/squarewave_wrap.pio.h @@ -1,6 +1,6 @@ -// -------------------------------------------------- // -// This file is autogenerated by pioasm; do not edit! // -// -------------------------------------------------- // +// ------------------------------------------------------------------------ // +// This file is autogenerated by pioasm version 2.2.1-develop; do not edit! // +// ------------------------------------------------------------------------ // #pragma once diff --git a/pio/ws2812/generated/ws2812.pio.h b/pio/ws2812/generated/ws2812.pio.h index 720153700..a71ffe929 100644 --- a/pio/ws2812/generated/ws2812.pio.h +++ b/pio/ws2812/generated/ws2812.pio.h @@ -1,6 +1,6 @@ -// -------------------------------------------------- // -// This file is autogenerated by pioasm; do not edit! // -// -------------------------------------------------- // +// ------------------------------------------------------------------------ // +// This file is autogenerated by pioasm version 2.2.1-develop; do not edit! // +// ------------------------------------------------------------------------ // #pragma once diff --git a/pio/ws2812/generated/ws2812.py b/pio/ws2812/generated/ws2812.py index a10c77ed7..7fb5d598b 100644 --- a/pio/ws2812/generated/ws2812.py +++ b/pio/ws2812/generated/ws2812.py @@ -1,6 +1,6 @@ -# -------------------------------------------------- # -# This file is autogenerated by pioasm; do not edit! # -# -------------------------------------------------- # +# ------------------------------------------------------------------------ # +# This file is autogenerated by pioasm version 2.2.1-develop; do not edit! # +# ------------------------------------------------------------------------ # import rp2 from machine import Pin diff --git a/update_pioasm_outputs.sh b/update_pioasm_outputs.sh new file mode 100755 index 000000000..1ec53bf27 --- /dev/null +++ b/update_pioasm_outputs.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Helper-script to update the pioasm-generated files in pico-examples repo +PIOASM_COMMENT_STRING="This file is autogenerated by pioasm" +if [ -z $PICO_SDK_PATH ]; then + echo "PICO_SDK_PATH envvar not set" + exit 1 +fi +if [ ! -d $PICO_SDK_PATH ]; then + echo "PICO_SDK_PATH envvar ($PICO_SDK_PATH) is invalid" + exit 1 +fi +# convert to absolute path +PICO_SDK_PATH=$(realpath $PICO_SDK_PATH) +BUILD_DIR=$(mktemp -d -p .) +cleanup() { + if [[ -d "$BUILD_DIR" ]]; then + rm -rf "$BUILD_DIR" + fi +} +trap cleanup EXIT +SCRIPTNAME=$(basename "$0") +PIOASM_OUTPUT_DIRS=() +while read -r DIRNAME; do + if [ "$DIRNAME" != "$SCRIPTNAME" ]; then + PIOASM_OUTPUT_DIRS+=("$DIRNAME") + fi +done <<< "$(git grep -l "$PIOASM_COMMENT_STRING" | cut -d/ -f1-2 | sort | uniq)" +while read -r FILENAME; do + if [ "$FILENAME" != "$SCRIPTNAME" ]; then + rm "$FILENAME" + fi +done <<< "$(git grep -l "$PIOASM_COMMENT_STRING")" +cmake -S . -B "$BUILD_DIR" -DPICO_SDK_PATH=$PICO_SDK_PATH -DPICO_NO_PICOTOOL=1 +for DIRNAME in "${PIOASM_OUTPUT_DIRS[@]}"; do + make -j4 -C "$BUILD_DIR/$DIRNAME" +done +cleanup