Kürzer als das folgende bekomme ich es nicht hin:
Code:
#include <avr/signal.h>
#include <avr/interrupt.h>
#include <inttypes.h>
void foo( uint8_t param );
// key press down
SIGNAL( SIG_INTERRUPT0 )
{
foo( 0 );
}
void _VECTOR(2)( void ) __attribute__ ((naked));
void _VECTOR(2)( void )
{
foo(3);
__asm__ __volatile__ ("reti" ::);
}
void foo( uint8_t param )
{
}
Aus Vector(2) wird dann
Code:
/* function __vector_1 size 43 (3) */
.LFE3:
.size __vector_1, .-__vector_1
.global __vector_2
.type __vector_2, @function
__vector_2:
.LFB4:
.LM3:
/* prologue: frame size=0 */
/* prologue: naked */
/* prologue end (size=0) */
.LM4:
ldi r24,lo8(3)
call foo
.LM5:
/* #APP */
reti
Das Retten und Restaurieren von SREG muss dann von Hand rein.
Lesezeichen