Exception Handler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-13 5:55 AM
i try to crash my code to check the watchdog timer is reseting the code or not. for crashing my code i use timer interrupt. i.e
TIM2_IRQHandler()
{
---------------;
---------------;
}
TIM_IRQHandler() instead of TIM2_IRQHandler . so, code will be crash at that time watchdog timer should reset the my code and some Exception Handler is there.
Example,
1)Hardfault
2)MemManage
3)BusFault
4)UsageFault
how to make my code stuck in an exception handler.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-14 5:41 AM
Here is an excellent overview: https://wiki.segger.com/Cortex-M_Fault with code.
If you don't make your variables volatile, the compiler can optimize the div away, especially if b is a compile-time known constant. Disasm may help here too.
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-13 7:40 AM
On M3, M4 and M7 integer divide-by-zero generates a UsageFault exception,
So divide by 0 and set an infinite loop in the UsageFault handler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-13 10:38 PM
@Nikita91​ Thank you for your comment.
i tried divide by 0.
int a = 5, b = 0;
a=a/b;
but i'm not get infinite loop.
if you know any other method tell me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-14 2:12 AM
Not by default. It has to be enabled:
https://interrupt.memfault.com/blog/cortex-m-hardfault-debug#configurable-usage-faults
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-14 2:14 AM
for (;;);
Infinite loop is not a hard fault...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-14 5:41 AM
Here is an excellent overview: https://wiki.segger.com/Cortex-M_Fault with code.
If you don't make your variables volatile, the compiler can optimize the div away, especially if b is a compile-time known constant. Disasm may help here too.
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-15 12:45 AM
@KnarfB​ Thank you
