Re: Internal handling of interrupt vectors and jump table

Georg-Johann Lay <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
Am 08/11/2015 um 12:04 PM schrieb Klaus Rudolph:
> can someone explain how interrupt vectors are handled in gcc internally?

ISR functions are implemented as function attributes, i.e. there are 
avr-specific function attribute (__interrupt__, __signal__) which turn an 
ordinary function into an ISR.  Main outcome of these attributes is that 
./gcc/config/avr/avr.c::avr_expand_prologue() emits a different prologue for 
ISRs.  Similar for avr_expand_epilogue().

Attribute handling like special diagnostics for ISRs is performed by 
avr_set_current_function().


> OK, I saw that in  /opt/avr_5.2.0/lib/gcc/avr/5.2.0/../../../../avr/lib/avr5/crtatmega32.o
>
> the empty vector table is included, like:
>
> Disassembly of section .vectors:
> 00000000 <__vectors>:
> 0:   0c 94 00 00     jmp     0       ; 0x0 <__vectors>
> 4:   0c 94 00 00     jmp     0       ; 0x0 <__vectors>
> 8:   0c 94 00 00     jmp     0       ; 0x0 <__vectors>
>
> And I also can see, that my code results in:
>
> Disassembly of section .text:
> 00000000 <__vector_7>:

The .vectors section is implemented in AVR-LibC's gcrt1.S.
ISR and similar macros are provided by interrupt.h.


> but where can I see that __vector_7 goes to the correct place in the table?

To see the macros after expansion compile with -save-temps and read the 
respective .i file (C) or .ii file (C++).

Johann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.