1e7cf4e25f1ec829da027d09b3dde66c8e34a605
* nrf52_lto: fix variant LTO exclusion (match srcnode, not mirrored path) + post-link guard The CI-fix follow-up in #10829 anchored _is_board_variant() to <PROJECT_DIR>/variants/ using node.get_abspath() -- but build middleware receives nodes from the SCons variant-dir mirror, whose abspath is $BUILD_DIR/variants/.../variant.cpp. The anchor never matched, so the variant silently went back into whole-image LTO: the shipped ELF has initVariant() resolved to the core's weak empty stub (bare `bx lr`), PIN_3V3_EN is never driven, and the SX1262 probe fails with CHIP_NOT_FOUND again -- while the build stays green, because the post-link guard only checked IRQ handlers. Fix: match against node.srcnode().get_abspath(), which undoes the variant-dir mirror (the same trick piobuild.py uses for middleware pattern matching). Add a second post-link guard so this failure mode is a red build, not a field failure: the linked variant.cpp.o must contain no .gnu.lto_* sections (proves the -fno-lto recompile fired), and any override the object defines strong (initVariant) must resolve strong in the ELF. Verified both ways on nrf52_promicro_diy_tcxo: clean build is green with T _Z11initVariantv and a real initVariant body in the ELF; re-breaking the matcher turns the build FAILED with both guard checks firing. clod helped a lot * address comments * nrf52_lto: defer variant CCFLAGS so APP_VERSION is present The variant -fno-lto recompile snapshotted projenv["CCFLAGS"] inside the build middleware, which fires during $BUILD_SCRIPT. But -DAPP_VERSION... is appended to projenv by bin/platformio-custom.py, an unprefixed extra_script that PlatformIO runs as a POST script -- after the middleware. The frozen override therefore lacked APP_VERSION, so recompiling any board variant whose variant.cpp includes configuration.h (rak_wismeshtag via sleep.h, seeed_xiao_nrf52840_kit, seeed_mesh_tracker_X1) failed with 'APP_VERSION must be set by the build environment'. Defer the CCFLAGS read to a callable construction variable: SCons invokes it during command substitution, after every SConscript (post-scripts included), so projenv now carries the version flags. -fno-lto is appended last so it still wins over the inherited -flto. Verified clean builds of rak_wismeshtag, seeed_xiao_nrf52840_kit, and rak4631 (regression) -- all green with the variant guard reporting the board variant kept out of LTO. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Overview
This repository contains the official device firmware for Meshtastic, an open-source LoRa mesh networking project designed for long-range, low-power communication without relying on internet or cellular infrastructure. The firmware supports various hardware platforms, including ESP32, nRF52, RP2040/RP2350, and Linux-based devices.
Meshtastic enables text messaging, location sharing, and telemetry over a decentralized mesh network, making it ideal for outdoor adventures, emergency preparedness, and remote operations.
Get Started
- 🔧 Building Instructions - Learn how to compile the firmware from source.
- ⚡ Flashing Instructions - Install or update the firmware on your device.
Join our community and help improve Meshtastic! 🚀
Stats
Languages
C++
70.8%
C
25.8%
Python
2.2%
Shell
0.7%
Batchfile
0.2%
Other
0.1%
