From 2ef6d725e21f9a60fa0b676920b74eb9be8209e0 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 | 60 ++++++++++--------- 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, 69 insertions(+), 28 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 e23e2e40a..3bb7f7d24 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -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/ @@ -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 @@ -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/* @@ -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 @@ -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 @@ -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,8 +496,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 (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: 🏗️ESP8266 @@ -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 @@ -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 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