* andrewhutchin...@cox.net <andrewhutchin...@cox.net> [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.


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to