From f961f9bfb3c156ab17822fadb35a221e95fb366f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 15 Apr 2026 16:06:48 -1000 Subject: [PATCH] libretiny: fix post-link summary for RTL8710B + LN882H Post-link was not registered for RTL8710B (condition was too narrow after removing it from _PATCHERS_BY_VARIANT). Use a BK72xx exclusion set instead so all IRAM-active variants get the summary. Also fall back to TOOLCHAIN_PREFIX-nm when $NM is empty, which fixes the empty summary on LN882H. --- esphome/components/libretiny/patch_linker.py.script | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/esphome/components/libretiny/patch_linker.py.script b/esphome/components/libretiny/patch_linker.py.script index cb1d960201..c9b04ee901 100644 --- a/esphome/components/libretiny/patch_linker.py.script +++ b/esphome/components/libretiny/patch_linker.py.script @@ -120,9 +120,10 @@ def _post_link(target, source, env): elf = env.subst("$BUILD_DIR/${PROGNAME}.elf") if not os.path.isfile(elf): return + nm = env.subst("$NM") or env.subst("${TOOLCHAIN_PREFIX}nm") try: out = subprocess.check_output( - [env.subst("$NM"), "--defined-only", "--demangle", elf], text=True + [nm, "--defined-only", "--demangle", elf], text=True ) except (OSError, subprocess.CalledProcessError): return @@ -168,7 +169,8 @@ if _patchers := _patchers_for(_variant): # as a pre-link action so it executes once the linker scripts exist. env.AddPreAction("$BUILD_DIR/${PROGNAME}.elf", _pre_link) -# Post-link summary runs for every LibreTiny family (except BK72xx where -# IRAM_ATTR is a no-op and no symbols are relocated to RAM). -if _patchers or _variant == "RTL8720C": +_BK72XX_VARIANTS = frozenset({"BK7231N", "BK7231T", "BK7231Q", "BK7251"}) + +# Post-link summary for every family where IRAM_ATTR places code in RAM. +if _variant not in _BK72XX_VARIANTS: env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", _post_link)