2021-07-19 01:44 AM
When a HardFault occurs, the program jump to HardFault_Handler function but it is not being executed.
I'm usen STM32CubeIde, when I'm in debugging session, the arrow is stuck in the name of the function but nothing more happens: checkFault(); is not executed.
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
checkFault();
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
Something wrong in de startup file? Any idea of what I'm missing?
Thanks.
2021-07-19 01:48 AM
Hello @PaoloValentino ,
checkFault() could've been optimized by the compiler if it has no side-effect. Try setting the optimization level to 0 and do another test.
Best regards,
@SBEN .2
2021-07-19 06:56 AM
Check the disassembly to see what's actually going on.
Reduce optimization settings, or make things in checkFault volatile if it's being optimized out.