From 661183dcba48d741ad39b75dd97a1e8ce26a1b5b Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Wed, 2 Sep 2026 13:19:39 -0500 Subject: [PATCH 1/2] fix(ci): fix math / st7123touch / meshtastic example builds on ESP-IDF v6 IDF v6 ships GCC 15.2 and compiles its own components with -Wall -Wextra -Werror, so warnings the older toolchain tolerated now fail the build: - math: the example applied -Wdouble-promotion PROJECT-WIDE (add_compile_options before project()), which also compiled it into ESP-IDF, whose esp32 code (esp_hw_support/port/esp32/rtc_clk.c) trips it under the new GCC and fails its -Werror build. Scope the flag to the example's own translation units via target_compile_options(${COMPONENT_LIB} PRIVATE -Wdouble-promotion) so the float-only check is kept without touching IDF. - st7123touch / meshtastic: -Werror=missing-field-initializers flagged the std::function config members with no default member initializer (St7123Touch::Config::write/read, MeshtasticNode::Config::transmit) when a designated-initializer aggregate omits them. Give them a default {nullptr}, matching their sibling members (e.g. meshtastic on_text{nullptr}); this fixes the warning for every caller, not just these examples. Verified on IDF v6.0.1 (GCC 15.2): math (esp32) and st7123touch (esp32s3) build clean. meshtastic (esp32s3) had transmit as its sole missing-initializer error (same fix pattern) and pulls in large BSP/lvgl submodules, so it was not rebuilt. Co-Authored-By: Claude Opus 4.8 (1M context) --- components/math/example/CMakeLists.txt | 6 +++++- components/math/example/main/CMakeLists.txt | 4 ++++ components/meshtastic/include/meshtastic.hpp | 2 +- components/st7123touch/include/st7123touch.hpp | 11 ++++++----- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/components/math/example/CMakeLists.txt b/components/math/example/CMakeLists.txt index 10dc595650..c7e3523039 100644 --- a/components/math/example/CMakeLists.txt +++ b/components/math/example/CMakeLists.txt @@ -5,7 +5,11 @@ cmake_minimum_required(VERSION 3.20) set(ENV{IDF_COMPONENT_MANAGER} "0") include($ENV{IDF_PATH}/tools/cmake/project.cmake) -add_compile_options(-Wdouble-promotion) +# NOTE: -Wdouble-promotion (to keep this float-only example honest on targets +# without hardware double support) is applied to the example's own code in +# main/CMakeLists.txt, NOT globally: applying it project-wide also compiled it +# into ESP-IDF's own components, whose code trips it under IDF v6's newer GCC +# (e.g. esp_hw_support/port/esp32/rtc_clk.c) and fails their -Werror build. # add the component directories that we want to use set(EXTRA_COMPONENT_DIRS diff --git a/components/math/example/main/CMakeLists.txt b/components/math/example/main/CMakeLists.txt index a941e22ba7..ca13e99c4b 100644 --- a/components/math/example/main/CMakeLists.txt +++ b/components/math/example/main/CMakeLists.txt @@ -1,2 +1,6 @@ idf_component_register(SRC_DIRS "." INCLUDE_DIRS ".") + +# Keep this example float-only (esp32 has no hardware double). Scoped to the +# example's own translation units so it does not reach ESP-IDF's components. +target_compile_options(${COMPONENT_LIB} PRIVATE -Wdouble-promotion) diff --git a/components/meshtastic/include/meshtastic.hpp b/components/meshtastic/include/meshtastic.hpp index 689e2ded39..2121acd8d6 100644 --- a/components/meshtastic/include/meshtastic.hpp +++ b/components/meshtastic/include/meshtastic.hpp @@ -88,7 +88,7 @@ class MeshtasticNode : public BaseComponent { std::vector psk{1}; ///< The channel PSK. Default {1} = the public ///< default key. See meshtastic::expand_psk. - transmit_fn transmit; ///< Function used to transmit frames + transmit_fn transmit{nullptr}; ///< Function used to transmit frames uint8_t hop_limit{3}; ///< Hop limit for originated broadcasts (0-7) bool rebroadcast{false}; ///< Whether to rebroadcast (relay) others' packets diff --git a/components/st7123touch/include/st7123touch.hpp b/components/st7123touch/include/st7123touch.hpp index 9cb233689e..6320987872 100644 --- a/components/st7123touch/include/st7123touch.hpp +++ b/components/st7123touch/include/st7123touch.hpp @@ -48,11 +48,12 @@ class St7123Touch : public BasePeripheral { /// happier with the separate form (e.g. when reads run from an interrupt handler and the /// longer combined transaction is more prone to I/O errors). struct Config { - BasePeripheral::write_fn - write; ///< Write function (paired with read for separate reads) - BasePeripheral::read_fn read; ///< Read function (paired with write for separate reads) - BasePeripheral::write_then_read_fn - write_then_read; ///< Combined (repeated-START) write-then-read; takes precedence if set + BasePeripheral::write_fn write{ + nullptr}; ///< Write function (paired with read for separate reads) + BasePeripheral::read_fn read{ + nullptr}; ///< Read function (paired with write for separate reads) + BasePeripheral::write_then_read_fn write_then_read{ + nullptr}; ///< Combined (repeated-START) write-then-read; takes precedence if set uint8_t address = DEFAULT_ADDRESS; ///< I2C address of the chip espp::Logger::Verbosity log_level{ espp::Logger::Verbosity::WARN}; ///< Log verbosity for the driver From fb04756559b87801a82d533241f9b656e2129434 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Wed, 2 Sep 2026 15:22:21 -0500 Subject: [PATCH 2/2] fix(meshtastic): build against mbedtls 4.x (ESP-IDF v6) - AES header moved to private ESP-IDF v6 ships mbedtls 4.x, which moved the low-level AES API out of the public (now gone) into as PSA Crypto became the public interface. meshtastic_crypto.cpp uses mbedtls_aes_crypt_ctr for the Meshtastic AES-256-CTR packet cipher, so it failed with "mbedtls/aes.h: No such file or directory" on v6. Select the header by MBEDTLS_VERSION_MAJOR (from the public ) so it keeps building on mbedtls 3.x (IDF v5) and builds on 4.x (IDF v6); the mbedtls_aes_* functions themselves are unchanged. This was the second v6 break in this example (after the transmit initializer); meshtastic (esp32s3) now builds clean on IDF v6.0.1. Co-Authored-By: Claude Opus 4.8 (1M context) --- components/meshtastic/src/meshtastic_crypto.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/meshtastic/src/meshtastic_crypto.cpp b/components/meshtastic/src/meshtastic_crypto.cpp index e3d0ef116e..df968c2a15 100755 --- a/components/meshtastic/src/meshtastic_crypto.cpp +++ b/components/meshtastic/src/meshtastic_crypto.cpp @@ -3,7 +3,15 @@ #include #include +#include // for MBEDTLS_VERSION_MAJOR +#if MBEDTLS_VERSION_MAJOR >= 4 +// mbedtls 4.x (ESP-IDF v6+) moved the low-level AES API to a private header; the +// mbedtls_aes_* functions used below are unchanged and still available there. +// (PSA Crypto is the recommended long-term API.) +#include +#else #include +#endif namespace espp::meshtastic {