mirror of
https://github.com/esphome/esphome.git
synced 2026-07-02 21:33:16 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 911512c4ec | |||
| 92e7b6bc81 | |||
| e706bdbadd |
@@ -1058,6 +1058,7 @@ CONF_DISABLE_MBEDTLS_PEER_CERT = "disable_mbedtls_peer_cert"
|
||||
CONF_DISABLE_MBEDTLS_PKCS7 = "disable_mbedtls_pkcs7"
|
||||
CONF_DISABLE_REGI2C_IN_IRAM = "disable_regi2c_in_iram"
|
||||
CONF_DISABLE_FATFS = "disable_fatfs"
|
||||
CONF_RMT_RECV_IN_IRAM = "rmt_recv_in_iram"
|
||||
|
||||
# VFS requirement tracking
|
||||
# Components that need VFS features can call require_vfs_*() functions
|
||||
@@ -1071,6 +1072,7 @@ KEY_MBEDTLS_PEER_CERT_REQUIRED = "mbedtls_peer_cert_required"
|
||||
KEY_MBEDTLS_PKCS7_REQUIRED = "mbedtls_pkcs7_required"
|
||||
KEY_FATFS_REQUIRED = "fatfs_required"
|
||||
KEY_MBEDTLS_SHA512_REQUIRED = "mbedtls_sha512_required"
|
||||
KEY_RMT_RECV_IRAM_REQUIRED = "rmt_recv_iram_required"
|
||||
|
||||
|
||||
def require_vfs_select() -> None:
|
||||
@@ -1168,6 +1170,17 @@ def require_fatfs() -> None:
|
||||
CORE.data[KEY_ESP32][KEY_FATFS_REQUIRED] = True
|
||||
|
||||
|
||||
def require_rmt_recv_iram() -> None:
|
||||
"""Mark that RMT receive IRAM safety is required by a component.
|
||||
|
||||
Call this from components that use the RMT receive driver. When flash cache is
|
||||
disabled (e.g., during NVS writes by WiFi, BLE, Zigbee, or power management),
|
||||
the RMT receive function must be in IRAM to avoid crashes.
|
||||
This sets CONFIG_RMT_RECV_FUNC_IN_IRAM.
|
||||
"""
|
||||
CORE.data[KEY_ESP32][KEY_RMT_RECV_IRAM_REQUIRED] = True
|
||||
|
||||
|
||||
def _parse_idf_component(value: str) -> ConfigType:
|
||||
"""Parse IDF component shorthand syntax like 'owner/component^version'"""
|
||||
# Match operator followed by version-like string (digit or *)
|
||||
@@ -1268,6 +1281,7 @@ FRAMEWORK_SCHEMA = cv.Schema(
|
||||
cv.Optional(CONF_DISABLE_MBEDTLS_PEER_CERT, default=True): cv.boolean,
|
||||
cv.Optional(CONF_DISABLE_MBEDTLS_PKCS7, default=True): cv.boolean,
|
||||
cv.Optional(CONF_DISABLE_REGI2C_IN_IRAM, default=True): cv.boolean,
|
||||
cv.Optional(CONF_RMT_RECV_IN_IRAM, default=False): cv.boolean,
|
||||
cv.Optional(CONF_DISABLE_FATFS, default=True): cv.boolean,
|
||||
}
|
||||
),
|
||||
@@ -2068,6 +2082,16 @@ async def to_code(config):
|
||||
if advanced[CONF_DISABLE_REGI2C_IN_IRAM]:
|
||||
add_idf_sdkconfig_option("CONFIG_ESP_REGI2C_CTRL_FUNC_IN_IRAM", False)
|
||||
|
||||
# Place RMT receive functions in IRAM for cache safety
|
||||
# When flash cache is disabled (during NVS writes by WiFi, BLE, Zigbee, Thread,
|
||||
# power management, etc.), RMT receive will crash if these functions are in flash.
|
||||
# Components using RMT receive call require_rmt_recv_iram() to force this.
|
||||
if (
|
||||
CORE.data[KEY_ESP32].get(KEY_RMT_RECV_IRAM_REQUIRED, False)
|
||||
or advanced[CONF_RMT_RECV_IN_IRAM]
|
||||
):
|
||||
add_idf_sdkconfig_option("CONFIG_RMT_RECV_FUNC_IN_IRAM", True)
|
||||
|
||||
# Disable FATFS support
|
||||
# Components that need FATFS (SD card, etc.) can call require_fatfs()
|
||||
if CORE.data[KEY_ESP32].get(KEY_FATFS_REQUIRED, False):
|
||||
|
||||
@@ -21,6 +21,7 @@ from esphome.const import (
|
||||
PlatformFramework,
|
||||
)
|
||||
from esphome.core import CORE, TimePeriod
|
||||
from esphome.types import ConfigType
|
||||
|
||||
CONF_FILTER_SYMBOLS = "filter_symbols"
|
||||
CONF_RECEIVE_SYMBOLS = "receive_symbols"
|
||||
@@ -101,6 +102,13 @@ def validate_tolerance(value):
|
||||
)
|
||||
|
||||
|
||||
def _require_rmt_iram(config: ConfigType) -> ConfigType:
|
||||
"""Register RMT receive IRAM requirement during config validation."""
|
||||
if CORE.is_esp32 and esp32.get_esp32_variant() not in esp32_rmt.VARIANTS_NO_RMT:
|
||||
esp32.require_rmt_recv_iram()
|
||||
return config
|
||||
|
||||
|
||||
MULTI_CONF = True
|
||||
CONFIG_SCHEMA = remote_base.validate_triggers(
|
||||
cv.Schema(
|
||||
@@ -193,6 +201,7 @@ CONFIG_SCHEMA = remote_base.validate_triggers(
|
||||
)
|
||||
)
|
||||
.add_extra(validate_config)
|
||||
.add_extra(_require_rmt_iram)
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user