summaryrefslogtreecommitdiff
path: root/core/cortex-m
diff options
context:
space:
mode:
Diffstat (limited to 'core/cortex-m')
-rw-r--r--core/cortex-m/watchdog.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/cortex-m/watchdog.c b/core/cortex-m/watchdog.c
index 3e62b5f4c5..9e4a82c7b0 100644
--- a/core/cortex-m/watchdog.c
+++ b/core/cortex-m/watchdog.c
@@ -6,6 +6,7 @@
/* Watchdog common code */
#include "common.h"
+#include "cpu.h"
#include "panic.h"
#include "task.h"
#include "timer.h"
@@ -28,6 +29,13 @@ void __keep watchdog_trace(uint32_t excep_lr, uint32_t excep_sp)
panic_set_reason(PANIC_SW_WATCHDOG, stack[6],
(excep_lr & 0xf) == 1 ? 0xff : task_get_current());
+ /*
+ * This is our last breath, the last opportunity to sort out all
+ * matters. Flush and invalidate D-cache if cache enabled.
+ */
+ if (IS_ENABLED(CONFIG_ARMV7M_CACHE))
+ cpu_clean_invalidate_dcache();
+
panic_printf("### WATCHDOG PC=%08x / LR=%08x / pSP=%08x ",
stack[6], stack[5], psp);
if ((excep_lr & 0xf) == 1)