From 2c44df9efa59b6e828eee3d18843d9a2455ed2db Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Aug 2026 21:49:45 -0500 Subject: [PATCH 1/2] Hoist the common linker-script names --- esphome/build_gen/arduino8266.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/esphome/build_gen/arduino8266.py b/esphome/build_gen/arduino8266.py index 0478551e2f..e2f667b3b3 100644 --- a/esphome/build_gen/arduino8266.py +++ b/esphome/build_gen/arduino8266.py @@ -48,6 +48,11 @@ _FLASH_LD_NAME_RE = re.compile(r"[\w.-]+\.ld") # Every supported board ships this clock; board_build.f_cpu overrides _DEFAULT_F_CPU = "80000000L" +# The SDK linker-script template and the preprocessed copy the build links +# against; the cache stamp and stderr sidecars derive from the output name +_COMMON_LD_HEADER = "eagle.app.v6.common.ld.h" +_COMMON_LD_NAME = "local.eagle.app.v6.common.ld" + # Knob suffix -> SDK define; the first entry is the default (dicts # preserve insertion order) _NONOSDK_VERSIONS = { @@ -525,14 +530,14 @@ def generate_ld_scripts( cmd += [f"-D{d}" for d in config.mmu_defines] if config.fp_in_irom: cmd.append("-DFP_IN_IROM") - header = framework / "tools" / "sdk" / "ld" / "eagle.app.v6.common.ld.h" + header = framework / "tools" / "sdk" / "ld" / _COMMON_LD_HEADER cmd += [str(header), "-o", "-"] # The inputs are the command line (defines + framework version, which is # baked into the paths) plus testing mode; skip the preprocessor spawn on # incremental builds when nothing changed. - output = ld_dir / "local.eagle.app.v6.common.ld" - stamp = ld_dir / ".local.eagle.app.v6.common.ld.stamp" + output = ld_dir / _COMMON_LD_NAME + stamp = ld_dir / f".{_COMMON_LD_NAME}.stamp" # Stamp includes the header/gcc stat (catches in-place re-extraction) # and the surgery fingerprint (a build_surgery edit invalidates old # build dirs) @@ -562,7 +567,7 @@ def generate_ld_scripts( except (OSError, UnicodeDecodeError): return False - stderr_note = ld_dir / ".local.eagle.app.v6.common.ld.stderr" + stderr_note = ld_dir / f".{_COMMON_LD_NAME}.stderr" if not _cached_ld_is_valid(): try: result = subprocess.run( From 4803ced57d05f9cf61f6df477a01ba69b23682ef Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Aug 2026 21:50:08 -0500 Subject: [PATCH 2/2] Reunite the SDK-table comment with its table --- esphome/build_gen/arduino8266.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/esphome/build_gen/arduino8266.py b/esphome/build_gen/arduino8266.py index e2f667b3b3..b7f2883292 100644 --- a/esphome/build_gen/arduino8266.py +++ b/esphome/build_gen/arduino8266.py @@ -35,9 +35,6 @@ if TYPE_CHECKING: _LOGGER = logging.getLogger(__name__) -# From platformio-build.py. The first entry is the default; with multiple SDK -# knobs set (a pathological config) ties break by table order, since -# upstream's tie-break depends on define order and is not reproducible here. # Values that land unquoted on generated command lines are shape-checked # against these before use _MMU_HEX_VALUE_RE = re.compile(r"0[xX][0-9a-fA-F]+[uUlL]*") @@ -53,8 +50,10 @@ _DEFAULT_F_CPU = "80000000L" _COMMON_LD_HEADER = "eagle.app.v6.common.ld.h" _COMMON_LD_NAME = "local.eagle.app.v6.common.ld" -# Knob suffix -> SDK define; the first entry is the default (dicts -# preserve insertion order) +# From platformio-build.py. Knob suffix -> SDK define; the first entry is +# the default (dicts preserve insertion order). With multiple SDK knobs set +# (a pathological config) ties break by table order, since upstream's +# tie-break depends on define order and is not reproducible here. _NONOSDK_VERSIONS = { "SDK22x_190703": "NONOSDK22x_190703", "SDK221": "NONOSDK221",