Skip to content

Add script (and CI check) to check / update the autogenerated pioasm outputs #692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions .github/workflows/pioasm_outputs.yml
Original file line number Diff line number Diff line change
@@ -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

6 changes: 3 additions & 3 deletions pio/squarewave/generated/squarewave.pio.h
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions pio/squarewave/generated/squarewave_wrap.pio.h
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions pio/ws2812/generated/ws2812.pio.h
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions pio/ws2812/generated/ws2812.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
37 changes: 37 additions & 0 deletions update_pioasm_outputs.sh
Original file line number Diff line number Diff line change
@@ -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