avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] getting a short interrupt vector table


From: Bill Westfield
Subject: Re: [avr-libc-dev] getting a short interrupt vector table
Date: Mon, 6 Feb 2012 22:32:24 -0800

> > would it help to make ./crt1/gcrt1.S:__vectors weak so that
> > user can provide his own vector table?
>
> Don't know.  Someone could give that a try,

Ok, I gave it a try.  Downloaded avr-libc1.6.4 (which is what I think
I have, but the object files don't match), and added a .weak for
__vectors:
        .section .vectors,"ax",@progbits
        .global __vectors
        .func   __vectors
        .weak   __vectors
__vectors:

And then in my main.c did:

void __vectors(void) __attribute__((naked)) __attribute__ ((section
(".vectors")));
void __vectors(void)
{
        asm volatile(
                "  rjmp main\n"
                "  rjmp __vector_1");
}

This ended up resulting in including BOTH vector tables in the final
.elf file (but no complaint about the symbols.)  However, if I link
with "-nostartfiles" I seem to get the desired behavior.  (but
-nostartfiles doesn't normally suppress the vector table...)

How is the crtxxx file linked into the final target?  In order for the
weak symbol to be overridden by my own definition, it would have to be
treated as a library, and should come "after" my code, right?  Does
-nostartfiles essentially move the crt file from mandatory to library
status?  Does it always put the .vectors section in the right place.
If this does work, I should be able to "weaken" __vectors in the
crtxxx.o file using avr-objcopy, obviating the need for source access
and mitigating any version issues with avr-libc?



reply via email to

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