aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2009-06-23 23:14:11 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2009-06-23 23:14:11 +0400
commit59ab92d2918a7e7ee914bf86cff5bcbabb68d9b9 (patch)
tree32802b739934030c58f3589d23ed35b2f3eaede3 /gcc/config
parent33436e29779504361151f07a6a75970d03b5fe4c (diff)
downloadgcc-59ab92d2918a7e7ee914bf86cff5bcbabb68d9b9.zip
gcc-59ab92d2918a7e7ee914bf86cff5bcbabb68d9b9.tar.gz
gcc-59ab92d2918a7e7ee914bf86cff5bcbabb68d9b9.tar.bz2
config.gcc (avr-*-rtems*, avr-*-*): Set extra_gcc_objs and extra_objs.
* config.gcc (avr-*-rtems*, avr-*-*): Set extra_gcc_objs and extra_objs. * config/avr/avr.c (avr_current_device): New variable. (avr_arch_types, avr_mcu_types): Move to avr-deveces.c. (avr_arch, mcu_type_s): Move to avr.h. * config/avr/avr.h (base_arch_s). Add reserved2, arch_name and default_data_section_start fields. (avr_arch): Moved from avr.c. (mcu_type_s): Moved from avr.c. Add short_sp, data_section_start and library_name fields. (avr_current_device, avr_mcu_types, avr_arch_types, avr_device_to_arch, avr_device_to_data_start, avr_device_to_startfiles, avr_device_to_devicelib): Declare. (EXTRA_SPEC_FUNCTIONS): Define. (LINK_SPEC): Remove device name to '-m ...' and '-Tdata ...' linker options mapping. Use device_to_arch and device_to_data_start insted. (STARTFILE_SPEC): Use device_to_startfile instead of crt_binutils. (CRT_BINUTILS_SPECS, EXTRA_SPECS): Remove. * config/avr/t-avr (driver-avr.o, avr-devices.o): New rules. * config/avr/driver-avr.c: New file. * config/avr/avr-devices.c: New file. From-SVN: r148868
Diffstat (limited to 'gcc/config')
-rwxr-xr-xgcc/config/avr/avr-devices.c199
-rw-r--r--gcc/config/avr/avr.c200
-rw-r--r--gcc/config/avr/avr.h297
-rwxr-xr-xgcc/config/avr/driver-avr.c115
-rw-r--r--gcc/config/avr/t-avr8
5 files changed, 390 insertions, 429 deletions
diff --git a/gcc/config/avr/avr-devices.c b/gcc/config/avr/avr-devices.c
new file mode 100755
index 0000000..f422b4e
--- /dev/null
+++ b/gcc/config/avr/avr-devices.c
@@ -0,0 +1,199 @@
+/* Copyright (C) 2009
+ Free Software Foundation, Inc.
+ Contributed by Anatoly Sokolov (aesok@post.ru)
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+
+/* List of all known AVR MCU architectyres. */
+
+const struct base_arch_s avr_arch_types[] = {
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, NULL, "avr2" }, /* unknown device specified */
+ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=1", "avr1" },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=2", "avr2" },
+ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=25", "avr25" },
+ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=3", "avr3" },
+ { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=31", "avr31" },
+ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=35", "avr35" },
+ { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=4", "avr4" },
+ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=5", "avr5" },
+ { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, "__AVR_ARCH__=51", "avr51" },
+ { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0x0060, "__AVR_ARCH__=6", "avr6" }
+};
+
+/* List of all known AVR MCU types - if updated, it has to be kept
+ in sync in several places (FIXME: is there a better way?):
+ - here;
+ - t-avr (MULTILIB_MATCHES);
+ - gas/config/tc-avr.c;
+ - avr-libc. */
+
+const struct mcu_type_s avr_mcu_types[] = {
+ /* Classic, <= 8K. */
+ { "avr2", ARCH_AVR2, NULL, 0, 0x0060, "s8515" },
+ { "at90s2313", ARCH_AVR2, "__AVR_AT90S2313__", 1, 0x0060, "s2313" },
+ { "at90s2323", ARCH_AVR2, "__AVR_AT90S2323__", 1, 0x0060, "s2323" },
+ { "at90s2333", ARCH_AVR2, "__AVR_AT90S2333__", 1, 0x0060, "s2333" },
+ { "at90s2343", ARCH_AVR2, "__AVR_AT90S2343__", 1, 0x0060, "s2343" },
+ { "attiny22", ARCH_AVR2, "__AVR_ATtiny22__", 1, 0x0060, "tn22" },
+ { "attiny26", ARCH_AVR2, "__AVR_ATtiny26__", 1, 0x0060, "tn26" },
+ { "at90s4414", ARCH_AVR2, "__AVR_AT90S4414__", 0, 0x0060, "s4414" },
+ { "at90s4433", ARCH_AVR2, "__AVR_AT90S4433__", 1, 0x0060, "s4433" },
+ { "at90s4434", ARCH_AVR2, "__AVR_AT90S4434__", 0, 0x0060, "s4434" },
+ { "at90s8515", ARCH_AVR2, "__AVR_AT90S8515__", 0, 0x0060, "s8515" },
+ { "at90c8534", ARCH_AVR2, "__AVR_AT90C8534__", 0, 0x0060, "c8534" },
+ { "at90s8535", ARCH_AVR2, "__AVR_AT90S8535__", 0, 0x0060, "s8535" },
+ /* Classic + MOVW, <= 8K. */
+ { "avr25", ARCH_AVR25, NULL, 0, 0x0060, "tn85" },
+ { "ata6289", ARCH_AVR25, "__AVR_ATA6289__", 0, 0x0100, "a6289" },
+ { "attiny13", ARCH_AVR25, "__AVR_ATtiny13__", 1, 0x0060, "tn13" },
+ { "attiny13a", ARCH_AVR25, "__AVR_ATtiny13A__", 1, 0x0060, "tn13a" },
+ { "attiny2313", ARCH_AVR25, "__AVR_ATtiny2313__", 1, 0x0060, "tn2313" },
+ { "attiny24", ARCH_AVR25, "__AVR_ATtiny24__", 1, 0x0060, "tn24" },
+ { "attiny44", ARCH_AVR25, "__AVR_ATtiny44__", 0, 0x0060, "tn44" },
+ { "attiny84", ARCH_AVR25, "__AVR_ATtiny84__", 0, 0x0060, "tn84" },
+ { "attiny25", ARCH_AVR25, "__AVR_ATtiny25__", 1, 0x0060, "tn25" },
+ { "attiny45", ARCH_AVR25, "__AVR_ATtiny45__", 0, 0x0060, "tn45" },
+ { "attiny85", ARCH_AVR25, "__AVR_ATtiny85__", 0, 0x0060, "tn85" },
+ { "attiny261", ARCH_AVR25, "__AVR_ATtiny261__", 1, 0x0060, "tn261" },
+ { "attiny461", ARCH_AVR25, "__AVR_ATtiny461__", 0, 0x0060, "tn461" },
+ { "attiny861", ARCH_AVR25, "__AVR_ATtiny861__", 0, 0x0060, "tn861" },
+ { "attiny43u", ARCH_AVR25, "__AVR_ATtiny43U__", 0, 0x0060, "tn43u" },
+ { "attiny87", ARCH_AVR25, "__AVR_ATtiny87__", 0, 0x0100, "tn87" },
+ { "attiny48", ARCH_AVR25, "__AVR_ATtiny48__", 0, 0x0100, "tn48" },
+ { "attiny88", ARCH_AVR25, "__AVR_ATtiny88__", 0, 0x0100, "tn88" },
+ { "at86rf401", ARCH_AVR25, "__AVR_AT86RF401__", 1, 0x0060, "86401" },
+ /* Classic, > 8K, <= 64K. */
+ { "avr3", ARCH_AVR3, NULL, 0, 0x0060, "43355" },
+ { "at43usb355", ARCH_AVR3, "__AVR_AT43USB355__", 0, 0x0060, "43355" },
+ { "at76c711", ARCH_AVR3, "__AVR_AT76C711__", 0, 0x0060, "76711" },
+ /* Classic, == 128K. */
+ { "avr31", ARCH_AVR31, NULL, 0, 0x0060, "m103" },
+ { "atmega103", ARCH_AVR31, "__AVR_ATmega103__", 0, 0x0060, "m103" },
+ { "at43usb320", ARCH_AVR31, "__AVR_AT43USB320__", 0, 0x0060, "43320" },
+ /* Classic + MOVW + JMP/CALL. */
+ { "avr35", ARCH_AVR35, NULL, 0, 0x0100, "usb162" },
+ { "at90usb82", ARCH_AVR35, "__AVR_AT90USB82__", 0, 0x0100, "usb82" },
+ { "at90usb162", ARCH_AVR35, "__AVR_AT90USB162__", 0, 0x0100, "usb162" },
+ { "attiny167", ARCH_AVR35, "__AVR_ATtiny167__", 0, 0x0100, "tn167" },
+ { "attiny327", ARCH_AVR35, "__AVR_ATtiny327__", 0, 0x0100, "tn327" },
+ /* Enhanced, <= 8K. */
+ { "avr4", ARCH_AVR4, NULL, 0, 0x0060, "m8" },
+ { "atmega8", ARCH_AVR4, "__AVR_ATmega8__", 0, 0x0060, "m8" },
+ { "atmega48", ARCH_AVR4, "__AVR_ATmega48__", 0, 0x0100, "m48" },
+ { "atmega48p", ARCH_AVR4, "__AVR_ATmega48P__", 0, 0x0100, "m48p" },
+ { "atmega88", ARCH_AVR4, "__AVR_ATmega88__", 0, 0x0100, "m88" },
+ { "atmega88p", ARCH_AVR4, "__AVR_ATmega88P__", 0, 0x0100, "m88p" },
+ { "atmega8515", ARCH_AVR4, "__AVR_ATmega8515__", 0, 0x0060, "m8515" },
+ { "atmega8535", ARCH_AVR4, "__AVR_ATmega8535__", 0, 0x0060, "m8535" },
+ { "atmega8c1", ARCH_AVR4, "__AVR_ATmega8C1__", 0, 0x0100, "m8c1" },
+ { "atmega8m1", ARCH_AVR4, "__AVR_ATmega8M1__", 0, 0x0100, "m8m1" },
+ { "atmega8hva", ARCH_AVR4, "__AVR_ATmega8HVA__", 0, 0x0100, "m8hva" },
+ { "atmega4hvd", ARCH_AVR4, "__AVR_ATmega4HVD__", 0, 0x0100, "m4hvd" },
+ { "atmega8hvd", ARCH_AVR4, "__AVR_ATmega8HVD__", 0, 0x0100, "m8hvd" },
+ { "at90pwm1", ARCH_AVR4, "__AVR_AT90PWM1__", 0, 0x0100, "90pwm1" },
+ { "at90pwm2", ARCH_AVR4, "__AVR_AT90PWM2__", 0, 0x0100, "90pwm2" },
+ { "at90pwm2b", ARCH_AVR4, "__AVR_AT90PWM2B__", 0, 0x0100, "90pwm2b" },
+ { "at90pwm3", ARCH_AVR4, "__AVR_AT90PWM3__", 0, 0x0100, "90pwm3" },
+ { "at90pwm3b", ARCH_AVR4, "__AVR_AT90PWM3B__", 0, 0x0100, "90pwm3b" },
+ { "at90pwm81", ARCH_AVR4, "__AVR_AT90PWM81__", 0, 0x0100, "90pwm81" },
+ /* Enhanced, > 8K, <= 64K. */
+ { "avr5", ARCH_AVR5, NULL, 0, 0x0060, "m16" },
+ { "atmega16", ARCH_AVR5, "__AVR_ATmega16__", 0, 0x0060, "m16" },
+ { "atmega161", ARCH_AVR5, "__AVR_ATmega161__", 0, 0x0060, "m161" },
+ { "atmega162", ARCH_AVR5, "__AVR_ATmega162__", 0, 0x0100, "m162" },
+ { "atmega163", ARCH_AVR5, "__AVR_ATmega163__", 0, 0x0060, "m163" },
+ { "atmega164p", ARCH_AVR5, "__AVR_ATmega164P__", 0, 0x0100, "m164p" },
+ { "atmega165", ARCH_AVR5, "__AVR_ATmega165__", 0, 0x0100, "m165" },
+ { "atmega165p", ARCH_AVR5, "__AVR_ATmega165P__", 0, 0x0100, "m165p" },
+ { "atmega168", ARCH_AVR5, "__AVR_ATmega168__", 0, 0x0100, "m168" },
+ { "atmega168p", ARCH_AVR5, "__AVR_ATmega168P__", 0, 0x0100, "m168p" },
+ { "atmega169", ARCH_AVR5, "__AVR_ATmega169__", 0, 0x0100, "m169" },
+ { "atmega169p", ARCH_AVR5, "__AVR_ATmega169P__", 0, 0x0100, "m169p" },
+ { "atmega32", ARCH_AVR5, "__AVR_ATmega32__", 0, 0x0060, "m32" },
+ { "atmega323", ARCH_AVR5, "__AVR_ATmega323__", 0, 0x0060, "m323" },
+ { "atmega324p", ARCH_AVR5, "__AVR_ATmega324P__", 0, 0x0100, "m324p" },
+ { "atmega325", ARCH_AVR5, "__AVR_ATmega325__", 0, 0x0100, "m325" },
+ { "atmega325p", ARCH_AVR5, "__AVR_ATmega325P__", 0, 0x0100, "m325p" },
+ { "atmega3250", ARCH_AVR5, "__AVR_ATmega3250__", 0, 0x0100, "m3250" },
+ { "atmega3250p", ARCH_AVR5, "__AVR_ATmega3250P__", 0, 0x0100, "m3250p" },
+ { "atmega328p", ARCH_AVR5, "__AVR_ATmega328P__", 0, 0x0100, "m328p" },
+ { "atmega329", ARCH_AVR5, "__AVR_ATmega329__", 0, 0x0100, "m329" },
+ { "atmega329p", ARCH_AVR5, "__AVR_ATmega329P__", 0, 0x0100, "m329p" },
+ { "atmega3290", ARCH_AVR5, "__AVR_ATmega3290__", 0, 0x0100, "m3290" },
+ { "atmega3290p", ARCH_AVR5, "__AVR_ATmega3290P__", 0, 0x0100, "m3290p" },
+ { "atmega406", ARCH_AVR5, "__AVR_ATmega406__", 0, 0x0100, "m406" },
+ { "atmega64", ARCH_AVR5, "__AVR_ATmega64__", 0, 0x0100, "m64" },
+ { "atmega640", ARCH_AVR5, "__AVR_ATmega640__", 0, 0x0200, "m640" },
+ { "atmega644", ARCH_AVR5, "__AVR_ATmega644__", 0, 0x0100, "m644" },
+ { "atmega644p", ARCH_AVR5, "__AVR_ATmega644P__", 0, 0x0100, "m644p" },
+ { "atmega645", ARCH_AVR5, "__AVR_ATmega645__", 0, 0x0100, "m645" },
+ { "atmega6450", ARCH_AVR5, "__AVR_ATmega6450__", 0, 0x0100, "m6450" },
+ { "atmega649", ARCH_AVR5, "__AVR_ATmega649__", 0, 0x0100, "m649" },
+ { "atmega6490", ARCH_AVR5, "__AVR_ATmega6490__", 0, 0x0100, "m6490" },
+ { "atmega16hva", ARCH_AVR5, "__AVR_ATmega16HVA__", 0, 0x0100, "m16hva" },
+ { "atmega16hvb", ARCH_AVR5, "__AVR_ATmega16HVB__", 0, 0x0100, "m16hvb" },
+ { "atmega32hvb", ARCH_AVR5, "__AVR_ATmega32HVB__", 0, 0x0100, "m23hvb" },
+ { "at90can32", ARCH_AVR5, "__AVR_AT90CAN32__", 0, 0x0100, "can32" },
+ { "at90can64", ARCH_AVR5, "__AVR_AT90CAN64__", 0, 0x0100, "can64" },
+ { "at90pwm216", ARCH_AVR5, "__AVR_AT90PWM216__", 0, 0x0100, "90pwm216" },
+ { "at90pwm316", ARCH_AVR5, "__AVR_AT90PWM316__", 0, 0x0100, "90pwm316" },
+ { "atmega16c1", ARCH_AVR5, "__AVR_ATmega16C1__", 0, 0x0100, "m16c1" },
+ { "atmega32c1", ARCH_AVR5, "__AVR_ATmega32C1__", 0, 0x0100, "m32c1" },
+ { "atmega64c1", ARCH_AVR5, "__AVR_ATmega64C1__", 0, 0x0100, "m64c1" },
+ { "atmega16m1", ARCH_AVR5, "__AVR_ATmega16M1__", 0, 0x0100, "m16m1" },
+ { "atmega32m1", ARCH_AVR5, "__AVR_ATmega32M1__", 0, 0x0100, "m32m1" },
+ { "atmega64m1", ARCH_AVR5, "__AVR_ATmega64M1__", 0, 0x0100, "m64m1" },
+ { "atmega16u4", ARCH_AVR5, "__AVR_ATmega16U4__", 0, 0x0100, "m16u4" },
+ { "atmega32u4", ARCH_AVR5, "__AVR_ATmega32U4__", 0, 0x0100, "m32u4" },
+ { "atmega32u6", ARCH_AVR5, "__AVR_ATmega32U6__", 0, 0x0100, "m32u6" },
+ { "at90scr100", ARCH_AVR5, "__AVR_AT90SCR100__", 0, 0x0100, "90scr100" },
+ { "at90usb646", ARCH_AVR5, "__AVR_AT90USB646__", 0, 0x0100, "usb646" },
+ { "at90usb647", ARCH_AVR5, "__AVR_AT90USB647__", 0, 0x0100, "usb647" },
+ { "at94k", ARCH_AVR5, "__AVR_AT94K__", 0, 0x0060, "at94k" },
+ /* Enhanced, == 128K. */
+ { "avr51", ARCH_AVR51, NULL, 0, 0x0100, "m128" },
+ { "atmega128", ARCH_AVR51, "__AVR_ATmega128__", 0, 0x0100, "m128" },
+ { "atmega1280", ARCH_AVR51, "__AVR_ATmega1280__", 0, 0x0200, "m1280" },
+ { "atmega1281", ARCH_AVR51, "__AVR_ATmega1281__", 0, 0x0200, "m1281" },
+ { "atmega1284p", ARCH_AVR51, "__AVR_ATmega1284P__", 0, 0x0100, "m1284p" },
+ { "atmega128rfa1", ARCH_AVR51, "__AVR_ATmega128RFA1__", 0, 0x0200, "m128rfa1" },
+ { "at90can128", ARCH_AVR51, "__AVR_AT90CAN128__", 0, 0x0100, "can128" },
+ { "at90usb1286", ARCH_AVR51, "__AVR_AT90USB1286__", 0, 0x0100, "usb1286" },
+ { "at90usb1287", ARCH_AVR51, "__AVR_AT90USB1287__", 0, 0x0100, "usb1286" },
+ { "m3000f", ARCH_AVR51, "__AVR_M3000F__", 0, 0x1000, "m3000f" },
+ { "m3000s", ARCH_AVR51, "__AVR_M3000S__", 0, 0x1000, "m3000f" },
+ { "m3001b", ARCH_AVR51, "__AVR_M3001B__", 0, 0x1000, "m3000f" },
+ /* 3-Byte PC. */
+ { "avr6", ARCH_AVR6, NULL, 0, 0x0200, "m2561" },
+ { "atmega2560", ARCH_AVR6, "__AVR_ATmega2560__", 0, 0x0200, "m2561" },
+ { "atmega2561", ARCH_AVR6, "__AVR_ATmega2561__", 0, 0x0200, "m2561" },
+ /* Assembler only. */
+ { "avr1", ARCH_AVR1, NULL, 0, 0x0060, "s1200" },
+ { "at90s1200", ARCH_AVR1, "__AVR_AT90S1200__", 0, 0x0060, "s1200" },
+ { "attiny11", ARCH_AVR1, "__AVR_ATtiny11__", 0, 0x0060, "tn11" },
+ { "attiny12", ARCH_AVR1, "__AVR_ATtiny12__", 0, 0x0060, "tn12" },
+ { "attiny15", ARCH_AVR1, "__AVR_ATtiny15__", 0, 0x0060, "tn15" },
+ { "attiny28", ARCH_AVR1, "__AVR_ATtiny28__", 0, 0x0060, "tn28" },
+ /* End of list. */
+ { NULL, ARCH_UNKNOWN, NULL, 0, 0, NULL }
+};
+
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index d0df1be..cd51f88 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -112,204 +112,10 @@ const char *avr_extra_arch_macro;
/* Current architecture. */
const struct base_arch_s *avr_current_arch;
-section *progmem_section;
-
-static const struct base_arch_s avr_arch_types[] = {
- { 1, 0, 0, 0, 0, 0, 0, 0, NULL }, /* unknown device specified */
- { 1, 0, 0, 0, 0, 0, 0, 0, "__AVR_ARCH__=1" },
- { 0, 0, 0, 0, 0, 0, 0, 0, "__AVR_ARCH__=2" },
- { 0, 0, 0, 1, 0, 0, 0, 0, "__AVR_ARCH__=25" },
- { 0, 0, 1, 0, 0, 0, 0, 0, "__AVR_ARCH__=3" },
- { 0, 0, 1, 0, 1, 0, 0, 0, "__AVR_ARCH__=31" },
- { 0, 0, 1, 1, 0, 0, 0, 0, "__AVR_ARCH__=35" },
- { 0, 1, 0, 1, 0, 0, 0, 0, "__AVR_ARCH__=4" },
- { 0, 1, 1, 1, 0, 0, 0, 0, "__AVR_ARCH__=5" },
- { 0, 1, 1, 1, 1, 1, 0, 0, "__AVR_ARCH__=51" },
- { 0, 1, 1, 1, 1, 1, 1, 0, "__AVR_ARCH__=6" }
-};
+/* Current device. */
+const struct mcu_type_s *avr_current_device;
-/* These names are used as the index into the avr_arch_types[] table
- above. */
-
-enum avr_arch
-{
- ARCH_UNKNOWN,
- ARCH_AVR1,
- ARCH_AVR2,
- ARCH_AVR25,
- ARCH_AVR3,
- ARCH_AVR31,
- ARCH_AVR35,
- ARCH_AVR4,
- ARCH_AVR5,
- ARCH_AVR51,
- ARCH_AVR6
-};
-
-struct mcu_type_s {
- const char *const name;
- int arch; /* index in avr_arch_types[] */
- /* Must lie outside user's namespace. NULL == no macro. */
- const char *const macro;
-};
-
-/* List of all known AVR MCU types - if updated, it has to be kept
- in sync in several places (FIXME: is there a better way?):
- - here
- - avr.h (CPP_SPEC, LINK_SPEC, CRT_BINUTILS_SPECS)
- - t-avr (MULTILIB_MATCHES)
- - gas/config/tc-avr.c
- - avr-libc */
-
-static const struct mcu_type_s avr_mcu_types[] = {
- /* Classic, <= 8K. */
- { "avr2", ARCH_AVR2, NULL },
- { "at90s2313", ARCH_AVR2, "__AVR_AT90S2313__" },
- { "at90s2323", ARCH_AVR2, "__AVR_AT90S2323__" },
- { "at90s2333", ARCH_AVR2, "__AVR_AT90S2333__" },
- { "at90s2343", ARCH_AVR2, "__AVR_AT90S2343__" },
- { "attiny22", ARCH_AVR2, "__AVR_ATtiny22__" },
- { "attiny26", ARCH_AVR2, "__AVR_ATtiny26__" },
- { "at90s4414", ARCH_AVR2, "__AVR_AT90S4414__" },
- { "at90s4433", ARCH_AVR2, "__AVR_AT90S4433__" },
- { "at90s4434", ARCH_AVR2, "__AVR_AT90S4434__" },
- { "at90s8515", ARCH_AVR2, "__AVR_AT90S8515__" },
- { "at90c8534", ARCH_AVR2, "__AVR_AT90C8534__" },
- { "at90s8535", ARCH_AVR2, "__AVR_AT90S8535__" },
- /* Classic + MOVW, <= 8K. */
- { "avr25", ARCH_AVR25, NULL },
- { "ata6289", ARCH_AVR25, "__AVR_ATA6289__" },
- { "attiny13", ARCH_AVR25, "__AVR_ATtiny13__" },
- { "attiny13a", ARCH_AVR25, "__AVR_ATtiny13A__" },
- { "attiny2313", ARCH_AVR25, "__AVR_ATtiny2313__" },
- { "attiny24", ARCH_AVR25, "__AVR_ATtiny24__" },
- { "attiny44", ARCH_AVR25, "__AVR_ATtiny44__" },
- { "attiny84", ARCH_AVR25, "__AVR_ATtiny84__" },
- { "attiny25", ARCH_AVR25, "__AVR_ATtiny25__" },
- { "attiny45", ARCH_AVR25, "__AVR_ATtiny45__" },
- { "attiny85", ARCH_AVR25, "__AVR_ATtiny85__" },
- { "attiny261", ARCH_AVR25, "__AVR_ATtiny261__" },
- { "attiny461", ARCH_AVR25, "__AVR_ATtiny461__" },
- { "attiny861", ARCH_AVR25, "__AVR_ATtiny861__" },
- { "attiny43u", ARCH_AVR25, "__AVR_ATtiny43U__" },
- { "attiny87", ARCH_AVR25, "__AVR_ATtiny87__" },
- { "attiny48", ARCH_AVR25, "__AVR_ATtiny48__" },
- { "attiny88", ARCH_AVR25, "__AVR_ATtiny88__" },
- { "at86rf401", ARCH_AVR25, "__AVR_AT86RF401__" },
- /* Classic, > 8K, <= 64K. */
- { "avr3", ARCH_AVR3, NULL },
- { "at43usb355", ARCH_AVR3, "__AVR_AT43USB355__" },
- { "at76c711", ARCH_AVR3, "__AVR_AT76C711__" },
- /* Classic, == 128K. */
- { "avr31", ARCH_AVR31, NULL },
- { "atmega103", ARCH_AVR31, "__AVR_ATmega103__" },
- { "at43usb320", ARCH_AVR31, "__AVR_AT43USB320__" },
- /* Classic + MOVW + JMP/CALL. */
- { "avr35", ARCH_AVR35, NULL },
- { "at90usb82", ARCH_AVR35, "__AVR_AT90USB82__" },
- { "at90usb162", ARCH_AVR35, "__AVR_AT90USB162__" },
- { "attiny167", ARCH_AVR35, "__AVR_ATtiny167__" },
- { "attiny327", ARCH_AVR35, "__AVR_ATtiny327__" },
- /* Enhanced, <= 8K. */
- { "avr4", ARCH_AVR4, NULL },
- { "atmega8", ARCH_AVR4, "__AVR_ATmega8__" },
- { "atmega48", ARCH_AVR4, "__AVR_ATmega48__" },
- { "atmega48p", ARCH_AVR4, "__AVR_ATmega48P__" },
- { "atmega88", ARCH_AVR4, "__AVR_ATmega88__" },
- { "atmega88p", ARCH_AVR4, "__AVR_ATmega88P__" },
- { "atmega8515", ARCH_AVR4, "__AVR_ATmega8515__" },
- { "atmega8535", ARCH_AVR4, "__AVR_ATmega8535__" },
- { "atmega8hva", ARCH_AVR4, "__AVR_ATmega8HVA__" },
- { "atmega4hvd", ARCH_AVR4, "__AVR_ATmega4HVD__" },
- { "atmega8hvd", ARCH_AVR4, "__AVR_ATmega8HVD__" },
- { "atmega8c1", ARCH_AVR4, "__AVR_ATmega8C1__" },
- { "atmega8m1", ARCH_AVR4, "__AVR_ATmega8M1__" },
- { "at90pwm1", ARCH_AVR4, "__AVR_AT90PWM1__" },
- { "at90pwm2", ARCH_AVR4, "__AVR_AT90PWM2__" },
- { "at90pwm2b", ARCH_AVR4, "__AVR_AT90PWM2B__" },
- { "at90pwm3", ARCH_AVR4, "__AVR_AT90PWM3__" },
- { "at90pwm3b", ARCH_AVR4, "__AVR_AT90PWM3B__" },
- { "at90pwm81", ARCH_AVR4, "__AVR_AT90PWM81__" },
- /* Enhanced, > 8K, <= 64K. */
- { "avr5", ARCH_AVR5, NULL },
- { "atmega16", ARCH_AVR5, "__AVR_ATmega16__" },
- { "atmega161", ARCH_AVR5, "__AVR_ATmega161__" },
- { "atmega162", ARCH_AVR5, "__AVR_ATmega162__" },
- { "atmega163", ARCH_AVR5, "__AVR_ATmega163__" },
- { "atmega164p", ARCH_AVR5, "__AVR_ATmega164P__" },
- { "atmega165", ARCH_AVR5, "__AVR_ATmega165__" },
- { "atmega165p", ARCH_AVR5, "__AVR_ATmega165P__" },
- { "atmega168", ARCH_AVR5, "__AVR_ATmega168__" },
- { "atmega168p", ARCH_AVR5, "__AVR_ATmega168P__" },
- { "atmega169", ARCH_AVR5, "__AVR_ATmega169__" },
- { "atmega169p", ARCH_AVR5, "__AVR_ATmega169P__" },
- { "atmega32", ARCH_AVR5, "__AVR_ATmega32__" },
- { "atmega323", ARCH_AVR5, "__AVR_ATmega323__" },
- { "atmega324p", ARCH_AVR5, "__AVR_ATmega324P__" },
- { "atmega325", ARCH_AVR5, "__AVR_ATmega325__" },
- { "atmega325p", ARCH_AVR5, "__AVR_ATmega325P__" },
- { "atmega3250", ARCH_AVR5, "__AVR_ATmega3250__" },
- { "atmega3250p", ARCH_AVR5, "__AVR_ATmega3250P__" },
- { "atmega328p", ARCH_AVR5, "__AVR_ATmega328P__" },
- { "atmega329", ARCH_AVR5, "__AVR_ATmega329__" },
- { "atmega329p", ARCH_AVR5, "__AVR_ATmega329P__" },
- { "atmega3290", ARCH_AVR5, "__AVR_ATmega3290__" },
- { "atmega3290p", ARCH_AVR5, "__AVR_ATmega3290P__" },
- { "atmega406", ARCH_AVR5, "__AVR_ATmega406__" },
- { "atmega64", ARCH_AVR5, "__AVR_ATmega64__" },
- { "atmega640", ARCH_AVR5, "__AVR_ATmega640__" },
- { "atmega644", ARCH_AVR5, "__AVR_ATmega644__" },
- { "atmega644p", ARCH_AVR5, "__AVR_ATmega644P__" },
- { "atmega645", ARCH_AVR5, "__AVR_ATmega645__" },
- { "atmega6450", ARCH_AVR5, "__AVR_ATmega6450__" },
- { "atmega649", ARCH_AVR5, "__AVR_ATmega649__" },
- { "atmega6490", ARCH_AVR5, "__AVR_ATmega6490__" },
- { "atmega16hva", ARCH_AVR5, "__AVR_ATmega16HVA__" },
- { "atmega16hvb", ARCH_AVR5, "__AVR_ATmega16HVB__" },
- { "atmega32hvb", ARCH_AVR5, "__AVR_ATmega32HVB__" },
- { "at90can32", ARCH_AVR5, "__AVR_AT90CAN32__" },
- { "at90can64", ARCH_AVR5, "__AVR_AT90CAN64__" },
- { "at90pwm216", ARCH_AVR5, "__AVR_AT90PWM216__" },
- { "at90pwm316", ARCH_AVR5, "__AVR_AT90PWM316__" },
- { "atmega16c1", ARCH_AVR5, "__AVR_ATmega16C1__" },
- { "atmega32c1", ARCH_AVR5, "__AVR_ATmega32C1__" },
- { "atmega64c1", ARCH_AVR5, "__AVR_ATmega64C1__" },
- { "atmega16m1", ARCH_AVR5, "__AVR_ATmega16M1__" },
- { "atmega32m1", ARCH_AVR5, "__AVR_ATmega32M1__" },
- { "atmega64m1", ARCH_AVR5, "__AVR_ATmega64M1__" },
- { "atmega16u4", ARCH_AVR5, "__AVR_ATmega16U4__" },
- { "atmega32u4", ARCH_AVR5, "__AVR_ATmega32U4__" },
- { "atmega32u6", ARCH_AVR5, "__AVR_ATmega32U6__" },
- { "at90scr100", ARCH_AVR5, "__AVR_AT90SCR100__" },
- { "at90usb646", ARCH_AVR5, "__AVR_AT90USB646__" },
- { "at90usb647", ARCH_AVR5, "__AVR_AT90USB647__" },
- { "at94k", ARCH_AVR5, "__AVR_AT94K__" },
- /* Enhanced, == 128K. */
- { "avr51", ARCH_AVR51, NULL },
- { "atmega128", ARCH_AVR51, "__AVR_ATmega128__" },
- { "atmega1280", ARCH_AVR51, "__AVR_ATmega1280__" },
- { "atmega1281", ARCH_AVR51, "__AVR_ATmega1281__" },
- { "atmega1284p", ARCH_AVR51, "__AVR_ATmega1284P__" },
- { "atmega128rfa1", ARCH_AVR51, "__AVR_ATmega128RFA1__" },
- { "at90can128", ARCH_AVR51, "__AVR_AT90CAN128__" },
- { "at90usb1286", ARCH_AVR51, "__AVR_AT90USB1286__" },
- { "at90usb1287", ARCH_AVR51, "__AVR_AT90USB1287__" },
- { "m3000f", ARCH_AVR51, "__AVR_M3000F__" },
- { "m3000s", ARCH_AVR51, "__AVR_M3000S__" },
- { "m3001b", ARCH_AVR51, "__AVR_M3001B__" },
- /* 3-Byte PC. */
- { "avr6", ARCH_AVR6, NULL },
- { "atmega2560", ARCH_AVR6, "__AVR_ATmega2560__" },
- { "atmega2561", ARCH_AVR6, "__AVR_ATmega2561__" },
- /* Assembler only. */
- { "avr1", ARCH_AVR1, NULL },
- { "at90s1200", ARCH_AVR1, "__AVR_AT90S1200__" },
- { "attiny11", ARCH_AVR1, "__AVR_ATtiny11__" },
- { "attiny12", ARCH_AVR1, "__AVR_ATtiny12__" },
- { "attiny15", ARCH_AVR1, "__AVR_ATtiny15__" },
- { "attiny28", ARCH_AVR1, "__AVR_ATtiny28__" },
- { NULL, ARCH_UNKNOWN, NULL }
-};
+section *progmem_section;
/* Initialize the GCC target structure. */
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 6e85bba..31a7cac 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -44,13 +44,63 @@ struct base_arch_s {
/* Core have 'EICALL' and 'EIJMP' instructions. */
int have_eijmp_eicall;
- /* Reserved. */
+ /* Reserved for xmega architecture. */
int reserved;
+
+ /* Reserved for xmega architecture. */
+ int reserved2;
+
+ /* Default start of data section address for architecture. */
+ int default_data_section_start;
+
+ const char *const macro;
+
+ /* Architecture name. */
+ const char *const arch_name;
+};
+
+/* These names are used as the index into the avr_arch_types[] table
+ above. */
+
+enum avr_arch
+{
+ ARCH_UNKNOWN,
+ ARCH_AVR1,
+ ARCH_AVR2,
+ ARCH_AVR25,
+ ARCH_AVR3,
+ ARCH_AVR31,
+ ARCH_AVR35,
+ ARCH_AVR4,
+ ARCH_AVR5,
+ ARCH_AVR51,
+ ARCH_AVR6
+};
+
+struct mcu_type_s {
+ /* Device name. */
+ const char *const name;
+
+ /* Index in avr_arch_types[]. */
+ int arch;
+ /* Must lie outside user's namespace. NULL == no macro. */
const char *const macro;
+
+ /* Stack pointer have 8 bits width. */
+ int short_sp;
+
+ /* Start of data section. */
+ int data_section_start;
+
+ /* Name of device library. */
+ const char *const library_name;
};
extern const struct base_arch_s *avr_current_arch;
+extern const struct mcu_type_s *avr_current_device;
+extern const struct mcu_type_s avr_mcu_types[];
+extern const struct base_arch_s avr_arch_types[];
#define TARGET_CPU_CPP_BUILTINS() \
do \
@@ -756,6 +806,17 @@ fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
#define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
adjust_insn_length (INSN, LENGTH))
+extern const char *avr_device_to_arch (int argc, const char **argv);
+extern const char *avr_device_to_data_start (int argc, const char **argv);
+extern const char *avr_device_to_startfiles (int argc, const char **argv);
+extern const char *avr_device_to_devicelib (int argc, const char **argv);
+
+#define EXTRA_SPEC_FUNCTIONS \
+ { "device_to_arch", avr_device_to_arch }, \
+ { "device_to_data_start", avr_device_to_data_start }, \
+ { "device_to_startfile", avr_device_to_startfiles }, \
+ { "device_to_devicelib", avr_device_to_devicelib },
+
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
#define CC1_SPEC "%{profile:-p}"
@@ -778,106 +839,8 @@ mmcu=*:-mmcu=%*}"
%{mmcu=atmega64*|\
mmcu=at90can64*|\
mmcu=at90usb64*:--pmem-wrap-around=64k}}}\
-%{!mmcu*: -m avr2}\
-%{mmcu=at90s1200|\
- mmcu=attiny11|\
- mmcu=attiny12|\
- mmcu=attiny15|\
- mmcu=attiny28: -m avr1}\
-%{mmcu=attiny22|\
- mmcu=attiny26|\
- mmcu=at90s2*|\
- mmcu=at90s4*|\
- mmcu=at90s8*|\
- mmcu=at90c8*|\
- mmcu=at86rf401|\
- mmcu=ata6289|\
- mmcu=attiny13*|\
- mmcu=attiny2313|\
- mmcu=attiny24|\
- mmcu=attiny25|\
- mmcu=attiny261|\
- mmcu=attiny4*|\
- mmcu=attiny8*: -m avr2}\
-%{mmcu=atmega103|\
- mmcu=at43*|\
- mmcu=at76*|\
- mmcu=at90usb82|\
- mmcu=at90usb162|\
- mmcu=attiny16*|\
- mmcu=attiny32*: -m avr3}\
-%{mmcu=atmega8*|\
- mmcu=atmega4*|\
- mmcu=at90pwm1|\
- mmcu=at90pwm2|\
- mmcu=at90pwm2b|\
- mmcu=at90pwm3|\
- mmcu=at90pwm3b|\
- mmcu=at90pwm81: -m avr4}\
-%{mmcu=atmega16*|\
- mmcu=atmega32*|\
- mmcu=atmega406|\
- mmcu=atmega64*|\
- mmcu=atmega128*|\
- mmcu=at90can*|\
- mmcu=at90pwm216|\
- mmcu=at90pwm316|\
- mmcu=at90scr100|\
- mmcu=at90usb64*|\
- mmcu=at90usb128*|\
- mmcu=at94k|\
- mmcu=m3000*|\
- mmcu=m3001*: -m avr5}\
-%{mmcu=atmega256*:-m avr6}\
-%{mmcu=atmega324*|\
- mmcu=atmega325*|\
- mmcu=atmega328p|\
- mmcu=atmega329*|\
- mmcu=atmega406|\
- mmcu=atmega48*|\
- mmcu=atmega88*|\
- mmcu=atmega64|\
- mmcu=atmega644*|\
- mmcu=atmega645*|\
- mmcu=atmega649*|\
- mmcu=atmega128|\
- mmcu=atmega1284p|\
- mmcu=atmega162|\
- mmcu=atmega164*|\
- mmcu=atmega165*|\
- mmcu=atmega168*|\
- mmcu=atmega169*|\
- mmcu=atmega4hv*|\
- mmcu=atmega8hv*|\
- mmcu=atmega16hv*|\
- mmcu=atmega32hv*|\
- mmcu=attiny48|\
- mmcu=attiny88|\
- mmcu=attiny87|\
- mmcu=attiny167|\
- mmcu=attiny327|\
- mmcu=at90can*|\
- mmcu=at90pwm*|\
- mmcu=atmega8c1|\
- mmcu=atmega16c1|\
- mmcu=atmega32c1|\
- mmcu=atmega64c1|\
- mmcu=atmega8m1|\
- mmcu=atmega16m1|\
- mmcu=atmega32m1|\
- mmcu=atmega64m1|\
- mmcu=atmega16u4|\
- mmcu=atmega32u*|\
- mmcu=at90scr100|\
- mmcu=ata6289|\
- mmcu=at90usb*: -Tdata 0x800100}\
-%{mmcu=atmega640|\
- mmcu=atmega1280|\
- mmcu=atmega1281|\
- mmcu=atmega256*|\
- mmcu=atmega128rfa1: -Tdata 0x800200}\
-%{mmcu=m3000*|\
- mmcu=m3001*: -Tdata 0x801000}"
+%:device_to_arch(%{mmcu=*:%*})\
+%:device_to_data_start(%{mmcu=*:%*})"
#define LIB_SPEC \
"%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
@@ -888,140 +851,10 @@ mmcu=*:-mmcu=%*}"
#define LIBGCC_SPEC \
"%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc }}}}}"
-#define STARTFILE_SPEC "%(crt_binutils)"
+#define STARTFILE_SPEC "%:device_to_startfile(%{mmcu=*:%*})"
#define ENDFILE_SPEC ""
-#define CRT_BINUTILS_SPECS "\
-%{mmcu=at90s1200|mmcu=avr1:crts1200.o%s} \
-%{mmcu=attiny11:crttn11.o%s} \
-%{mmcu=attiny12:crttn12.o%s} \
-%{mmcu=attiny15:crttn15.o%s} \
-%{mmcu=attiny28:crttn28.o%s} \
-%{!mmcu*|mmcu=at90s8515|mmcu=avr2:crts8515.o%s} \
-%{mmcu=at90s2313:crts2313.o%s} \
-%{mmcu=at90s2323:crts2323.o%s} \
-%{mmcu=at90s2333:crts2333.o%s} \
-%{mmcu=at90s2343:crts2343.o%s} \
-%{mmcu=attiny22:crttn22.o%s} \
-%{mmcu=attiny26:crttn26.o%s} \
-%{mmcu=at90s4433:crts4433.o%s} \
-%{mmcu=at90s4414:crts4414.o%s} \
-%{mmcu=at90s4434:crts4434.o%s} \
-%{mmcu=at90c8534:crtc8534.o%s} \
-%{mmcu=at90s8535:crts8535.o%s} \
-%{mmcu=at86rf401:crt86401.o%s} \
-%{mmcu=attiny13:crttn13.o%s} \
-%{mmcu=attiny13a:crttn13a.o%s} \
-%{mmcu=attiny2313|mmcu=avr25:crttn2313.o%s} \
-%{mmcu=attiny24:crttn24.o%s} \
-%{mmcu=attiny44:crttn44.o%s} \
-%{mmcu=attiny84:crttn84.o%s} \
-%{mmcu=attiny25:crttn25.o%s} \
-%{mmcu=attiny45:crttn45.o%s} \
-%{mmcu=attiny85:crttn85.o%s} \
-%{mmcu=attiny261:crttn261.o%s} \
-%{mmcu=attiny461:crttn461.o%s} \
-%{mmcu=attiny861:crttn861.o%s} \
-%{mmcu=attiny43u:crttn43u.o%s} \
-%{mmcu=attiny87:crttn87.o%s} \
-%{mmcu=attiny48:crttn48.o%s} \
-%{mmcu=attiny88:crttn88.o%s} \
-%{mmcu=ata6289:crta6289.o%s} \
-%{mmcu=at43usb355|mmcu=avr3:crt43355.o%s} \
-%{mmcu=at76c711:crt76711.o%s} \
-%{mmcu=atmega103|mmcu=avr31:crtm103.o%s} \
-%{mmcu=at43usb320:crt43320.o%s} \
-%{mmcu=at90usb162|mmcu=avr35:crtusb162.o%s} \
-%{mmcu=at90usb82:crtusb82.o%s} \
-%{mmcu=attiny167:crttn167.o%s} \
-%{mmcu=attiny327:crttn327.o%s} \
-%{mmcu=atmega8|mmcu=avr4:crtm8.o%s} \
-%{mmcu=atmega48:crtm48.o%s} \
-%{mmcu=atmega48p:crtm48p.o%s} \
-%{mmcu=atmega88:crtm88.o%s} \
-%{mmcu=atmega88p:crtm88p.o%s} \
-%{mmcu=atmega8515:crtm8515.o%s} \
-%{mmcu=atmega8535:crtm8535.o%s} \
-%{mmcu=atmega8c1:crtm8c1.o%s} \
-%{mmcu=atmega8m1:crtm8m1.o%s} \
-%{mmcu=at90pwm1:crt90pwm1.o%s} \
-%{mmcu=at90pwm2:crt90pwm2.o%s} \
-%{mmcu=at90pwm2b:crt90pwm2b.o%s} \
-%{mmcu=at90pwm3:crt90pwm3.o%s} \
-%{mmcu=at90pwm3b:crt90pwm3b.o%s} \
-%{mmcu=at90pwm81:crt90pwm81.o%s} \
-%{mmcu=atmega16:crtm16.o%s} \
-%{mmcu=atmega161|mmcu=avr5:crtm161.o%s} \
-%{mmcu=atmega162:crtm162.o%s} \
-%{mmcu=atmega163:crtm163.o%s} \
-%{mmcu=atmega164p:crtm164p.o%s} \
-%{mmcu=atmega165:crtm165.o%s} \
-%{mmcu=atmega165p:crtm165p.o%s} \
-%{mmcu=atmega168:crtm168.o%s} \
-%{mmcu=atmega168p:crtm168p.o%s} \
-%{mmcu=atmega169:crtm169.o%s} \
-%{mmcu=atmega169p:crtm169p.o%s} \
-%{mmcu=atmega32:crtm32.o%s} \
-%{mmcu=atmega323:crtm323.o%s} \
-%{mmcu=atmega324p:crtm324p.o%s} \
-%{mmcu=atmega325:crtm325.o%s} \
-%{mmcu=atmega325p:crtm325p.o%s} \
-%{mmcu=atmega3250:crtm3250.o%s} \
-%{mmcu=atmega3250p:crtm3250p.o%s} \
-%{mmcu=atmega328p:crtm328p.o%s} \
-%{mmcu=atmega329:crtm329.o%s} \
-%{mmcu=atmega329p:crtm329p.o%s} \
-%{mmcu=atmega3290:crtm3290.o%s} \
-%{mmcu=atmega3290p:crtm3290p.o%s} \
-%{mmcu=atmega406:crtm406.o%s} \
-%{mmcu=atmega64:crtm64.o%s} \
-%{mmcu=atmega640:crtm640.o%s} \
-%{mmcu=atmega644:crtm644.o%s} \
-%{mmcu=atmega644p:crtm644p.o%s} \
-%{mmcu=atmega645:crtm645.o%s} \
-%{mmcu=atmega6450:crtm6450.o%s} \
-%{mmcu=atmega649:crtm649.o%s} \
-%{mmcu=atmega6490:crtm6490.o%s} \
-%{mmcu=atmega8hva:crtm8hva.o%s} \
-%{mmcu=atmega16hva:crtm16hva.o%s} \
-%{mmcu=atmega16hvb:crtm16hvb.o%s} \
-%{mmcu=atmega32hvb:crtm32hvb.o%s} \
-%{mmcu=atmega4hvd:crtm4hvd.o%s} \
-%{mmcu=atmega8hvd:crtm8hvd.o%s} \
-%{mmcu=at90can32:crtcan32.o%s} \
-%{mmcu=at90can64:crtcan64.o%s} \
-%{mmcu=at90pwm216:crt90pwm216.o%s} \
-%{mmcu=at90pwm316:crt90pwm316.o%s} \
-%{mmcu=atmega16c1:crtm16c1.o%s} \
-%{mmcu=atmega32c1:crtm32c1.o%s} \
-%{mmcu=atmega64c1:crtm64c1.o%s} \
-%{mmcu=atmega16m1:crtm16m1.o%s} \
-%{mmcu=atmega32m1:crtm32m1.o%s} \
-%{mmcu=atmega64m1:crtm64m1.o%s} \
-%{mmcu=atmega16u4:crtm16u4.o%s} \
-%{mmcu=atmega32u4:crtm32u4.o%s} \
-%{mmcu=atmega32u6:crtm32u6.o%s} \
-%{mmcu=at90scr100:crt90scr100.o%s} \
-%{mmcu=at90usb646:crtusb646.o%s} \
-%{mmcu=at90usb647:crtusb647.o%s} \
-%{mmcu=at94k:crtat94k.o%s} \
-%{mmcu=atmega128|mmcu=avr51:crtm128.o%s} \
-%{mmcu=atmega1280:crtm1280.o%s} \
-%{mmcu=atmega1281:crtm1281.o%s} \
-%{mmcu=atmega1284p:crtm1284p.o%s} \
-%{mmcu=at90can128:crtcan128.o%s} \
-%{mmcu=atmega128rfa1:crtm128rfa1.o%s} \
-%{mmcu=at90usb1286:crtusb1286.o%s} \
-%{mmcu=at90usb1287:crtusb1287.o%s} \
-%{mmcu=m3000f:crtm3000f.o%s} \
-%{mmcu=m3000s:crtm3000s.o%s} \
-%{mmcu=m3001b:crtm3001b.o%s} \
-%{mmcu=atmega2560|mmcu=avr6:crtm2560.o%s} \
-%{mmcu=atmega2561:crtm2561.o%s}"
-
-#define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
-
/* This is the default without any -mmcu=* option (AT90S*). */
#define MULTILIB_DEFAULTS { "mmcu=avr2" }
diff --git a/gcc/config/avr/driver-avr.c b/gcc/config/avr/driver-avr.c
new file mode 100755
index 0000000..218c406
--- /dev/null
+++ b/gcc/config/avr/driver-avr.c
@@ -0,0 +1,115 @@
+/* Subroutines for the gcc driver.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Anatoly Sokolov <aesok@post.ru>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include <stdlib.h>
+
+/* Current architecture. */
+const struct base_arch_s *avr_current_arch = NULL;
+
+/* Current device. */
+const struct mcu_type_s *avr_current_device = NULL;
+
+/* Initialize avr_current_arch and avr_current_device variables. */
+
+static void
+avr_set_current_device (const char *name)
+{
+
+ if (NULL != avr_current_arch)
+ return;
+
+ for (avr_current_device = avr_mcu_types; avr_current_device->name;
+ avr_current_device++)
+ {
+ if (strcmp (avr_current_device->name, name) == 0)
+ break;
+ }
+
+ avr_current_arch = &avr_arch_types[avr_current_device->arch];
+}
+
+/* Returns command line parameters that describe the device architecture. */
+
+const char *
+avr_device_to_arch (int argc, const char **argv)
+{
+ if (0 == argc)
+ return;
+
+ avr_set_current_device (argv[0]);
+
+ return concat ("-m ", avr_current_arch->arch_name, NULL);
+}
+
+/* Returns command line parameters that describe start of date section. */
+
+const char *
+avr_device_to_data_start (int argc, const char **argv)
+{
+ unsigned long data_section_start;
+ char data_section_start_str[16];
+
+ if (0 == argc)
+ return;
+
+ avr_set_current_device (argv[0]);
+
+ if (avr_current_device->data_section_start
+ == avr_current_arch->default_data_section_start)
+ return NULL;
+
+ data_section_start = 0x800000 + avr_current_device->data_section_start;
+
+ snprintf (data_section_start_str, sizeof(data_section_start_str) - 1,
+ "0x%lX", data_section_start);
+
+ return concat ("-Tdata ", data_section_start_str, NULL);
+}
+
+/* Returns command line parameters that describe the device startfile. */
+
+const char *
+avr_device_to_startfiles (int argc, const char **argv)
+{
+ if (0 == argc)
+ return;
+
+ avr_set_current_device (argv[0]);
+
+ return concat ("crt", avr_current_device->library_name, ".o%s", NULL);
+}
+
+/* Returns command line parameters that describe the device library. */
+
+const char *
+avr_device_to_devicelib (int argc, const char **argv)
+{
+ if (0 == argc)
+ return;
+
+ avr_set_current_device (argv[0]);
+
+ return concat ("-l", avr_current_device->library_name, NULL);
+}
+
diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr
index c78b00d..c27118e 100644
--- a/gcc/config/avr/t-avr
+++ b/gcc/config/avr/t-avr
@@ -17,6 +17,14 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+avr-devices.o: $(srcdir)/config/avr/avr-devices.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
LIB1ASMSRC = avr/libgcc.S
LIB1ASMFUNCS = \
_mulqi3 \