6 Feb 10:17
getting a short interrupt vector table, and PROGMEM vs .init0
Bill Westfield <westfw <at> gmail.com>
2012-02-06 09:17:02 GMT
2012-02-06 09:17:02 GMT
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.))
(Continue reading)
RSS Feed