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

Merge pull request #20149 from maribu/cpu/stm32/buf-wfi

cpu/cortexm_common: work around bug on WFI for STM32
This commit is contained in:
Marian Buschsieweke 2023-12-09 15:45:12 +00:00 committed by GitHub
commit 43e62e68f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
* @{