Why is RCC_FLAG_CPURST disabled by a #ifdef in the stm32h7xx_hal_rcc.h?
In the HAL Library for the STM32H7 familiy (version 1.11.0) downloaded with STMCubeMx there is the following entry in the stm32h7xx_hal_rcc.h file:
#if defined(RCC_RSR_CPURSTF) // <<---- This is the line in question
#define RCC_FLAG_CPURST ((uint8_t)0x91)
#endif /* RCC_RSR_CPURSTF */
[...]
#define RCC_FLAG_C1RST (RCC_FLAG_CPURST)
#define RCC_FLAG_C2RST ((uint8_t)0x92)In the stm32h755xx.h file the "RCC_RSR_CPURSTF" is not defined. Why is that?
According to the reference manual (RM0399, chapter 9.7.38) there is C1RSTF flag in the RCC_RSR register at bit position 17, which corresponds to the defined value above of 0x91 for RCC_FLAG_C1RST (if it was active) when using the Makro "__HAL_RCC_GET_FLAG(...)" to check wheter a C1RST occurred.
The above mentioned "#if defined(RCC_RSR_CPURSTF) " was introduced after HAL Library version 1.5.0, where there was no such define.
When we are looking for example in the "stm32h753xx.h" device file, there this define is present:
#define RCC_RSR_CPURSTF_Pos (17U)
#define RCC_RSR_CPURSTF_Msk (0x1UL << RCC_RSR_CPURSTF_Pos) /*!< 0x00020000 */
#define RCC_RSR_CPURSTF RCC_RSR_CPURSTF_MskWhen we are looking in the "stm32h755xx.h" (which we are using) device file, the define appears but it is renamed:
#define RCC_RSR_C1RSTF_Pos (17U)
#define RCC_RSR_C1RSTF_Msk (0x1UL << RCC_RSR_C1RSTF_Pos) /*!< 0x00020000 */
#define RCC_RSR_C1RSTF RCC_RSR_C1RSTF_MskHowever, in the stm32h7xx_hal_rcc.h the #ifdef is still done for "RCC_RSR_CPURSTF" (see above).
Is this renaming of this flag an error in the HAL library for the STM32H755?
With the actual HAL library it is not possible to check if a C1RST occurred or not.
Any help is appreciated.
