From 8b6d0920a8df97e00e84c54cb521ed6d177b5662 Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Wed, 27 Feb 2019 15:03:10 +0100 Subject: [PATCH] STM32H7: Reset Reason update --- targets/TARGET_STM/reset_reason.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/targets/TARGET_STM/reset_reason.c b/targets/TARGET_STM/reset_reason.c index 6772c34ebc..b73d1f1869 100644 --- a/targets/TARGET_STM/reset_reason.c +++ b/targets/TARGET_STM/reset_reason.c @@ -27,18 +27,36 @@ reset_reason_t hal_reset_reason_get(void) } #endif +#ifdef RCC_FLAG_LPWR1RST + if ((__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR1RST))||(__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR2RST))) { + return RESET_REASON_WAKE_LOW_POWER; + } +#endif + #ifdef RCC_FLAG_WWDGRST if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST)) { return RESET_REASON_WATCHDOG; } #endif +#ifdef RCC_FLAG_WWDG1RST + if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDG1RST)) { + return RESET_REASON_WATCHDOG; + } +#endif + #ifdef RCC_FLAG_IWDGRST if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST)) { return RESET_REASON_WATCHDOG; } #endif +#ifdef RCC_FLAG_IWDG1RST + if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDG1RST)) { + return RESET_REASON_WATCHDOG; + } +#endif + #ifdef RCC_FLAG_SFTRST if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST)) { return RESET_REASON_SOFTWARE; @@ -69,7 +87,11 @@ reset_reason_t hal_reset_reason_get(void) uint32_t hal_reset_reason_get_raw(void) { +#if TARGET_STM32H7 + return RCC->RSR; +#else /* TARGET_STM32H7 */ return RCC->CSR; +#endif /* TARGET_STM32H7 */ }