Hi All,Can you Please share your experiance on,-> how to resolve/debug Access/Illegal Instruction Exception error in Coldfire 5275?-> Due to which cause/reason these exception errors occur?
There is a guide to debugging exceptions here: http://www.utasker.com/forum/index.php?topic=123.msg468#msg468
Typical exceptions are trying to access non-existing memory.
Thanks for such useful information. But this will guide for Exceptional occur due to "Address Error". Can you please help me for "Access error" and "Illegal Instruction" Exception?
Find "cfprm.pdf" on Freescale's site, download and read the "Exception Processing" chapter.
Read Section 3.7 in the MCF5275 Reference Manual. It is very good and has a huge section describing all the exceptions. If you then search the PDF document for "access error" you'll get 14 matches, many of which list what can cause this exception.
"Illegal instructions" are obvious. The CPU started fetching from where there aren't legal instructions. This is detailed in the Reference Manual too.
But you don't want to know what these are, you want someone to tell you how to make them go away.
Mark already did that. His link gives an excellent tutorial for debugging all sorts of problems like this.
Simply put, you use the debugger, then inspect the stack and memory to see how the CPU got to where it crashed.
Another old-fashioned but workable method is to mix single-stepping through the code with putting breakpoints "ahead" in the code and then seeing if it gets there or crashes before that point. Then you try again with different breakpoints, zeroing in on where it is failing.When you find the failing instructions it should be obvious.
The VERY old fashioned way to do this is to put print statements (or code to flash a LED) in the code, recompile, reload and so on, again zeroing in on where it is crashing. Sometimes these bugs can take weeks to find in complex code.
Another problem is getting an interrupt the CPU isn't set up to handle. So make sure you have "dummy interrupt handlers" for all possible interrupts, and put a breakpoint on that so it will let you know when this happens.
If you follow all of Mark's instructions and are still having problems you can say how far you got (in those instructions), what was on the stack, what is in the registers and where it was in your code (provide short extracts).
I checked "cfprm.pdf" rev.3 "Exception Processing" chapter. It describe all the exceptions for floating-Point arithmetic operations. As I am not using floating point arithmetic instruction, it will not helpful for me.I want to know if we don't have debugger, and if we have stack information and last PC value than - how to identity root cause using that information? - What are possible causes to generate those exceptions (Access & Illegal Instruction Errors)? So It will give me direction to identify root cause.Tectona
Sections 11.1.1, 11.1.2 and 11.1.3 of cfprm.pdf document the general exception conditions. Only sections 11.1.4 and later document the floqting point exceptions.
Have you read the chapter in the Reference Manual for your CPU that details all of the exceptions? You don't seem to have.
> if we have stack information and last PC value than
Section 11.1.2 gives the exception frame. Use it to decode your stack information.
You SEEM to have only read the first sentence in my response and then given up and not read any further. There seems to be a common disease where people can't seem to read beyond the first line of email or forum articles. I blame Twitter and iPhones. If you have this problem you may not have read this far
Until you've read the other NINE paragraphs in my response and reported back on how you went I'm not responding any more.
As I read sections 11.1.1, 11.1.2 and 11.1.3, I am able to understand cause of exceptions. From stack information I found that it's happen due to Access error / Illegal Instruction. In controller data sheet they give very brief information about Illegal instruction error.
So I only want to know your expert view about cause. & How you tackle these errors if you don't have debugger.
Cause: Your code is buggy. Millions of ways to get it wrong. You have provided ZERO details on your code so nobody can help you here.
How to tackle: Read the 8th paragraph in my previous-but-one email on "printf" and leds.
Otherwise all the information you need should be in the stack trace. You just have to LEARN this stuff by reading and understanding or doing. Or bring someone in who knows how to do this.
Access Error: Bad data pointer accessing bad address.
Illegal Instruction: Bad data pointer over writing the stack returning to the wrong place.
Retrieving data ...