[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] getting a short interrupt vector table, and PROGMEM v
From: |
Jan Waclawek |
Subject: |
Re: [avr-libc-dev] getting a short interrupt vector table, and PROGMEM vs .init0 |
Date: |
Mon, 6 Feb 2012 10:38:22 +0100 |
That's because .initX sections *are* located after .progmem etc.
You want to have a look at the default linker scripts, and probably want to
place your experimental stuff into .vectors (which would probably be sort of
obvious if you had a look at the original vectors table source in gcrt1.S).
JW
----- Original Message ---------------
>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...)
>
>Thanks
>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
>question.))