Bug 47696 - [AVR] Compilation for atmega2560 produces incomplete interrupt vector table (USART2,3)
Summary: [AVR] Compilation for atmega2560 produces incomplete interrupt vector table (...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 14:44 UTC by Joseph Lacerte
Modified: 2011-02-14 15:51 UTC (History)
4 users (show)

See Also:
Host: x86_32
Target: AVR
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Patch based on the proposed solution. Seems to fix the problem. (294 bytes, patch)
2011-02-14 14:51 UTC, Omar Choudary
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Lacerte 2011-02-11 14:44:28 UTC
avr-gcc -v
Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/home/joseph/local/avr/libexec/gcc/avr/4.5.2/lto-wrapper
Target: avr
Configured with: ../configure --prefix=/home/joseph/local/avr --target=avr --enable-languages=c --disable-nls --disable-libssp --with-dwarf2
Thread model: single
gcc version 4.5.2 (GCC)


Produced vector table (dump by stk500v2 bootloader):

[...]
49 - 0060 = 94 0C 00 87 jmp 000087 >00010E TIMER5 COMPB
50 - 0062 = 94 0C 00 87 jmp 000087 >00010E TIMER5 COMPC
51 - 0064 = 94 0C 00 87 jmp 000087 >00010E TIMER5 OVF
52 - 0066 = 24 11 BE 1F  USART2 RX
53 - 0068 = EF CF E2 D1 rjmp  2FCF >00606E USART2 UDRE
54 - 006A = BF DE BF CD  USART2 TX
55 - 006C = E0 00 BF 0C rjmp  2000 >0040D8 USART3 RX
56 - 006E = E0 12 E0 A0 rjmp  2012 >004100 USART3 UDRE
57 - 0070 = E0 B2 EF E4 rjmp  20B2 >004244 USART3 TX
Bootloader>


changing file gcc/config/avr/avr-devices.c line #190 from:
 { "atmega2560",           ARCH_AVR6, "__AVR_ATmega2560__",        0, 0x0200, "m2561" },

To:
 { "atmega2560",           ARCH_AVR6, "__AVR_ATmega2560__",        0, 0x0200, "m2560" },

seems to solve the problem:

[...]
49 - 0060 = 94 0C 00 93 jmp 000093 >000126 TIMER5 COMPB
50 - 0062 = 94 0C 00 93 jmp 000093 >000126 TIMER5 COMPC
51 - 0064 = 94 0C 00 93 jmp 000093 >000126 TIMER5 OVF
52 - 0066 = 94 0C 02 4D jmp 00024D >00049A USART2 RX
53 - 0068 = 94 0C 00 93 jmp 000093 >000126 USART2 UDRE
54 - 006A = 94 0C 00 93 jmp 000093 >000126 USART2 TX
55 - 006C = 94 0C 00 93 jmp 000093 >000126 USART3 RX
56 - 006E = 94 0C 00 93 jmp 000093 >000126 USART3 UDRE
57 - 0070 = 94 0C 00 93 jmp 000093 >000126 USART3 TX
Bootloader>


Please review this section, I have limited understanding of the compilation/linking mechanism.

Thanks,

JL
Comment 1 Anitha Boyapati 2011-02-12 18:32:28 UTC
(In reply to comment #0)

> changing file gcc/config/avr/avr-devices.c line #190 from:
>  { "atmega2560",           ARCH_AVR6, "__AVR_ATmega2560__",        0, 0x0200,
> "m2561" },
> 
> To:
>  { "atmega2560",           ARCH_AVR6, "__AVR_ATmega2560__",        0, 0x0200,
> "m2560" },
> 
> seems to solve the problem:

The fix is correct. The last column points to corresponding library. I presume this is a typo.

Thanks for the analysis!
Comment 2 Omar Choudary 2011-02-14 14:51:48 UTC
Created attachment 23337 [details]
Patch based on the proposed solution. Seems to fix the problem.

Just a patch based on the solution described.
Comment 3 aesok 2011-02-14 15:49:39 UTC
Author: aesok
Date: Mon Feb 14 15:49:35 2011
New Revision: 170137

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170137
Log:
	PR target/47696
	* config/avr/avr-devices.c (avr_mcu_types): Fix ATmega2560 device
	description.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-devices.c
Comment 4 aesok 2011-02-14 15:51:18 UTC
Fixed.