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

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

Re: [avr-gcc-list] Why are we using EICALL and EIJMP for AVR256?


From: Lars Noschinski
Subject: Re: [avr-gcc-list] Why are we using EICALL and EIJMP for AVR256?
Date: Tue, 15 Dec 2009 19:31:32 +0100
User-agent: mutt-ng/devel-r804 (Linux)

* address@hidden <address@hidden> [09-12-15 19:09]:
> void  (*fptr)();
> 
> fptr = main;
> 
> (*fptr)();  //Will use EICALL - should be CALL main

Hm, this problem seems to exist not only for the "big device". Using gcc
4.3.4 (from debian testing) on following C file with

$ avr-gcc -Wa,-adhlns=foo.lst foo.c -o foo.out -O2 -mmcu=atmega88

-- foo.c --------
static const void (*fptr)() = 0;

int main(void) {
    fptr();
}
-----------------

yields the following code:

-----------------
  13                    main:
  14                    /* prologue: function */
  15                    /* frame size = 0 */
  16 0000 E0E0                  ldi r30,lo8(0)
  17 0002 F0E0                  ldi r31,hi8(0)
  18 0004 0995                  icall
  19                    /* epilogue start */
  20 0006 0895                  ret
-----------------

i.e. uses an indirect call instead of an direct call.

 - Lars.




reply via email to

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