I'm stumped & some help would be GREATLY appreciated. Weening myself from
Windows and AVR Studio (after realizing that it uses avr-gcc!). I apologize if
this posting is verbose - but I wanted to be thorough.
Using avr-gcc version 4.3.4 (obtained with 'apt-get install gcc-avr avr-libc avrdude' ...).
Compiling and linking with commands copied from the avr-libc user manual:
avr-gcc -c -gstabs -g -O0 -mmcu=avr5 -mmcu=atmega644p main.c
avr-gcc -mmcu=avr5 -mmcu=atmega644pa -o main.elf main.o -lm
avr-objdump -D -h -S main.elf > main.lst
avr-gcc -g -mmcu=avr5 -mmcu=atmega644pa -Wl,-Map,main.map -o main.elf main.o
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
sudo avrdude -P usb -p m644 -c jtagmkII -e -U
flash:w:main.hex:a
When flash is loaded, the code runs fine, including a Timer0 ISR. But if I enable the UART1
TXCIE1 interrupt flag (Atmega644 has two Uarts), the USART1_UDRE_vect does not seem
to show up in the interrupt Vector Table.
Looking at the compiler-generated code in main.lst shows only 21 vectors (Atmega644 datasheet
lists 31 vectors), and does not include a vector for USART1_UDRE_vect. The listed vectors seem
correct for the Atmega644, but why won't it include vectors greater than vector_20, and specifically
the one for USART1_UDRE_vect?
Listing of main.lst:
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 2a 00 jmp 0x54 ; 0x54 <__ctors_end>
4: 0c 94 60 03 jmp 0x6c0 ; 0x6c0 <__vector_1>
8: 0c 94 61 03 jmp 0x6c2 ; 0x6c2 <__vector_2>
c: 0c 94 62 03 jmp 0x6c4 ; 0x6c4 <__vector_3>
10: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
14: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
18: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
1c: 0c 94 47 00 jmp 0x8e ; 0x8e
<__bad_interrupt>
20: 0c 94 63 03 jmp 0x6c6 ; 0x6c6 <__vector_8>
24: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
28: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
2c: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
30: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
34: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
38: 0c 94 47 00 jmp 0x8e ;
0x8e <__bad_interrupt>
3c: 0c 94 67 03 jmp 0x6ce ; 0x6ce <__vector_15>
40: 0c 94 7e 02 jmp 0x4fc ; 0x4fc <__vector_16>
44: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
48: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
4c: 0c 94 47 00 jmp 0x8e ; 0x8e <__bad_interrupt>
50: 0c 94 64 03 jmp 0x6c8 ; 0x6c8 <__vector_20>
00000054 <__ctors_end>:
54: 11 24
eor r1, r1
The C source code for the USART1_UDRE_vect is:
ISR(USART1_UDRE_vect, ISR_NAKED)
{
uc cSREG;
cSREG = SREG;
if (U1_tx_count > 0)
{
UDR1 = U1_tx_fifo[U1_tx_optr];
U1_tx_optr++;
if (U1_tx_optr >= TX_FIFO_SIZ)
U1_tx_optr = 0;
U1_tx_count--;
}
else
UCSR1B &= ~(1 << UDRIE1);
SREG = cSREG;
reti();
}
Thanks for considering this. East Hackney