Illegal Opcode IRQ

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Illegal Opcode IRQ

2,531 次查看
Yellowfish
Contributor I

Hi,

 

I wonder if anyone can help me. I am using the MC9S12XDT512 processor and something is causing the unimplemented opcode IRQ to execute.

 

How can I go about finding what part of my code caused this to happen?

 

Thanks,

Stuart

标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

1,220 次查看
kef
Specialist I
In your trap handler you could inspect the stack. Illegal instruction trap ISR return address (and I think the address of illegal instruction +2, must check)  should be stored at SP+8.
I think you should try using onchip trace buffer. I'm not familiar with it. But I would try to enable trace buffer, put breakpoint in trap ISR, and when breakpoint is hit trying to trace it.

1,220 次查看
Lundin
Senior Contributor IV
Most common cause is indeed stack overflow.

The quick & dirty way to find stack errors is to download the code through the debugger, then in the memory map, set every byte in the whole stack area to a certain value, like 0xAA.

After that, start the program and let it run. When it catches the breakpoint for illegal instruction, pick up the memory map and check the stack. You should be able to see how much of the 0xAA on the stack that the program has munched away at. If it is all the way to the top, or close, then the cause is stack overflow.