How to trap Double Bus Faults?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to trap Double Bus Faults?

Jump to solution
1,355 Views
ynaught
Contributor III
In the process of debugging my code, when the program runs "off in the weeds", sometimes I'll get a "Double Bus Fault" error.
 
I am using Wind River's (USB) Probe for In-Circuit debugging, and when you get a Double Bus Fault, it's rendered useless until you reinitialize it (which trashes any info that might've told me WTF happened).
 
My CPU is MCF5271.  All OS is homegrown.
 
What I expect is possible is defining a "fenced" area of memory from which the CPU is allowed to execute code, and a special exception vector I could use to catch instances of the PC going outside this range.
 
Anyone know how to pull this off?
 
Thanks.
Labels (1)
0 Kudos
1 Solution
323 Views
ynaught
Contributor III
I now know the punchline to this joke so in case somebody else is suffering, here it is:
 
A bus fault triggers an exception (interrupt) handler.  A bus fault can happen when a non-existant memory location is read or written.
 
A double bus fault happens when an EXCEPTION HANDLER causes a bus fault.  In other words, your exception handler needs an exception handler, and Coldfire doesn't do that.
 
So for the most part, my solution for Double Bus Faults has been to issue a "halt" command in my exception routine (only when DEBUG mode is enabled), so I can crawl up in there with my ICE and find out what happened.  When DEBUG is disabled, the default is (usually) to do a hard reboot, which continues to work.

View solution in original post

0 Kudos
1 Reply
324 Views
ynaught
Contributor III
I now know the punchline to this joke so in case somebody else is suffering, here it is:
 
A bus fault triggers an exception (interrupt) handler.  A bus fault can happen when a non-existant memory location is read or written.
 
A double bus fault happens when an EXCEPTION HANDLER causes a bus fault.  In other words, your exception handler needs an exception handler, and Coldfire doesn't do that.
 
So for the most part, my solution for Double Bus Faults has been to issue a "halt" command in my exception routine (only when DEBUG mode is enabled), so I can crawl up in there with my ICE and find out what happened.  When DEBUG is disabled, the default is (usually) to do a hard reboot, which continues to work.
0 Kudos