HardFault Handler not being executed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-19 1: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.
- Labels:
-
DEBUG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-19 1: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​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-19 6: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.
