Interrupt service routines

The AVR CrossWorks C compiler provides the __ctl_interrupt modifier that will generate the required code on entry and exit from the interrupt service routines. All you have to do is write your interrupt-handling code.

void basic_timer_irq(void) __ctl_interrupt[TIMER0_COMP_vect]
  // Do your interrupt handling here.

The ISR will run on a dedicated stacks which avoids having to allocate stack spaces for ISR's on each task stacks. You must specify the dedicated stack sizes using the the linker symbols CTL_IRQ_CALL_STACK_SIZE and CTL_IRQ_DATA_STACK_SIZE. For example, using CTL_IRQ_CALL_STACK_SIZE=64 will allocate 64 bytes for the ISR's call stack and CTL_IRQ_DATA_STACK_SIZE=64 will allocate 64 bytes for the ISR's data stack.