avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] SIGNAL or INTERRUPT ?!


From: User Tomdean
Subject: Re: [avr-gcc-list] SIGNAL or INTERRUPT ?!
Date: Sat, 3 Sep 2005 09:52:02 -0700 (PDT)

Sorry, I omitted, build one of each and look at the output of
avr-objdump -d.  If you need to be very fast, you can use the naked
attribute and do all the save/restore yourself.  Your handler should
NOT change the status register so if you use naked, save and restore
SREG.

/*
 * work.c = test something
 */
#include <avr/io.h>
#include <avr/signal.h>   /* cli */

int main() {
  while (1);

  return 0;
}

/* vector 14 - handler does NOT contain an sei instruction */
SIGNAL(SIG_ADC) {
}

/* vector 10 - handler contains an sei instruction */
INTERRUPT(SIG_SPI) {
}

# avr-objdump -d work.elf
...
00000098 <__vector_14>:
  98:   1f 92           push    r1
  9a:   0f 92           push    r0
  9c:   0f b6           in      r0, 0x3f        ; 63
  9e:   0f 92           push    r0
  a0:   11 24           eor     r1, r1
  a2:   0f 90           pop     r0
  a4:   0f be           out     0x3f, r0        ; 63
  a6:   0f 90           pop     r0
  a8:   1f 90           pop     r1
  aa:   18 95           reti

000000ac <__vector_10>:
  ac:   78 94           sei
  ae:   1f 92           push    r1
  b0:   0f 92           push    r0
  b2:   0f b6           in      r0, 0x3f        ; 63
  b4:   0f 92           push    r0
  b6:   11 24           eor     r1, r1
  b8:   0f 90           pop     r0
  ba:   0f be           out     0x3f, r0        ; 63
  bc:   0f 90           pop     r0
  be:   1f 90           pop     r1
  c0:   18 95           reti


tomdean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]