avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] IVT for Atmega644ap missing Vectors > __vector_20


From: Senthil Kumar Selvaraj
Subject: Re: [avr-gcc-list] IVT for Atmega644ap missing Vectors > __vector_20
Date: Wed, 24 Apr 2013 11:52:45 +0530
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Apr 23, 2013 at 12:36:30PM -0700, Eastman Hackney wrote:
> 
> 
> 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

Can you drop the -mmcu=avr5 and try? I don't have a copy of 4.3.4 right
now, but atleast the last few versions of the compiler (avr-gcc 4.6.2
and above) know what arch the mcu belongs to, and the driver
automatically passes that on to the assembler/linker - you don't have to
specify that explicitly.

On the latest toolchain, I see the correct behavior if I drop the
mmcu=avr5 i.e. > 20 entries in the vector table, and the behavior you
describe if the option is present.

Explicitly specifying -mmcu=avr5 when linking results in the following command 
line to the linker.

 /home/saaadhu/avr/install/libexec/gcc/avr/4.9.0/collect2 -m avr5
 /home/saaadhu/avr/install/lib/gcc/avr/4.9.0/../../../../avr/lib/avr5/crtm16.o
 -L/home/saaadhu/avr/install/lib/gcc/avr/4.9.0/avr5
 -L/home/saaadhu/avr/install/lib/gcc/avr/4.9.0/../../../../avr/lib/avr5
 -L/home/saaadhu/avr/install/lib/gcc/avr/4.9.0
 -L/home/saaadhu/avr/install/lib/gcc/avr/4.9.0/../../../../avr/lib
 /tmp/ccCrT1hV.o --start-group -lgcc -lm -lc --end-group

Notice that it is linking against crtm16.o, which I guess is the
"canonical" avr5 device according to libc, and the vector table is of
course for that device.

If you still see the same behavior after removing -mmcu=avr5 (atleast
when linking), can you add -v and -Wl,--verbose and show us the output?

Regards
Senthil

> 
> 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

> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/avr-gcc-list




reply via email to

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