This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

dummy isr for unused interrupts

Hello together,

I'm using the XC866-Board from Infineon.
As I don't use all the availible interrupts in my program I would like to simply overwrite the NOPs of the interrupt vectors with RETIs to make sure the program does not accidentaly run into my code when an unused interrupt should occure.
Is there a simpler alternative than writing a interrupt service routine for every unused interrupt like

void dummyISR() interrupt xy
{
}

Thanks in advance

Parents
  • "If the software has gone wild enough to write to a register you didn't intend it to then it is very unlikely it is going to recover gracefully."
    No, but at least it could stay in the isr and not do any more harm...

    "No ISR will be called if the interrupt is disabled in IE."
    I know, but if I would enable all interrupts and have a dummy routine then it would jump to this routine and stay there.

    "I'm not sure where you get this idea about executing NOPs from."
    The NOPs are not in the isr but at the location of the interrupt vectors. And if the controller gets there it executes the NOPs

Reply
  • "If the software has gone wild enough to write to a register you didn't intend it to then it is very unlikely it is going to recover gracefully."
    No, but at least it could stay in the isr and not do any more harm...

    "No ISR will be called if the interrupt is disabled in IE."
    I know, but if I would enable all interrupts and have a dummy routine then it would jump to this routine and stay there.

    "I'm not sure where you get this idea about executing NOPs from."
    The NOPs are not in the isr but at the location of the interrupt vectors. And if the controller gets there it executes the NOPs

Children
  • "No, but at least it could stay in the isr and not do any more harm..."

    I just can't see that that would make any difference. It would stop the main thread of execution at some unknown point after that thread had already run wild. You've no way of telling whether this is a better or worse situation than the one you've prevented.

    "I know, but if I would enable all interrupts and have a dummy routine then it would jump to this routine and stay there."

    But why would you want to do that? Assume a glitch on an unused external interrupt pin. If the interrupt is disabled nothing happens, if it is enabled the program hangs. What's the point?

    "The NOPs are not in the isr but at the location of the interrupt vectors. And if the controller gets there it executes the NOPs"

    If you're using C51 and you don't have an ISR for that interrupt you'll most likely find there's program code at the location that is vectored to. There's no reason to suspect you'll find NOPs there.