Give the nRF52 binutils their Windows suffix

This commit is contained in:
J. Nick Koston
2026-09-26 20:46:43 +01:00
parent 857564a23d
commit d9ae0e2cd4
3 changed files with 17 additions and 8 deletions
+9 -3
View File
@@ -80,9 +80,15 @@ def _get_toolchain_path(version: str) -> Path:
return get_sdk_nrf_tools_path() / "toolchains" / version
def get_toolchain_bin_path() -> Path:
"""The pinned Zephyr SDK's arm-zephyr-eabi binaries (objdump, readelf, ...)."""
return _get_toolchain_path(TOOLCHAIN_VERSION) / "arm-zephyr-eabi" / "bin"
def toolchain_tool(name: str) -> Path:
"""Path to one of the pinned Zephyr SDK's tools (objdump, readelf, ...).
The single owner of the ``arm-zephyr-eabi/bin/arm-zephyr-eabi-<name>``
layout and the Windows suffix.
"""
suffix = ".exe" if os.name == "nt" else ""
bin_path = _get_toolchain_path(TOOLCHAIN_VERSION) / "arm-zephyr-eabi" / "bin"
return bin_path / f"arm-zephyr-eabi-{name}{suffix}"
_SITECUSTOMIZE = """\
+3 -3
View File
@@ -4,15 +4,15 @@ from pathlib import Path
from esphome.core import CORE
from .framework import get_toolchain_bin_path
from .framework import toolchain_tool
def get_objdump_path() -> Path:
return get_toolchain_bin_path() / "arm-zephyr-eabi-objdump"
return toolchain_tool("objdump")
def get_readelf_path() -> Path:
return get_toolchain_bin_path() / "arm-zephyr-eabi-readelf"
return toolchain_tool("readelf")
def get_elf_path() -> Path:
+5 -2
View File
@@ -1,5 +1,6 @@
"""Tests for the nRF52 sdk-nrf memory analysis hooks."""
import os
from pathlib import Path
import pytest
@@ -24,8 +25,10 @@ def test_binutils_come_from_the_pinned_zephyr_sdk() -> None:
/ "arm-zephyr-eabi"
/ "bin"
)
assert toolchain.get_objdump_path() == bin_path / "arm-zephyr-eabi-objdump"
assert toolchain.get_readelf_path() == bin_path / "arm-zephyr-eabi-readelf"
# Windows hosts get the .exe binaries (CI covers both)
suffix = ".exe" if os.name == "nt" else ""
assert toolchain.get_objdump_path() == bin_path / f"arm-zephyr-eabi-objdump{suffix}"
assert toolchain.get_readelf_path() == bin_path / f"arm-zephyr-eabi-readelf{suffix}"
def test_elf_prefers_the_nested_sdk_layout(nrf52_build: Path) -> None: