From b3906539f141b84cda1a2c99ecd2a712de577c00 Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Sun, 6 Jan 2019 16:16:18 +0100
Subject: [PATCH] cpu/esp8266: fix ets_post when flash is written

During flash write access, the IROM cache cannot be used and is disabled therefore. During that time, ets_post crashes if a functions is called which is not in IRAM. Therefore thread_flags_set must not be called if IROM cache is disabled.
---
 cpu/esp8266/sdk/ets_task.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpu/esp8266/sdk/ets_task.c b/cpu/esp8266/sdk/ets_task.c
index d9702315a7..62ddfc88b1 100644
--- a/cpu/esp8266/sdk/ets_task.c
+++ b/cpu/esp8266/sdk/ets_task.c
@@ -181,7 +181,7 @@ uint32_t IRAM ets_post (uint32_t prio, ETSSignal sig, ETSParam par)
         system_soft_wdt_feed();
     }
 
-    if (ets_thread) {
+    if (ets_thread && irom_cache_enabled()) {
         thread_flags_set((thread_t*)ets_thread, THREAD_FLAG_ETS_THREAD);
     }
 
-- 
GitLab