Fix comment about function calls and initialize ipsr

- Update ISR safety comment: point 3 now reflects that
  wake_loop_any_context() is called (ISR-safe)
- Initialize ipsr = 0 as safety net before inline asm
This commit is contained in:
J. Nick Koston
2026-02-28 15:01:12 -10:00
parent bdeba1710e
commit fb998468b5
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -315,7 +315,7 @@ void IRAM_ATTR HOT Component::enable_loop_soon_any_context() {
// This method is thread and ISR-safe because:
// 1. Only performs simple assignments to volatile variables (atomic on all platforms)
// 2. No read-modify-write operations that could be interrupted
// 3. No memory allocation, object construction, or function calls
// 3. No memory allocation or object construction; the only call (wake_loop_any_context) is ISR-safe
// 4. IRAM_ATTR ensures code is in IRAM, not flash (required for ISR execution)
// 5. Components are never destroyed, so no use-after-free concerns
// 6. App is guaranteed to be initialized before any ISR could fire
+1 -1
View File
@@ -247,7 +247,7 @@ void IRAM_ATTR esphome_lwip_wake_main_loop_from_isr(int *px_higher_priority_task
// Avoids depending on CMSIS __get_IPSR() which may not be declared/available
// in all LibreTiny chip family toolchains (e.g. beken-72xx).
static inline uint32_t esphome_get_ipsr(void) {
uint32_t ipsr;
uint32_t ipsr = 0;
__asm volatile("mrs %0, ipsr" : "=r"(ipsr));
return ipsr;
}