[Top][All Lists]

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

Re: [avr-gcc-list] Is some special attribute or qualifier required tomak

From: Jan Waclawek
Subject: Re: [avr-gcc-list] Is some special attribute or qualifier required tomake C function tables to use the right linker stubs?
Date: Fri, 2 May 2014 13:43:04 +0200

>Will avr-gcc use the right relocation when picking one function from the
>array and calling it?

No, the relocation happened earlier, when the function pointer is getting
allocated during linking (i.e when the *value* of the function pointer is
getting determined). All the function pointers are 16-bit, but they will
get a stub allocated in the "trampolines". If you use linker relaxation,
only those functions allocated above the >64kW boundary will get a stub,
others are used "directly".

>or should I declare the functions with some
>special attribute 


>and/or do some assembler magic with gs() operator when
>calling those kind of functions.

Not in C. If you write mixed C/asm, then you use gs() operator exactly as
you would use pm() in the <64kW FLASH models.

>So far I see that gcc put some trampoline calls after the interrupt
>vectors for some functions, but everything fits within the first 64K so far.

You apparently don't use linker relaxations and use a fairly new linker,
thus all function pointers already go through the "trampolines"; so from
functioning point of view nothing will change when you cross the boundary.

>I'm just trying to be sure that when code begin to fall off the first
>64K, I'm not going to get funny problems a few weeks later, after I
>completely forgot about this thing.

Why don't you try. Add

void bigfoo(void) {
".skip 70000,0 \n\t"

to inflate the code artificially.

However, in some applications the code itself does not exceed the 64kW
boundary, and it's only extensive PROGMEM data which makes it so. In such
case it may be worth to move those data above code - but this decision
depends on the particularities of the case.


reply via email to

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