[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Calling function with hard coded address
From: |
Claude Sylvain |
Subject: |
Re: [avr-gcc-list] Calling function with hard coded address |
Date: |
Wed, 01 Nov 2006 16:42:06 -0500 |
>
> I am trying to call functions with hard coded address as follow.
>
> typedef void (*func_type)( void );
>
> ((func_type) 0x1D400)();
>
> The problem is that the generated code is slightly different...
> (shown below)
>
> ff 95 00 ea call 0x7fd400
>
> Compare to standard function call (shown below)
>
> 0e 94 00 ea call 0x1d400
>
> What happened was that the upper 8 bits (bit16 to bit23 of address
> bits) are set to 1's instead of 0's.
>
> My questions are following.
>
> 1. Is this a bug?
>
> 2. is there a way to get around this?
>
> I am using avr-gcc 3.4.3 and binutil 2.15.
Hello,
I think you are right, this is a compiler bug.
To get partially rid of that, you can do the following...
typedef void (*func_type)(void);
...
func_type pfunc = (func_type) 0xD400;
...
pfunc();
- GCC-AVR do not seem to support EICALL, so address space for
function pointers are limited to the first 64K.
Also EICALL does not exist on some ATMega (the ATMega128 is one
of them).
Claude