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.))
#include <avr/pgmspace.h> void myinit(void) __attribute__((naked)) __attribute__ ((section (".init0"))); void myinit(void) { asm volatile( " rjmp main\n" " rjmp __vector_1\n"); } // ---------------------------------------------------------------------- // Main // ---------------------------------------------------------------------- int main(void) __attribute__ ((OS_main)) __attribute__ ((section (".init9"))); int main(void) { } void __vector_1(void) __attribute__ ((signal)); void __vector_1(void) { } char somedata[] PROGMEM = "test";
_______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev