Personal tools
You are here: Home Forums R8C/Tiny Illegal Instructions (after Enabling Interrupts)

Illegal Instructions (after Enabling Interrupts)

Up to R8C/Tiny

Illegal Instructions (after Enabling Interrupts)

Posted by RicoB at August 20. 2008

I changed my project to generated sect30.inc, nc_define.h, ncrt0.a30 - bevor I used the sect30.inc, ncrt0.a30. As I had problem with setting the heap size, stack size I changed.

Now as soon as I enable the interrupts 'asm( "FSET I")' I'll get 'Illegal Instruction' while debbuging with E8.

All settings are the same as befor also the interrupt entries in sect30.inc ... 

Re: Illegal Instructions (after Enabling Interrupts)

Posted by Jesse Kuo at October 06. 2008
Dear Rico, Please check your function of interrupt. Does it include: "#pragma INTERRUPT FunctionName" If it is not, when retur from this function, compiler will use user stack to return program counter. However, interrupt use Istack BRS

Re: Illegal Instructions (after Enabling Interrupts)

Posted by FrankL at October 06. 2008

Which compiler version do you use? In the latest compilers the interrupt vector table in sect30.inc is disabled with ".if 0". Please have a look at the vector table in E8 to see if the entries make sense.

The question about #pragma interrupt is correct, but the reason is wrong. If you do not have the #pragma interrupt functionname, the compiler will exit the function with RTS (return from subroutine), not with REIT (return from interrupt). But these instructions read different data from stack. So if an interrupt function is exit with RTS the processor does not find the return address and could jump to anywhere in the address range.

Powered by Ploneboard