From ac9328381c394eacb8e7100f7223dc7d181e9c7c Mon Sep 17 00:00:00 2001
From: Francisco Acosta <fco.ja.ac@gmail.com>
Date: Wed, 7 Feb 2018 23:36:10 +0100
Subject: [PATCH] cpu/cortexm_common: add NOP after WFI to avoid hardfault on
 stm32l152

---
 cpu/cortexm_common/include/cpu.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cpu/cortexm_common/include/cpu.h b/cpu/cortexm_common/include/cpu.h
index 2d3d7aa701..558046fbb0 100644
--- a/cpu/cortexm_common/include/cpu.h
+++ b/cpu/cortexm_common/include/cpu.h
@@ -107,6 +107,10 @@ static inline void cortexm_sleep(int deep)
     unsigned state = irq_disable();
     __DSB();
     __WFI();
+#if defined(CPU_MODEL_STM32L152RE)
+    /* STM32L152RE crashes without this __NOP(). See #8518. */
+    __NOP();
+#endif
     irq_restore(state);
 }
 
-- 
GitLab