mirror of
https://github.com/esphome/esphome.git
synced 2026-09-18 18:48:39 +00:00
3e5c4fd603cf04a1b662af75f94738fd6d266854
Previously, IRAM_ATTR was an empty no-op on every LibreTiny family, so any ISR handler (gpio binary sensor, cc1101, sx126x/sx127x, mcp23xxx, pcf8574, pca9554, pca6416a, pi4ioe5v6408, tca9555, ...) lived in flash. When the ISR fired while flash was busy (XIP stall, OTA, logger flash write), the device could deadlock or crash. - hal.h: IRAM_ATTR now routes each family into a RAM-resident section (RTL8710B .image2.ram.text, RTL8720C .sram.text, BK72xx / LN882H .data, which the SDK startup code copies from flash into SRAM before main). Also adds esphome::in_isr_context() as a portable always_inline ISR detection helper: xPortInIsrContext on ESP32, PS.INTLEVEL on ESP8266, IPSR on Cortex-M cores, CPSR mode on BK72xx ARM9. - main_task.h: both notify helpers marked always_inline so IRAM callers keep the wake path in IRAM; removes the ESP32-only notify_any_context which moves into wake.h. - wake.h / wake.cpp: LibreTiny now shares the ESP32 wake path via a new wake_main_task_any_context() helper that picks between xTaskNotifyGive and vTaskNotifyGiveFromISR using in_isr_context(). wake_loop_any_context and wake_loop_isrsafe are now IRAM_ATTR entry points on LibreTiny too. - libretiny/patch_linker.py.script: pre-link hook modelled on the ESP8266 testing_mode patcher. BK72xx linker templates declare the SRAM region as (rw!x), blocking code placement in .data. The hook flips that to (rwx) so IRAM_ATTR functions can be emitted there; the MMU already permits RAM execution (the Wi-Fi driver runs from SRAM). No-op on the other families.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
603 MiB
Languages
C++
55.7%
Python
43.7%
C
0.3%
JavaScript
0.2%
