__attribute__((__interrupt__)) ?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I use AVR32 studio with GNU toolchain and EVK1101, I was wondering what does mean this part of code

__attribute__((__interrupt__))

I made a simple program for handle external interrupt and call a function, if I don't put above code before interrupt function it doesn't work, why?

Because I lost a lot of time to find the problem in my code, and the problem was missing above part of code, I must confess I find it accidentally, is there any documentation about this programming tricks?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this is no programming trick.
An interrupt service routing needs different handling (context switching, return, ...) than an normal function.
Example: to return form a normal function you need a "ret" instruction. To return form an isr you need a "rete" instruction.
But how should your C-Compiler know which to use? So you will need the attribute.

For for information take a look at the gcc manual.

hope I could help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, thanks