Illegal Opcode IRQ

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Illegal Opcode IRQ

2,932件の閲覧回数
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,621件の閲覧回数
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,621件の閲覧回数
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.