1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/cortexm_common: work around bug on WFI for STM32

See [1] for details. (archive.org backup at [2]).

Fixes https://github.com/RIOT-OS/RIOT/issues/13918
Fixes https://github.com/RIOT-OS/RIOT/issues/14015

[1]: https://cliffle.com/blog/stm32-wfi-bug/
[2]: https://web.archive.org/web/20231205101603/https://cliffle.com/blog/stm32-wfi-bug/
This commit is contained in:
Marian Buschsieweke 2023-12-05 11:17:54 +01:00
parent 848f3d1ade
commit 1c281d2768
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6
2 changed files with 14 additions and 0 deletions

View File

@ -167,6 +167,10 @@ static inline void cortexm_sleep(int deep)
unsigned state = irq_disable();
__DSB();
__WFI();
/* Some CPUs require an ISB after WFI to work around silicon bugs */
#if CORTEXM_ISB_REQUIRED_AFTER_WFI
__ISB();
#endif
irq_restore(state);
}

View File

@ -87,6 +87,16 @@
extern "C" {
#endif
/**
* @brief Enable workaround for bug in WFI by issuing an ISB
*
* This works around a bug on STM32 systems, see [1] for details, or [2] for
* an archive.org backup.
* [1]: https://cliffle.com/blog/stm32-wfi-bug
* [2]: https://web.archive.org/web/20231205101603/https://cliffle.com/blog/stm32-wfi-bug/
*/
#define CORTEXM_ISB_REQUIRED_AFTER_WFI 1
/**
* @brief ARM Cortex-M specific CPU configuration
* @{