From b12572ab8eb33be7d394fc2e8a2d9da53312b68c Mon Sep 17 00:00:00 2001 From: tyeth Date: Mon, 29 Jul 2024 22:16:18 +0100 Subject: [PATCH] Print build dependencies on boot --- .github/workflows/build-clang-doxy.yml | 98 ++++++++++--------- src/print_dependencies.cpp | 9 ++ src/print_dependencies.h | 6 ++ .../littlefs/WipperSnapper_LittleFS.cpp | 8 ++ src/provisioning/tinyusb/Wippersnapper_FS.cpp | 14 +++ 5 files changed, 88 insertions(+), 47 deletions(-) create mode 100644 src/print_dependencies.cpp create mode 100644 src/print_dependencies.h diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 6df9ee3e6..16aa40f79 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -13,7 +13,7 @@ on: jobs: build-esp32sx-esptool: - name: Build ESP32-Sx + name: 🏗️ESP32-Sx runs-on: ubuntu-latest strategy: fail-fast: false @@ -22,7 +22,7 @@ jobs: include: - offset: "0x1000" steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -33,9 +33,9 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - ref: ci-wippersnapper - name: Checkout Board Definitions uses: actions/checkout@v4 with: @@ -72,8 +72,8 @@ jobs: - name: Install Dependencies (esptool) run: | pip3 install esptool - - name: Build for ESP32-SX - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 + - name: Build for ESP32-SX (esptool) + run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h - name: list files run: | ls -Rla examples/ @@ -100,7 +100,7 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Check boot_app0 file existence (esp32sx built from core, not-source) id: check_files - uses: andstor/file-existence-action@v2 + uses: andstor/file-existence-action@v3 with: files: "/home/runner/.arduino15/packages/esp32/hardware/esp32/*/tools/partitions/boot_app0.bin" - name: list arduino esp32 core files @@ -150,7 +150,7 @@ jobs: wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.uf2 build-esp32sx: - name: Build ESP32-Sx + name: 🏗️ESP32-Sx runs-on: ubuntu-latest strategy: fail-fast: false @@ -171,7 +171,7 @@ jobs: "qtpy_esp32s3_n4r2", ] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -182,9 +182,9 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - ref: ci-wippersnapper - name: Install CI-Arduino run: bash ci/actions_install.sh - name: Install extra Arduino libraries @@ -214,11 +214,11 @@ jobs: run: | cp /home/runner/Arduino/libraries/Adafruit_LittlevGL_Glue_Library/lv_conf.h /home/runner/Arduino/libraries - name: Build for ESP32-SX - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 - - name: list run: | - ls - ls examples/*/build/ + python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h + - name: list files (tree) + run: | + tree - name: Rename build artifacts to reflect the platform name run: | mv examples/*/build/*/Wippersnapper_demo.ino.uf2 wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.uf2 @@ -232,7 +232,7 @@ jobs: wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.bin build-esp32: - name: Build ESP32 and Cx + name: 🏗️ESP32, ESP32-C3 runs-on: ubuntu-latest strategy: fail-fast: false @@ -253,7 +253,7 @@ jobs: - offset: "0x0" arduino-platform: "wippersnapper_feather_esp32c6" steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -264,9 +264,9 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - ref: ci-wippersnapper - name: Checkout Board Definitions uses: actions/checkout@v4 with: @@ -290,7 +290,7 @@ jobs: run: | pip3 install esptool - name: build ESP32 platforms - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 + run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h - name: Check artifacts run: | ls examples/Wippersnapper_demo/build/* @@ -303,7 +303,7 @@ jobs: mv examples/Wippersnapper_demo/build/*/Wippersnapper_demo.ino.partitions.bin wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.partitions.bin - name: Check boot_app0 file existence (esp32 built from core, not-source) id: check_files - uses: andstor/file-existence-action@v2 + uses: andstor/file-existence-action@v3 with: files: "/home/runner/.arduino15/packages/esp32/hardware/esp32/*/tools/partitions/boot_app0.bin" - name: boot_app0 file from arduino-cli core @@ -350,7 +350,7 @@ jobs: wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.zip build-samd: - name: Build WipperSnapper SAMD + name: 🏗️SAMD runs-on: ubuntu-latest strategy: fail-fast: false @@ -362,7 +362,7 @@ jobs: "metro_m4_airliftlite_tinyusb", ] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -373,7 +373,8 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - name: Install CI-Arduino run: bash ci/actions_install.sh @@ -392,8 +393,8 @@ jobs: # Copy files to WipperSnapper's src/nanopb directory cp nanopb/pb_common.* nanopb/pb_encode.* nanopb/pb_decode.* src/nanopb mv nanopb/pb.h src/nanopb/nanopb.pb.h - - name: build platforms - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 + - name: build SAMD platforms + run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h - name: Rename build artifacts to reflect the platform name run: | mv examples/*/build/*/Wippersnapper_demo.ino.uf2 wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.uf2 @@ -407,14 +408,14 @@ jobs: wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.hex build-rp2040: - name: Build WipperSnapper RP2040 + name: 🏗️RP2040 runs-on: ubuntu-latest strategy: fail-fast: false matrix: arduino-platform: ["picow_rp2040_tinyusb"] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -425,7 +426,8 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - name: Install CI-Arduino run: bash ci/actions_install.sh @@ -443,8 +445,8 @@ jobs: # Copy files to WipperSnapper's src/nanopb directory cp nanopb/pb_common.* nanopb/pb_encode.* nanopb/pb_decode.* src/nanopb mv nanopb/pb.h src/nanopb/nanopb.pb.h - - name: build platforms - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 + - name: build RP2040 platforms + run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h - name: Rename build artifacts to reflect the platform name run: | mv examples/*/build/*/Wippersnapper_demo.ino.uf2 wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.uf2 @@ -457,14 +459,14 @@ jobs: # NOTE: This does NOT release artifacts, it only builds build-samd-non-fs: - name: Build WipperSnapper SAMD (NO-TINYUSB) + name: 🏗️SAMD (NO-TINYUSB) runs-on: ubuntu-latest strategy: fail-fast: false matrix: arduino-platform: ["mkrwifi1010", "nano_33_iot"] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -475,7 +477,8 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - name: Install CI-Arduino run: bash ci/actions_install.sh @@ -493,18 +496,18 @@ jobs: # Copy files to WipperSnapper's src/nanopb directory cp nanopb/pb_common.* nanopb/pb_encode.* nanopb/pb_decode.* src/nanopb mv nanopb/pb.h src/nanopb/nanopb.pb.h - - name: build platforms - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 + - name: build SAMD (no-FS) platforms + run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h build-esp8266: - name: Build WipperSnapper ESP8266 + name: 🏗️ESP8266 runs-on: ubuntu-latest strategy: fail-fast: false matrix: arduino-platform: ["feather_esp8266"] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -515,7 +518,8 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - name: Install CI-Arduino run: bash ci/actions_install.sh @@ -531,8 +535,8 @@ jobs: # Copy files to WipperSnapper's src/nanopb directory cp nanopb/pb_common.* nanopb/pb_encode.* nanopb/pb_decode.* src/nanopb mv nanopb/pb.h src/nanopb/nanopb.pb.h - - name: build platforms - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 + - name: build ESP8266 platforms + run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h - name: list build artifacts run: | ls @@ -553,7 +557,7 @@ jobs: wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.zip build-esp32sx-dev: - name: Build WipperSnapper ESP32-Sx DEV BUILDS + name: 🏗️ESP32-Sx DEV BUILDS runs-on: ubuntu-latest strategy: fail-fast: false @@ -567,7 +571,7 @@ jobs: "feather_esp32s3_tft_debug", ] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 @@ -578,9 +582,9 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: tyeth/ci-arduino + ref: WS_ARDUINO_598-preprocessor-script-for-printing-the-library-versions-to-boot_outtxt path: ci - ref: ci-wippersnapper - name: Install CI-Arduino run: bash ci/actions_install.sh - name: Install extra Arduino libraries @@ -610,7 +614,7 @@ jobs: run: | cp /home/runner/Arduino/libraries/Adafruit_LittlevGL_Glue_Library/lv_conf.h /home/runner/Arduino/libraries - name: Build for ESP32-SX - run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 + run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000 --include_print_dependencies_header ./src/print_dependencies.h - name: list run: | ls @@ -753,7 +757,7 @@ jobs: build-rp2040, ] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: actions/checkout@v4 diff --git a/src/print_dependencies.cpp b/src/print_dependencies.cpp new file mode 100644 index 000000000..0826aa24d --- /dev/null +++ b/src/print_dependencies.cpp @@ -0,0 +1,9 @@ +#include "print_dependencies.h" + +const char *project_dependencies = R"( +Libraries and Versions: +** This is a placeholder, you can fill this in automatically by running arduino-cli and copying the output here. ** + +Platforms and Versions: +** Board Support Package placeholder ** +)"; \ No newline at end of file diff --git a/src/print_dependencies.h b/src/print_dependencies.h new file mode 100644 index 000000000..3d37a72d0 --- /dev/null +++ b/src/print_dependencies.h @@ -0,0 +1,6 @@ +#ifndef PROJECT_DEPENDENCIES_H +#define PROJECT_DEPENDENCIES_H + +#define PRINT_DEPENDENCIES 0 +extern const char *project_dependencies; +#endif // PROJECT_DEPENDENCIES_H \ No newline at end of file diff --git a/src/provisioning/littlefs/WipperSnapper_LittleFS.cpp b/src/provisioning/littlefs/WipperSnapper_LittleFS.cpp index e3ccf3831..de76fc79f 100644 --- a/src/provisioning/littlefs/WipperSnapper_LittleFS.cpp +++ b/src/provisioning/littlefs/WipperSnapper_LittleFS.cpp @@ -28,6 +28,14 @@ */ /**************************************************************************/ WipperSnapper_LittleFS::WipperSnapper_LittleFS() { +#if PRINT_DEPENDENCIES + // Print project build dependencies + WS_DEBUG_PRINTLN("Build Dependencies:"); + WS_DEBUG_PRINTLN("*********************"); + WS_DEBUG_PRINTLN(project_dependencies); + WS_DEBUG_PRINTLN("*********************"); +#endif + // Attempt to initialize filesystem if (!LittleFS.begin()) { setStatusLEDColor(RED); diff --git a/src/provisioning/tinyusb/Wippersnapper_FS.cpp b/src/provisioning/tinyusb/Wippersnapper_FS.cpp index f0ffe23d4..3d2473748 100644 --- a/src/provisioning/tinyusb/Wippersnapper_FS.cpp +++ b/src/provisioning/tinyusb/Wippersnapper_FS.cpp @@ -12,6 +12,7 @@ * BSD license, all text here must be included in any redistribution. * */ + #if defined(ARDUINO_MAGTAG29_ESP32S2) || defined(ARDUINO_METRO_ESP32S2) || \ defined(ARDUINO_FUNHOUSE_ESP32S2) || \ defined(ADAFRUIT_PYPORTAL_M4_TITANO) || \ @@ -27,6 +28,7 @@ defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S3_REVTFT) || \ defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2_REVTFT) || \ defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) +#include "print_dependencies.h" #include "Wippersnapper_FS.h" // On-board external flash (QSPI or SPI) macros should already // defined in your board variant if supported @@ -89,6 +91,13 @@ bool setVolumeLabel() { */ /**************************************************************************/ Wippersnapper_FS::Wippersnapper_FS() { +#if PRINT_DEPENDENCIES + WS_DEBUG_PRINTLN("Build Dependencies:"); + WS_DEBUG_PRINTLN("*********************"); + WS_DEBUG_PRINTLN(project_dependencies); + WS_DEBUG_PRINTLN("*********************"); + WS_PRINTER.flush(); +#endif // Detach USB device during init. TinyUSBDevice.detach(); // Wait for detach @@ -277,6 +286,11 @@ bool Wippersnapper_FS::createBootFile() { bootFile.print("MAC Address: "); bootFile.println(sMAC); +#if PRINT_DEPENDENCIES + bootFile.println("Build dependencies:"); + bootFile.println(project_dependencies); +#endif + // Print ESP-specific info to boot file #ifdef ARDUINO_ARCH_ESP32 // Get version of ESP-IDF