This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why do all unused interrupts have 0x441A default value ?

IIRC, the 0x4400 address is where the _c_init0 functions is. Since that's the RESET interrupt value, it looks good.

However, 0x441A, is an endless loop (_TI_ISR_TRAP). Why do interrupts point to this ? What is the point of getting the program stuck ?

Thank you.

  • The idea is that since you didn't set a handler for that interrupt, you are asserting that that interrupt cannot/should not happen in your application. If it does come to pass, better that there should be a handler doing something than jumping to whatever random address was in the interrupt vector. As for why an infinite loop versus a halt instruction, this interrupt wasn't supposed to happen, so why not?
  • Why not omit it ?
  • If we omit __TI_ISR_TRAP, what are we going to put in unused interrupt slots? It's not a good idea to let it be random, so we should set it to some value. It would either need to be set to a known valid address (e.g. _c_int00) or an invalid address (e.g. 0xffff). If you get an unexpected interrupt, you'll either have unexpected reboots in the middle of your program, or a stray PC, or potentially a cascade of interrupts. Better to direct unexpected interrupts to jail, either an infinite loop or a halt instruction.

    You are free to fill all of the unused interrupt slots with whatever handler you like, perhaps one that just returns, effectively ignoring the interrupt.