[esp8266] Expose the saved-settings space to config-time checks

This commit is contained in:
J. Nick Koston
2026-10-13 13:42:45 -10:00
parent 3cdcf0417a
commit 34d251fe7e
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -24,6 +24,12 @@ KEY_LDSCRIPT = "ldscript"
# Crash-decode tools, resolved once per run by __init__
KEY_DECODE_TOOLS = "decode_tools"
# Space for saved settings, in 4-byte words, from preferences.cpp: RTC memory has two regions
# (RTC_NORMAL_REGION_WORDS, RTC_EBOOT_REGION_WORDS) that one saved value cannot span; with
# restore_from_flash everything goes to flash (ESP8266_FLASH_STORAGE_SIZE)
PREFERENCES_RTC_REGION_WORDS = (78, 32)
PREFERENCES_FLASH_WORDS = 128
# esp8266 namespace is already defined by arduino, manually prefix esphome
esp8266_ns = cg.global_ns.namespace("esphome").namespace("esp8266")
@@ -24,6 +24,7 @@ static constexpr uint32_t ESP_RTC_USER_MEM_SIZE_BYTES = ESP_RTC_USER_MEM_SIZE_WO
// - Eboot region: RTC words 0-31 (reserved, mapped from preference offset 78-109)
// - Normal region: RTC words 32-109 (mapped from preference offset 0-77)
// - Crash handler: RTC words 110-127 (reserved for crash_handler.cpp backtrace data)
// const.py mirrors the region and flash sizes for config-time space checks
static constexpr uint32_t RTC_EBOOT_REGION_WORDS = 32; // Words 0-31 reserved for eboot
static constexpr uint32_t RTC_NORMAL_REGION_WORDS = 78; // Words 32-109 for normal prefs
static constexpr uint32_t PREF_TOTAL_WORDS = RTC_EBOOT_REGION_WORDS + RTC_NORMAL_REGION_WORDS; // 110