mirror of
https://github.com/esphome/esphome.git
synced 2026-10-02 14:22:58 +08:00
Record bootloader hooks from the configured build, make config name sets immutable, never delete an entry on a transient read error
This commit is contained in:
@@ -291,6 +291,13 @@ include($ENV{{IDF_PATH}}/tools/cmake/project.cmake)
|
||||
|
||||
project({CORE.name})
|
||||
|
||||
# Record the bootloader customization channels the cache cannot replay;
|
||||
# esphome.espidf.bootloader bypasses the cache when any is non-empty.
|
||||
idf_build_get_property(esphome_bl_dirs BOOTLOADER_EXTRA_COMPONENT_DIRS)
|
||||
idf_build_get_property(esphome_bl_args EXTRA_CMAKE_ARGS)
|
||||
file(WRITE ${{CMAKE_BINARY_DIR}}/esphome_bootloader_hooks.txt
|
||||
"${{esphome_bl_dirs}}${{BOOTLOADER_IGNORE_EXTRA_COMPONENT}}${{esphome_bl_args}}")
|
||||
|
||||
# Emit per-memory-type JSON size data for ESPHome to read post-build.
|
||||
# json2 stays small; raw dumps every symbol (~2s on a large map) and
|
||||
# this command runs inside the link edge, blocking everything downstream.
|
||||
|
||||
@@ -12,6 +12,10 @@ from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
# Written by the generated CMakeLists after project(); holds the bootloader
|
||||
# customization channels the cache cannot replay (see espidf.bootloader).
|
||||
BOOTLOADER_HOOKS_FILE = "esphome_bootloader_hooks.txt"
|
||||
|
||||
|
||||
def variant_to_idf_target(variant: str) -> str:
|
||||
"""Map an esp32 variant name (e.g. "ESP32S3") to its ESP-IDF target name."""
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -184,10 +184,10 @@ def _bootloader_parity(build_path: Path) -> list[str]:
|
||||
# pylint: disable=protected-access
|
||||
from esphome.espidf import bootloader, toolchain
|
||||
|
||||
bin_path = build_path / "build" / "bootloader" / "bootloader.bin"
|
||||
if not bootloader.tree_uses_cached_bootloader(build_path / "build"):
|
||||
print("note: tree not in cached mode; bootloader parity not exercised")
|
||||
return []
|
||||
bin_path = build_path / "build" / "bootloader" / "bootloader.bin"
|
||||
cached = bin_path.read_bytes()
|
||||
bin_path.unlink() # the rebuild must produce it, never compare to itself
|
||||
os.environ[bootloader.BOOTLOADER_CACHE_ENV] = "0"
|
||||
|
||||
@@ -175,6 +175,20 @@ def test_get_project_cmakelists_size_command_uses_json2() -> None:
|
||||
assert "--format=json2" in content
|
||||
|
||||
|
||||
def test_get_project_cmakelists_records_bootloader_hooks() -> None:
|
||||
"""The post-project() dump feeds espidf.bootloader's bypass check."""
|
||||
from esphome.espidf import BOOTLOADER_HOOKS_FILE
|
||||
|
||||
content = _render()
|
||||
assert f"file(WRITE ${{CMAKE_BINARY_DIR}}/{BOOTLOADER_HOOKS_FILE}" in content
|
||||
for source in (
|
||||
"esphome_bl_dirs BOOTLOADER_EXTRA_COMPONENT_DIRS",
|
||||
"${BOOTLOADER_IGNORE_EXTRA_COMPONENT}",
|
||||
"esphome_bl_args EXTRA_CMAKE_ARGS",
|
||||
):
|
||||
assert source in content
|
||||
|
||||
|
||||
def test_get_project_cmakelists_uses_supplied_builtin_components() -> None:
|
||||
"""A cached list replaces project_description.json and is still filtered
|
||||
by EXCLUDE_COMPONENTS."""
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user