Index: avr.c =================================================================== --- avr.c (revision 113395) +++ avr.c (working copy) @@ -126,20 +126,26 @@ /* Assembler only. */ int avr_asm_only_p = 0; +/* Usually holds the value 2, but could be 3 for the larger devices with a + 3-byte program counter. */ +int avr_pc_size = 2; + struct base_arch_s { int asm_only; int enhanced; int mega; + int three_byte_pc; const char *const macro; }; static const struct base_arch_s avr_arch_types[] = { - { 1, 0, 0, NULL }, /* unknown device specified */ - { 1, 0, 0, "__AVR_ARCH__=1" }, - { 0, 0, 0, "__AVR_ARCH__=2" }, - { 0, 0, 1, "__AVR_ARCH__=3" }, - { 0, 1, 0, "__AVR_ARCH__=4" }, - { 0, 1, 1, "__AVR_ARCH__=5" } + { 1, 0, 0, 0, NULL }, /* unknown device specified */ + { 1, 0, 0, 0, "__AVR_ARCH__=1" }, + { 0, 0, 0, 0, "__AVR_ARCH__=2" }, + { 0, 0, 1, 0, "__AVR_ARCH__=3" }, + { 0, 1, 0, 0, "__AVR_ARCH__=4" }, + { 0, 1, 1, 0, "__AVR_ARCH__=5" }, + { 0, 1, 1, 1, "__AVR_ARCH__=6" } }; struct mcu_type_s { @@ -209,6 +215,10 @@ { "atmega128", 5, "__AVR_ATmega128__" }, { "at90can128", 5, "__AVR_AT90CAN128__" }, { "at94k", 5, "__AVR_AT94K__" }, + /* 3-Byte PC */ + { "avr6", 5, NULL }, + { "atmega2560", 6, "__AVR_ATmega2560__" }, + { "atmega2561", 6, "__AVR_ATmega2561__" }, /* Assembler only. */ { "avr1", 1, NULL }, { "at90s1200", 1, "__AVR_AT90S1200__" }, @@ -291,6 +301,11 @@ avr_base_arch_macro = base->macro; avr_extra_arch_macro = t->macro; + if (base->three_byte_pc) + avr_pc_size = 3; + else + avr_pc_size = 2; + if (optimize && !TARGET_NO_TABLEJUMP) avr_case_values_threshold = (!AVR_MEGA || TARGET_CALL_PROLOGUES) ? 8 : 17; @@ -416,10 +431,10 @@ return 0; else { - int offset = frame_pointer_needed ? 2 : 0; + int offset = frame_pointer_needed ? (avr_pc_size) : 0; offset += avr_regs_to_save (NULL); - return get_frame_size () + 2 + 1 + offset; + return get_frame_size () + (avr_pc_size) + 1 + offset; } } Index: t-avr =================================================================== --- t-avr (revision 113395) +++ t-avr (working copy) @@ -37,8 +37,8 @@ FPBIT = fp-bit.c -MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr3/mmcu=avr4/mmcu=avr5 -MULTILIB_DIRNAMES = avr2 avr3 avr4 avr5 +MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr3/mmcu=avr4/mmcu=avr5/mmcu=avr6 +MULTILIB_DIRNAMES = avr2 avr3 avr4 avr5 avr6 # The many avr2 matches are not listed here - this is the default. MULTILIB_MATCHES = \ @@ -56,7 +56,8 @@ mmcu?avr5=mmcu?atmega325 mmcu?avr5=mmcu?atmega3250 \ mmcu?avr5=mmcu?atmega64 mmcu?avr5=mmcu?atmega128 \ mmcu?avr5=mmcu?atmega645 mmcu?avr5=mmcu?atmega6450 \ - mmcu?avr5=mmcu?at94k mmcu?avr5=mmcu?at90can128 + mmcu?avr5=mmcu?at94k mmcu?avr5=mmcu?at90can128 \ + mmcu?avr6=mmcu?atmega2560 mmcu?avr6=mmcu?atmega2561 MULTILIB_EXCEPTIONS = Index: avr.h =================================================================== --- avr.h (revision 113395) +++ avr.h (working copy) @@ -708,12 +708,13 @@ #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}" -#define CC1_SPEC "%{profile:-p}" +#define CC1_SPEC "%{profile:-p} -fno-delete-null-pointer-checks" #define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \ %{!fenforce-eh-specs:-fno-enforce-eh-specs} \ - %{!fexceptions:-fno-exceptions}" -/* A C string constant that tells the GCC drvier program options to + %{!fexceptions:-fno-exceptions} \ + -fno-delete-null-pointer-checks" +/* A C string constant that tells the GCC driver program options to pass to `cc1plus'. */ #define ASM_SPEC "%{mmcu=*:-mmcu=%*}" @@ -723,6 +724,8 @@ %{mmcu=attiny22|mmcu=attiny26|mmcu=at90s2*|mmcu=at90s4*|mmcu=at90s8*|mmcu=at90c8*|mmcu=at86rf401|mmcu=attiny13|mmcu=attiny2313:-m avr2}\ %{mmcu=atmega103|mmcu=atmega603|mmcu=at43*|mmcu=at76*:-m avr3}\ %{mmcu=atmega8*|mmcu=atmega48:-m avr4}\ +%{mmcu=atmega2560|mmcu=atmega2561:-m avr6}\ +%{mmcu=atmega2560|mmcu=atmega2561: -Tdata 0x800200}\ %{mmcu=atmega16*|mmcu=atmega32*|mmcu=atmega64*|mmcu=atmega128|mmcu=at90can128|mmcu=at94k:-m avr5}\ %{mmcu=atmega325|mmcu=atmega3250|mmcu=atmega48|mmcu=atmega88|mmcu=atmega64|mmcu=atmega645|mmcu=atmega6450|mmcu=atmega128|mmcu=at90can128|mmcu=at90can128|mmcu=atmega162|mmcu=atmega165|mmcu=atmega168|mmcu=atmega169: -Tdata 0x800100} " @@ -786,7 +789,9 @@ %{mmcu=atmega6450:crtm6450.o%s} \ %{mmcu=atmega128:crtm128.o%s} \ %{mmcu=at90can128:crtcan128.o%s} \ -%{mmcu=at94k:crtat94k.o%s}" +%{mmcu=at94k:crtat94k.o%s}\ +%{mmcu=atmega2560:crtm2560.o%s} \ +%{mmcu=atmega2561:crtm2561.o%s}" #define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},