[Top][All Lists]

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

[avr-libc-dev] getting a short interrupt vector table, and PROGMEM vs .i

From: Bill Westfield
Subject: [avr-libc-dev] getting a short interrupt vector table, and PROGMEM vs .init0
Date: Mon, 6 Feb 2012 01:17:02 -0800

In the case where a size-limited program is only using one interrupt
(this is "usbtiny" on an ATtiny2313, and avr-gcc 4.3.2), is there a
good way to get an "abbreviated" vector table instead of having
vectors for everything?

Assuming not, I figured I'd supress the normal gcc init files
(-nostdlib -nostartfiles) and create my own vector table:
extern void __vector_1(void);
void myinit(void) __attribute__((naked)) __attribute__ ((section (".init1")));
void myinit(void)
        asm volatile(
                "  rjmp main\n"
                "  rjmp __vector_1");

This seems to work OK, except that data defined with PROGMEM seems to
get put in my .elf file ahead of the .init1 code.
How come?  Any way around that?  I tired used a section .init9
attribute on the data instead of PROGMEM, but that doesn't seem to do
what I want either (leaves it in the data section...)

Bill W

(short program that shows the problem attached.  Compile with "avr-gcc
-nostdlib -g -mmcu=attiny2313 -nostartfiles -o foo.elf foo.c"
(Yes, I know that this isn't a correct program as-is.  That's not the

Attachment: foo.c
Description: Text Data

reply via email to

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