1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

[ci] Add LibreTiny (BK72XX) to memory impact analysis (#12983)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2026-01-05 07:40:49 -10:00
committed by GitHub
parent e87a3b3916
commit 6aaaae5d0e
3 changed files with 103 additions and 8 deletions

View File

@@ -92,18 +92,23 @@ def run_detailed_analysis(build_dir: str) -> dict | None:
print(f"Build directory not found: {build_dir}", file=sys.stderr)
return None
# Find firmware.elf
# Find firmware.elf (or raw_firmware.elf for LibreTiny)
elf_path = None
for elf_candidate in [
build_path / "firmware.elf",
build_path / ".pioenvs" / build_path.name / "firmware.elf",
# LibreTiny uses raw_firmware.elf
build_path / "raw_firmware.elf",
build_path / ".pioenvs" / build_path.name / "raw_firmware.elf",
]:
if elf_candidate.exists():
elf_path = str(elf_candidate)
break
if not elf_path:
print(f"firmware.elf not found in {build_dir}", file=sys.stderr)
print(
f"firmware.elf/raw_firmware.elf not found in {build_dir}", file=sys.stderr
)
return None
# Find idedata.json - check multiple locations

View File

@@ -89,6 +89,7 @@ class Platform(StrEnum):
ESP32_C6_IDF = "esp32-c6-idf"
ESP32_S2_IDF = "esp32-s2-idf"
ESP32_S3_IDF = "esp32-s3-idf"
BK72XX_ARD = "bk72xx-ard" # LibreTiny BK7231N
# Memory impact analysis constants
@@ -120,6 +121,7 @@ PLATFORM_SPECIFIC_COMPONENTS = frozenset(
# fastest build times, most sensitive to code size changes
# 3. ESP32 IDF - Primary ESP32 platform, most representative of modern ESPHome
# 4-6. Other ESP32 variants - Less commonly used but still supported
# 7. BK72XX - LibreTiny platform (good for detecting LibreTiny-specific changes)
MEMORY_IMPACT_PLATFORM_PREFERENCE = [
Platform.ESP32_C6_IDF, # ESP32-C6 IDF (newest, supports Thread/Zigbee)
Platform.ESP8266_ARD, # ESP8266 Arduino (most memory constrained, fastest builds)
@@ -127,6 +129,7 @@ MEMORY_IMPACT_PLATFORM_PREFERENCE = [
Platform.ESP32_C3_IDF, # ESP32-C3 IDF
Platform.ESP32_S2_IDF, # ESP32-S2 IDF
Platform.ESP32_S3_IDF, # ESP32-S3 IDF
Platform.BK72XX_ARD, # LibreTiny BK7231N
]
@@ -404,7 +407,7 @@ def _detect_platform_hint_from_filename(filename: str) -> Platform | None:
- wifi_component_esp_idf.cpp, *_idf.h -> ESP32 IDF variants
- wifi_component_esp8266.cpp, *_esp8266.h -> ESP8266_ARD
- *_esp32*.cpp -> ESP32 IDF (generic)
- *_libretiny.cpp, *_retiny.* -> LibreTiny (not in preference list)
- *_libretiny.cpp, *_bk72*.* -> BK72XX (LibreTiny)
- *_pico.cpp, *_rp2040.* -> RP2040 (not in preference list)
Args:
@@ -438,10 +441,11 @@ def _detect_platform_hint_from_filename(filename: str) -> Platform | None:
if "esp32" in filename_lower:
return Platform.ESP32_IDF
# LibreTiny and RP2040 are not in MEMORY_IMPACT_PLATFORM_PREFERENCE
# so we don't return them as hints
# if "retiny" in filename_lower or "libretiny" in filename_lower:
# return None # No specific LibreTiny platform preference
# LibreTiny (via 'libretiny' pattern or BK72xx-specific files)
if "libretiny" in filename_lower or "bk72" in filename_lower:
return Platform.BK72XX_ARD
# RP2040 is not in MEMORY_IMPACT_PLATFORM_PREFERENCE
# if "pico" in filename_lower or "rp2040" in filename_lower:
# return None # No RP2040 platform preference