From 22979aff811b8bf0c3254728180f17b9559ef0f0 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 16:41:55 +0100 Subject: [PATCH 1/8] Correctly freeze PicoFX library. --- boards/PIMORONI_TINYFX/manifest.py | 2 +- examples/tiny_fx/uf2-manifest.txt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/boards/PIMORONI_TINYFX/manifest.py b/boards/PIMORONI_TINYFX/manifest.py index d77e74b..90c668d 100644 --- a/boards/PIMORONI_TINYFX/manifest.py +++ b/boards/PIMORONI_TINYFX/manifest.py @@ -2,4 +2,4 @@ freeze("lib/") -freeze("../../picofx") \ No newline at end of file +package("picofx", base_path="../../") \ No newline at end of file diff --git a/examples/tiny_fx/uf2-manifest.txt b/examples/tiny_fx/uf2-manifest.txt index 11a5d8e..f87c93c 100644 --- a/examples/tiny_fx/uf2-manifest.txt +++ b/examples/tiny_fx/uf2-manifest.txt @@ -1 +1,3 @@ -main.py \ No newline at end of file +main.py +effects/*.py +showcase/*.py \ No newline at end of file From b15263522d450797901e8230dc01ef7e0726ac16 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 17:03:40 +0100 Subject: [PATCH 2/8] TinyFX: Add picofx lib into user flash. --- .github/workflows/micropython.yml | 22 ++++++++++++++++------ boards/PIMORONI_TINYFX/manifest.py | 3 ++- examples/tiny_fx/uf2-manifest.txt | 5 ++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 54cc91e..65c4325 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -70,6 +70,7 @@ jobs: RELEASE_FILE: pimoroni-${{matrix.shortname}}-${{github.event.release.tag_name || github.sha}}-micropython.uf2 RELEASE_FILE_WITH_OS: pimoroni-${{matrix.shortname}}-${{github.event.release.tag_name || github.sha}}-micropython-with-examples.uf2 FIRMWARE_DIR: "$GITHUB_WORKSPACE/picofx/boards" + ROOT_DIR: "$GITHUB_WORKSPACE/picofx" BOARD_DIR: "$GITHUB_WORKSPACE/picofx/boards/${{matrix.board}}" EXAMPLES_DIR: "$GITHUB_WORKSPACE/picofx/examples/${{matrix.shortundername}}" @@ -123,12 +124,15 @@ jobs: working-directory: micropython run: | git apply "${{env.FIRMWARE_DIR}}/932f76c6ba64c5a3e68de3324556d9979f09303b.patch" - - # Install apt packages - - name: Install CCache & Compiler - shell: bash - run: - sudo apt update && sudo apt install ccache gcc-arm-none-eabi + + - name: Install Arm GNU Toolchain (arm-none-eabi-gcc) + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '9-2020-q2' + + - name: Install CCache + run: | + sudo apt update && sudo apt install ccache # Build firmware - name: Configure MicroPython @@ -156,6 +160,12 @@ jobs: run: | python3 py_decl/py_decl.py --to-json --verify micropython/ports/rp2/build/${{ env.RELEASE_FILE }} + - name: "HACK: Mangle PicoFX Lib into user filesystem" + shell: bash + run: | + mkdir -p ${{env.EXAMPLES_DIR}}/lib + cp -v -r ${{env.ROOT_DIR}}/picofx ${{env.EXAMPLES_DIR}}/lib + - name: Append Filesystem shell: bash run: | diff --git a/boards/PIMORONI_TINYFX/manifest.py b/boards/PIMORONI_TINYFX/manifest.py index 90c668d..1aa09de 100644 --- a/boards/PIMORONI_TINYFX/manifest.py +++ b/boards/PIMORONI_TINYFX/manifest.py @@ -2,4 +2,5 @@ freeze("lib/") -package("picofx", base_path="../../") \ No newline at end of file +# TODO: Convince Chris this is the one true and holy path +# package("picofx", base_path="../../") \ No newline at end of file diff --git a/examples/tiny_fx/uf2-manifest.txt b/examples/tiny_fx/uf2-manifest.txt index f87c93c..1fb09a9 100644 --- a/examples/tiny_fx/uf2-manifest.txt +++ b/examples/tiny_fx/uf2-manifest.txt @@ -1,3 +1,6 @@ main.py effects/*.py -showcase/*.py \ No newline at end of file +showcase/*.py +lib/picofx/*.py +lib/picofx/colour/*.py +lib/picofx/mono/*.py \ No newline at end of file From 7d7dab7a8c2bd3f1bfb61d51c81d4b1dd620c11f Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 17:20:16 +0100 Subject: [PATCH 3/8] Don't freeze audio or tiny_fx. --- .github/workflows/micropython.yml | 5 ++--- boards/PIMORONI_TINYFX/{lib => frozen_libs}/README.md | 0 boards/PIMORONI_TINYFX/{lib => frozen_libs}/boot.py | 0 boards/PIMORONI_TINYFX/{lib => frozen_libs}/pimoroni.py | 0 boards/PIMORONI_TINYFX/manifest.py | 2 +- {boards/PIMORONI_TINYFX => examples/tiny_fx}/lib/audio.py | 0 {boards/PIMORONI_TINYFX => examples/tiny_fx}/lib/tiny_fx.py | 0 7 files changed, 3 insertions(+), 4 deletions(-) rename boards/PIMORONI_TINYFX/{lib => frozen_libs}/README.md (100%) rename boards/PIMORONI_TINYFX/{lib => frozen_libs}/boot.py (100%) rename boards/PIMORONI_TINYFX/{lib => frozen_libs}/pimoroni.py (100%) rename {boards/PIMORONI_TINYFX => examples/tiny_fx}/lib/audio.py (100%) rename {boards/PIMORONI_TINYFX => examples/tiny_fx}/lib/tiny_fx.py (100%) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 65c4325..e9c9ae3 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -62,8 +62,7 @@ jobs: matrix: include: - name: TinyFX - shortname: tinyfx - shortundername: tiny_fx + shortname: tiny_fx board: PIMORONI_TINYFX env: @@ -72,7 +71,7 @@ jobs: FIRMWARE_DIR: "$GITHUB_WORKSPACE/picofx/boards" ROOT_DIR: "$GITHUB_WORKSPACE/picofx" BOARD_DIR: "$GITHUB_WORKSPACE/picofx/boards/${{matrix.board}}" - EXAMPLES_DIR: "$GITHUB_WORKSPACE/picofx/examples/${{matrix.shortundername}}" + EXAMPLES_DIR: "$GITHUB_WORKSPACE/picofx/examples/${{matrix.shortname}}" steps: - name: Compiler Cache diff --git a/boards/PIMORONI_TINYFX/lib/README.md b/boards/PIMORONI_TINYFX/frozen_libs/README.md similarity index 100% rename from boards/PIMORONI_TINYFX/lib/README.md rename to boards/PIMORONI_TINYFX/frozen_libs/README.md diff --git a/boards/PIMORONI_TINYFX/lib/boot.py b/boards/PIMORONI_TINYFX/frozen_libs/boot.py similarity index 100% rename from boards/PIMORONI_TINYFX/lib/boot.py rename to boards/PIMORONI_TINYFX/frozen_libs/boot.py diff --git a/boards/PIMORONI_TINYFX/lib/pimoroni.py b/boards/PIMORONI_TINYFX/frozen_libs/pimoroni.py similarity index 100% rename from boards/PIMORONI_TINYFX/lib/pimoroni.py rename to boards/PIMORONI_TINYFX/frozen_libs/pimoroni.py diff --git a/boards/PIMORONI_TINYFX/manifest.py b/boards/PIMORONI_TINYFX/manifest.py index 1aa09de..b1ea128 100644 --- a/boards/PIMORONI_TINYFX/manifest.py +++ b/boards/PIMORONI_TINYFX/manifest.py @@ -1,6 +1,6 @@ include("$(PORT_DIR)/boards/manifest.py") -freeze("lib/") +freeze("frozen_libs/") # TODO: Convince Chris this is the one true and holy path # package("picofx", base_path="../../") \ No newline at end of file diff --git a/boards/PIMORONI_TINYFX/lib/audio.py b/examples/tiny_fx/lib/audio.py similarity index 100% rename from boards/PIMORONI_TINYFX/lib/audio.py rename to examples/tiny_fx/lib/audio.py diff --git a/boards/PIMORONI_TINYFX/lib/tiny_fx.py b/examples/tiny_fx/lib/tiny_fx.py similarity index 100% rename from boards/PIMORONI_TINYFX/lib/tiny_fx.py rename to examples/tiny_fx/lib/tiny_fx.py From 814b874080679d256cf46eb2cf6eaae95212215c Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 17:21:32 +0100 Subject: [PATCH 4/8] CI: Fix Python linting to new path. --- .github/workflows/python-linting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-linting.yml b/.github/workflows/python-linting.yml index a150116..68c216a 100644 --- a/.github/workflows/python-linting.yml +++ b/.github/workflows/python-linting.yml @@ -24,7 +24,7 @@ jobs: run: | python3 -m flake8 --show-source --ignore E501 examples - - name: Lint TinyFX Libs + - name: Lint Frozen Libs shell: bash run: | - python3 -m flake8 --show-source --ignore E501 boards/PIMORONI_TINYFX/lib + python3 -m flake8 --show-source --ignore E501 boards/*/frozen_libs From a18ca3e413427686cefd2f881f94256dcbc7730f Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 17:27:24 +0100 Subject: [PATCH 5/8] PicoFX: Add lib/*.py files. --- examples/tiny_fx/uf2-manifest.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/tiny_fx/uf2-manifest.txt b/examples/tiny_fx/uf2-manifest.txt index 1fb09a9..6187ddc 100644 --- a/examples/tiny_fx/uf2-manifest.txt +++ b/examples/tiny_fx/uf2-manifest.txt @@ -1,6 +1,7 @@ main.py effects/*.py showcase/*.py +lib/*.py lib/picofx/*.py lib/picofx/colour/*.py lib/picofx/mono/*.py \ No newline at end of file From f17a1129dc3032572605b3b072b8349487f19e03 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 17:38:59 +0100 Subject: [PATCH 6/8] CI: Add zip builds for Examples and Libs. --- .github/workflows/filesystem.yml | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/filesystem.yml diff --git a/.github/workflows/filesystem.yml b/.github/workflows/filesystem.yml new file mode 100644 index 0000000..1367524 --- /dev/null +++ b/.github/workflows/filesystem.yml @@ -0,0 +1,61 @@ +name: Zip Files + +on: + push: + pull_request: + release: + types: [created] + +jobs: + build: + name: Build ${{matrix.name}} + runs-on: ubuntu-20.04 + strategy: + matrix: + include: + - name: TinyFX + shortname: tiny_fx + board: PIMORONI_TINYFX + + env: + RELEASE_FILE: ${{matrix.shortname}}-${{github.event.release.tag_name || github.sha}} + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + path: picofx + + - name: Libs .zip artifact + uses: actions/upload-artifact@v4 + with: + name: ${{env.RELEASE_FILE}}-libs-only + path: picofx/picofx + + - name: Examples .zip artifact + uses: actions/upload-artifact@v4 + with: + name: ${{env.RELEASE_FILE}}-examples-only + path: "picofx/examples/${{matrix.shortname}}" + + - name: Libs .zip release asset + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + asset_path: picofx/picofx + upload_url: ${{github.event.release.upload_url}} + asset_name: ${{env.RELEASE_FILE}}-libs-only + asset_content_type: application/octet-stream + + - name: Examples .zip release asset + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + asset_path: "picofx/examples/${{matrix.shortname}}" + upload_url: ${{github.event.release.upload_url}} + asset_name: ${{env.RELEASE_FILE}}-examples-only + asset_content_type: application/octet-stream From 266d66ceafcf797fd1d549f6deb8f870b4cd36c5 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 17:50:14 +0100 Subject: [PATCH 7/8] Move examples into examples subdirectory. --- examples/tiny_fx/examples/_.py | 2 ++ examples/tiny_fx/{ => examples}/effects/traffic_light.py | 0 examples/tiny_fx/{ => examples}/effects/wave.py | 0 examples/tiny_fx/{ => examples}/showcase/ship_thrusters.py | 0 examples/tiny_fx/{ => examples}/showcase/space_tales.py | 0 .../tiny_fx/{ => examples}/showcase/space_tales_with_pir.py | 0 examples/tiny_fx/uf2-manifest.txt | 5 +++-- 7 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 examples/tiny_fx/examples/_.py rename examples/tiny_fx/{ => examples}/effects/traffic_light.py (100%) rename examples/tiny_fx/{ => examples}/effects/wave.py (100%) rename examples/tiny_fx/{ => examples}/showcase/ship_thrusters.py (100%) rename examples/tiny_fx/{ => examples}/showcase/space_tales.py (100%) rename examples/tiny_fx/{ => examples}/showcase/space_tales_with_pir.py (100%) diff --git a/examples/tiny_fx/examples/_.py b/examples/tiny_fx/examples/_.py new file mode 100644 index 0000000..f82445a --- /dev/null +++ b/examples/tiny_fx/examples/_.py @@ -0,0 +1,2 @@ +# Ignore me, I'm here to fix a dir2uf2 bug by triggering the creation of +# the examples/ directory. See: https://github.com/Gadgetoid/dir2uf2/issues/10 diff --git a/examples/tiny_fx/effects/traffic_light.py b/examples/tiny_fx/examples/effects/traffic_light.py similarity index 100% rename from examples/tiny_fx/effects/traffic_light.py rename to examples/tiny_fx/examples/effects/traffic_light.py diff --git a/examples/tiny_fx/effects/wave.py b/examples/tiny_fx/examples/effects/wave.py similarity index 100% rename from examples/tiny_fx/effects/wave.py rename to examples/tiny_fx/examples/effects/wave.py diff --git a/examples/tiny_fx/showcase/ship_thrusters.py b/examples/tiny_fx/examples/showcase/ship_thrusters.py similarity index 100% rename from examples/tiny_fx/showcase/ship_thrusters.py rename to examples/tiny_fx/examples/showcase/ship_thrusters.py diff --git a/examples/tiny_fx/showcase/space_tales.py b/examples/tiny_fx/examples/showcase/space_tales.py similarity index 100% rename from examples/tiny_fx/showcase/space_tales.py rename to examples/tiny_fx/examples/showcase/space_tales.py diff --git a/examples/tiny_fx/showcase/space_tales_with_pir.py b/examples/tiny_fx/examples/showcase/space_tales_with_pir.py similarity index 100% rename from examples/tiny_fx/showcase/space_tales_with_pir.py rename to examples/tiny_fx/examples/showcase/space_tales_with_pir.py diff --git a/examples/tiny_fx/uf2-manifest.txt b/examples/tiny_fx/uf2-manifest.txt index 6187ddc..5f55736 100644 --- a/examples/tiny_fx/uf2-manifest.txt +++ b/examples/tiny_fx/uf2-manifest.txt @@ -1,6 +1,7 @@ main.py -effects/*.py -showcase/*.py +examples/*.py +examples/effects/*.py +examples/showcase/*.py lib/*.py lib/picofx/*.py lib/picofx/colour/*.py From 68c021fc60818bb6c01dd95e011c413424e159ad Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 29 Jul 2024 18:19:36 +0100 Subject: [PATCH 8/8] CI: Use dir2uf2 0.0.6 to fix mkdir bug. --- .github/workflows/micropython.yml | 2 +- examples/tiny_fx/examples/_.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 examples/tiny_fx/examples/_.py diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index e9c9ae3..2f920eb 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -115,7 +115,7 @@ jobs: - uses: actions/checkout@v4 with: repository: gadgetoid/dir2uf2 - ref: v0.0.5 + ref: v0.0.6 path: dir2uf2 - name: "HACK: MicroPython out of tree board pins.csv patch" diff --git a/examples/tiny_fx/examples/_.py b/examples/tiny_fx/examples/_.py deleted file mode 100644 index f82445a..0000000 --- a/examples/tiny_fx/examples/_.py +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore me, I'm here to fix a dir2uf2 bug by triggering the creation of -# the examples/ directory. See: https://github.com/Gadgetoid/dir2uf2/issues/10