1
0
Fork 0

arduino-0018-windows

This commit is contained in:
orange 2010-03-30 21:53:44 +02:00
parent 157fd6f1a1
commit f39fc49523
5182 changed files with 950586 additions and 0 deletions

View file

@ -0,0 +1,38 @@
WinAVR
------
Sources for specific versions of these packages can be found at these locations.
GNU Binutils
<http://sources.redhat.com/binutils/>
GCC
<http://gcc.gnu.org/>
avr-libc
<http://savannah.nongnu.org/projects/avr-libc>
avrdude
<http://savannah.nongnu.org/projects/avrdude/>
GDB
<http://sources.redhat.com/gdb/>
Insight
<http://sources.redhat.com/insight/>
AVaRICE
<http://sourceforge.net/projects/avarice>
SimulAVR
<http://savannah.nongnu.org/projects/simulavr/>
Tofrodos
<http://www.thefreecountry.com/>
Cygwin DLLs
<http://www.cygwin.com/>
Any patches against these sources can be found in the \source directory
of your installation. These are organized into different subdirectories, one
for each project. All patches have a .patch file extension.

View file

@ -0,0 +1,25 @@
--- AvrCommon.am.old 2007-05-24 08:25:29.437500000 -0600
+++ AvrCommon.am 2007-05-24 08:28:59.984375000 -0600
@@ -34,9 +34,9 @@
AM_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/include
-AVRLIB_CFLAGS = -gstabs -Wall -W -Wstrict-prototypes -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_CFLAGS)
+AVRLIB_CFLAGS = -gdwarf-2 -Wall -W -Wstrict-prototypes -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_CFLAGS)
-AVRLIB_ASFLAGS = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_ASFLAGS)
+AVRLIB_ASFLAGS = -x assembler-with-cpp -Wa,-gdwarf-2 -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_ASFLAGS)
AM_CFLAGS = $(AVRLIB_CFLAGS)
AM_CCASFLAGS = $(AM_CPPFLAGS) $(AVRLIB_ASFLAGS)
--- AvrCommonLibC.am.old 2007-06-03 13:53:46.021828600 -0600
+++ AvrCommonLibC.am 2007-06-03 13:54:04.807390200 -0600
@@ -37,7 +37,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/common -I$
AVRLIB_CFLAGS = -g -Wall -W -Wstrict-prototypes -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_CFLAGS)
-AVRLIB_ASFLAGS = -x assembler-with-cpp -Wa,-gstabs -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_ASFLAGS)
+AVRLIB_ASFLAGS = -x assembler-with-cpp -Wa,-gdwarf-2 -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_ASFLAGS)
AM_CFLAGS = $(AVRLIB_CFLAGS)
AM_CCASFLAGS = $(AM_CPPFLAGS) $(AVRLIB_ASFLAGS)

View file

@ -0,0 +1,120 @@
--- /dev/null 2006-11-30 17:00:00.000000000 -0700
+++ include/avr/builtins.h 2008-12-04 09:44:13.575895200 -0700
@@ -0,0 +1,101 @@
+/* Copyright (c) 2008 Anatoly Sokolv
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ * Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE. */
+
+/* $Id:$ */
+
+/*
+ avr/builtins.h -
+ */
+
+#ifndef _AVR_BUILTINS_H_
+#define _AVR_BUILTINS_H_
+
+/** \file */
+/** \defgroup avr_builtins <avr/builtins.h>: GCC builtins
+ \code #include <avr/builtins.h> \endcode
+
+ This header file declares avr builtins. */
+
+/**
+ \ingroup avr_builtins
+
+ Enables interrupts by setting the global interrupt mask. */
+extern void __builtin_avr_sei(void);
+
+/**
+ \ingroup avr_builtins
+
+ Disables all interrupts by clearing the global interrupt mask. */
+extern void __builtin_avr_cli(void);
+
+/**
+ \ingroup avr_builtins
+
+ TODO. */
+
+extern void __builtin_avr_sleep(void);
+
+/**
+ \ingroup avr_builtins
+
+ TODO. */
+extern void __builtin_avr_wdr(void);
+
+/**
+ \ingroup avr_builtins
+
+ TODO. */
+extern unsigned char __builtin_avr_swap(unsigned char __b);
+
+/**
+ \ingroup avr_builtins
+
+ TODO. */
+extern unsigned int __builtin_avr_fmul(unsigned char __a, unsigned char __b);
+
+/**
+ \ingroup avr_builtins
+
+ TODO. */
+extern int __builtin_avr_fmuls(char __a, char __b);
+
+/**
+ \ingroup avr_builtins
+
+ TODO. */
+extern int __builtin_avr_fmulsu(char __a, unsigned char __b);
+
+/**
+ \ingroup avr_builtins
+
+ TODO. */
+extern void __builtin_avr_delay_cycles(unsigned long __n);
+
+#endif /* _AVR_BUILTINS_H_ */
\ No newline at end of file
Index: include/avr/Makefile.am
===================================================================
RCS file: /sources/avr-libc/avr-libc/include/avr/Makefile.am,v
retrieving revision 1.34.2.8
diff -u -p -r1.34.2.8 Makefile.am
--- include/avr/Makefile.am 3 Nov 2008 04:13:14 -0000 1.34.2.8
+++ include/avr/Makefile.am 4 Dec 2008 16:50:28 -0000
@@ -32,6 +32,7 @@
avrdir = $(prefix)/avr/include/avr
avr_HEADERS = \
boot.h \
+ builtins.h \
common.h \
crc16.h \
delay.h \

View file

@ -0,0 +1,62 @@
Index: configure.ac
===================================================================
RCS file: /sources/avr-libc/avr-libc/configure.ac,v
retrieving revision 1.55.2.23
diff -u -p -r1.55.2.23 configure.ac
--- configure.ac 6 Nov 2008 22:13:27 -0000 1.55.2.23
+++ configure.ac 24 Nov 2008 17:09:18 -0000
@@ -711,7 +711,6 @@ AC_CONFIG_FILES([
avr/lib/avr2/attiny11/Makefile
avr/lib/avr2/attiny12/Makefile
avr/lib/avr2/attiny13/Makefile
- avr/lib/avr2/attiny13a/Makefile
avr/lib/avr2/attiny15/Makefile
avr/lib/avr2/attiny22/Makefile
avr/lib/avr2/attiny24/Makefile
@@ -734,6 +733,7 @@ AC_CONFIG_FILES([
avr/lib/avr25/Makefile
avr/lib/avr25/at86rf401/Makefile
avr/lib/avr25/attiny13/Makefile
+ avr/lib/avr25/attiny13a/Makefile
avr/lib/avr25/attiny2313/Makefile
avr/lib/avr25/attiny24/Makefile
avr/lib/avr25/attiny25/Makefile
Index: devtools/gen-avr-lib-tree.sh
===================================================================
RCS file: /sources/avr-libc/avr-libc/devtools/gen-avr-lib-tree.sh,v
retrieving revision 1.37.2.15
diff -u -p -r1.37.2.15 gen-avr-lib-tree.sh
--- devtools/gen-avr-lib-tree.sh 3 Nov 2008 21:11:29 -0000 1.37.2.15
+++ devtools/gen-avr-lib-tree.sh 24 Nov 2008 17:09:19 -0000
@@ -129,7 +129,6 @@ at90s1200:crts1200.o:${DEV_DEFS}:${CFLAG
attiny11:crttn11.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny12:crttn12.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny13:crttn13.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
-attiny13a:crttn13a.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny15:crttn15.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny2313:crttn2313.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny28:crttn28.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
@@ -160,6 +159,7 @@ attiny861:crttn861.o:${DEV_DEFS}:${CFLAG
AVR25_DEV_INFO="\
at86rf401:crt86401.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny13:crttn13.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
+attiny13a:crttn13a.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny2313:crttn2313.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny24:crttn24.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
attiny25:crttn25.o:${DEV_DEFS}:${CFLAGS_SPACE}:${DEV_ASFLAGS};\
Index: include/avr/iotn13a.h
===================================================================
RCS file: /sources/avr-libc/avr-libc/include/avr/iotn13a.h,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 iotn13a.h
--- include/avr/iotn13a.h 6 Aug 2008 22:45:08 -0000 1.1.2.5
+++ include/avr/iotn13a.h 24 Nov 2008 17:09:20 -0000
@@ -165,6 +165,8 @@
#define EEDR6 6
#define EEDR7 7
+#define EEARL _SFR_IO8(0x1E)
+
#define EEAR _SFR_IO8(0x1E)
#define EEAR0 0
#define EEAR1 1

View file

@ -0,0 +1,438 @@
AVR specific only
--------------------------------------------------------------------------------
--- binutils/size.c 2007-08-06 13:56:14.000000000 -0600
+++ binutils/size.c 2007-09-13 09:13:10.281250000 -0600
@@ -35,10 +35,31 @@
#include "getopt.h"
#include "bucomm.h"
-#ifndef BSD_DEFAULT
-#define BSD_DEFAULT 1
+typedef enum
+{
+ format_sysv = 0,
+ format_bsd = 1,
+ format_avr = 2,
+} format_type_t;
+
+
+/* Set the default format. */
+#define FORMAT_DEFAULT_SYSV 0
+#define FORMAT_DEFAULT_BSD 1
+#define FORMAT_DEFAULT_AVR 0
+
+#if FORMAT_DEFAULT_SYSV
+ #define FORMAT_DEFAULT format_sysv
+ #define FORMAT_NAME "sysv"
+#elif FORMAT_DEFAULT_BSD
+ #define FORMAT_DEFAULT format_bsd
+ #define FORMAT_NAME "berkeley"
+#elif FORMAT_DEFAULT_AVR
+ #define FORMAT_DEFAULT format_avr
+ #define FORMAT_NAME "avr"
#endif
+
/* Program options. */
static enum
@@ -47,9 +68,8 @@ static enum
}
radix = decimal;
-/* 0 means use AT&T-style output. */
-static int berkeley_format = BSD_DEFAULT;
+format_type_t format = FORMAT_DEFAULT;
static int show_version = 0;
static int show_help = 0;
static int show_totals = 0;
@@ -63,6 +83,163 @@ static bfd_size_type total_textsize;
/* Program exit status. */
static int return_code = 0;
+
+/* AVR Size specific stuff */
+
+#define AVR64 64UL
+#define AVR128 128UL
+#define AVR256 256UL
+#define AVR512 512UL
+#define AVR1K 1024UL
+#define AVR2K 2048UL
+#define AVR4K 4096UL
+#define AVR8K 8192UL
+#define AVR16K 16384UL
+#define AVR24K 24576UL
+#define AVR32K 32768UL
+#define AVR40K 40960UL
+#define AVR64K 65536UL
+#define AVR128K 131072UL
+#define AVR256K 262144UL
+
+typedef struct
+{
+ char *name;
+ long flash;
+ long ram;
+ long eeprom;
+} avr_device_t;
+
+avr_device_t avr[] =
+{
+ {"atmega2560", AVR256K, AVR8K, AVR4K},
+ {"atmega2561", AVR256K, AVR8K, AVR4K},
+ {"atxmega256a3", AVR256K, AVR8K, AVR4K},
+ {"atxmega256a3b", AVR256K, AVR8K, AVR4K},
+ {"atxmega256a3v", AVR256K, AVR8K, AVR4K},
+
+ {"at43usb320", AVR128K, 608UL, 0},
+ {"at90can128", AVR128K, AVR4K, AVR4K},
+ {"at90usb1286", AVR128K, AVR8K, AVR4K},
+ {"at90usb1287", AVR128K, AVR8K, AVR4K},
+ {"atmega128", AVR128K, AVR4K, AVR4K},
+ {"atmega1280", AVR128K, AVR8K, AVR4K},
+ {"atmega1281", AVR128K, AVR8K, AVR4K},
+ {"atmega1284P", AVR128K, AVR16K, AVR4K},
+ {"atmega103", AVR128K, 4000UL, AVR4K},
+ {"atxmega128a1", AVR128K, AVR8K, AVR2K},
+ {"atxmega128a3", AVR128K, AVR16K, AVR2K},
+
+ {"at90can64", AVR64K, AVR4K, AVR2K},
+ {"at90usb646", AVR64K, AVR4K, AVR2K},
+ {"at90usb647", AVR64K, AVR4K, AVR2K},
+ {"atmega64", AVR64K, AVR4K, AVR2K},
+ {"atmega640", AVR64K, AVR8K, AVR4K},
+ {"atmega644", AVR64K, AVR4K, AVR2K},
+ {"atmega644p", AVR64K, AVR4K, AVR2K},
+ {"atmega645", AVR64K, AVR4K, AVR2K},
+ {"atmega6450", AVR64K, AVR4K, AVR2K},
+ {"atmega649", AVR64K, AVR4K, AVR2K},
+ {"atmega6490", AVR64K, AVR4K, AVR2K},
+ {"atxmega64a1", AVR64K, AVR4K, AVR2K},
+ {"atxmega64a3", AVR64K, AVR4K, AVR2K},
+
+ {"atmega406", AVR40K, AVR2K, AVR512},
+
+ {"at90can32", AVR32K, AVR2K, AVR1K},
+ {"at94k", AVR32K, AVR4K, 0},
+ {"atmega32", AVR32K, AVR2K, AVR1K},
+ {"atmega323", AVR32K, AVR2K, AVR1K},
+ {"atmega324p", AVR32K, AVR2K, AVR1K},
+ {"atmega325", AVR32K, AVR2K, AVR1K},
+ {"atmega325p", AVR32K, AVR2K, AVR1K},
+ {"atmega3250", AVR32K, AVR2K, AVR1K},
+ {"atmega3250p", AVR32K, AVR2K, AVR1K},
+ {"atmega328p", AVR32K, AVR2K, AVR1K},
+ {"atmega329", AVR32K, AVR2K, AVR1K},
+ {"atmega329p", AVR32K, AVR2K, AVR1K},
+ {"atmega3290", AVR32K, AVR2K, AVR1K},
+ {"atmega3290p", AVR32K, AVR2K, AVR1K},
+ {"atmega32hvb", AVR32K, AVR2K, AVR1K},
+ {"atmega32c1", AVR32K, AVR2K, AVR1K},
+ {"atmega32m1", AVR32K, AVR2K, AVR1K},
+ {"atmega32u4", AVR32K, 2560UL, AVR1K},
+ {"atmega32u6", AVR32K, 2560UL, AVR1K},
+
+ {"at43usb355", AVR24K, 1120, 0},
+
+ {"at76c711", AVR16K, AVR2K, 0},
+ {"at90pwm216", AVR16K, AVR1K, AVR512},
+ {"at90pwm316", AVR16K, AVR1K, AVR512},
+ {"at90usb162", AVR16K, AVR512, AVR512},
+ {"atmega16", AVR16K, AVR1K, AVR512},
+ {"atmega161", AVR16K, AVR1K, AVR512},
+ {"atmega162", AVR16K, AVR1K, AVR512},
+ {"atmega163", AVR16K, AVR1K, AVR512},
+ {"atmega164", AVR16K, AVR1K, AVR512},
+ {"atmega164p", AVR16K, AVR1K, AVR512},
+ {"atmega165", AVR16K, AVR1K, AVR512},
+ {"atmega165p", AVR16K, AVR1K, AVR512},
+ {"atmega168", AVR16K, AVR1K, AVR512},
+ {"atmega168p", AVR16K, AVR1K, AVR512},
+ {"atmega169", AVR16K, AVR1K, AVR512},
+ {"atmega169p", AVR16K, AVR1K, AVR512},
+ {"atmega16u4", AVR16K, 1280UL, AVR512},
+ {"attiny167", AVR16K, AVR512, AVR512},
+
+ {"at90c8534", AVR8K, 352, AVR512},
+ {"at90pwm1", AVR8K, AVR512, AVR512},
+ {"at90pwm2", AVR8K, AVR512, AVR512},
+ {"at90pwm2b", AVR8K, AVR512, AVR512},
+ {"at90pwm3", AVR8K, AVR512, AVR512},
+ {"at90pwm3b", AVR8K, AVR512, AVR512},
+ {"at90s8515", AVR8K, AVR512, AVR512},
+ {"at90s8535", AVR8K, AVR512, AVR512},
+ {"at90usb82", AVR8K, AVR512, AVR512},
+ {"atmega8", AVR8K, AVR1K, AVR512},
+ {"atmega8515", AVR8K, AVR512, AVR512},
+ {"atmega8535", AVR8K, AVR512, AVR512},
+ {"atmega88", AVR8K, AVR1K, AVR512},
+ {"atmega88p", AVR8K, AVR1K, AVR512},
+ {"attiny84", AVR8K, AVR512, AVR512},
+ {"attiny85", AVR8K, AVR512, AVR512},
+ {"attiny861", AVR8K, AVR512, AVR512},
+ {"attiny88", AVR8K, AVR256, AVR64},
+
+ {"at90s4414", AVR4K, 352, AVR256},
+ {"at90s4433", AVR4K, AVR128, AVR256},
+ {"at90s4434", AVR4K, 352, AVR256},
+ {"atmega48", AVR4K, AVR512, AVR256},
+ {"atmega48p", AVR4K, AVR512, AVR256},
+ {"attiny43u", AVR4K, AVR256, AVR64},
+ {"attiny44", AVR4K, AVR256, AVR256},
+ {"attiny45", AVR4K, AVR256, AVR256},
+ {"attiny461", AVR4K, AVR256, AVR256},
+ {"attiny48", AVR4K, AVR256, AVR64},
+
+ {"at86rf401", AVR2K, 224, AVR128},
+ {"at90s2313", AVR2K, AVR128, AVR128},
+ {"at90s2323", AVR2K, AVR128, AVR128},
+ {"at90s2333", AVR2K, 224, AVR128},
+ {"at90s2343", AVR2K, AVR128, AVR128},
+ {"attiny22", AVR2K, 224, AVR128},
+ {"attiny2313", AVR2K, AVR128, AVR128},
+ {"attiny24", AVR2K, AVR128, AVR128},
+ {"attiny25", AVR2K, AVR128, AVR128},
+ {"attiny26", AVR2K, AVR128, AVR128},
+ {"attiny261", AVR2K, AVR128, AVR128},
+ {"attiny28", AVR2K, 0, 0},
+
+ {"at90s1200", AVR1K, 0, AVR64},
+ {"attiny11", AVR1K, 0, AVR64},
+ {"attiny12", AVR1K, 0, AVR64},
+ {"attiny13", AVR1K, AVR64, AVR64},
+ {"attiny15", AVR1K, 0, AVR64},
+};
+
+static char *avrmcu = NULL;
+
+
static char *target = NULL;
/* Forward declarations. */
@@ -78,7 +247,8 @@ usage (FILE *stream, int status)
fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
fprintf (stream, _(" The options are:\n\
- -A|-B --format={sysv|berkeley} Select output style (default is %s)\n\
+ -A|-B|-C --format={sysv|berkeley|avr} Select output style (default is %s)\n\
+ --mcu=<avrmcu> MCU name for AVR format only\n\
-o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n\
-t --totals Display the total sizes (Berkeley only)\n\
--common Display total size for *COM* syms\n\
@@ -87,11 +257,7 @@ usage (FILE *stream, int status)
-h --help Display this information\n\
-v --version Display the program's version\n\
\n"),
-#if BSD_DEFAULT
- "berkeley"
-#else
- "sysv"
-#endif
+FORMAT_NAME
);
list_supported_targets (program_name, stream);
if (REPORT_BUGS_TO[0] && status == 0)
@@ -102,6 +268,7 @@ usage (FILE *stream, int status)
#define OPTION_FORMAT (200)
#define OPTION_RADIX (OPTION_FORMAT + 1)
#define OPTION_TARGET (OPTION_RADIX + 1)
+#define OPTION_MCU (OPTION_TARGET + 1)
static struct option long_options[] =
{
@@ -109,6 +276,7 @@ static struct option long_options[] =
{"format", required_argument, 0, OPTION_FORMAT},
{"radix", required_argument, 0, OPTION_RADIX},
{"target", required_argument, 0, OPTION_TARGET},
+ {"mcu", required_argument, 0, 203},
{"totals", no_argument, &show_totals, 1},
{"version", no_argument, &show_version, 1},
{"help", no_argument, &show_help, 1},
@@ -140,7 +308,7 @@ main (int argc, char **argv)
bfd_init ();
set_default_bfd_target ();
- while ((c = getopt_long (argc, argv, "ABHhVvdfotx", long_options,
+ while ((c = getopt_long (argc, argv, "ABCHhVvdfotx", long_options,
(int *) 0)) != EOF)
switch (c)
{
@@ -149,11 +317,15 @@ main (int argc, char **argv)
{
case 'B':
case 'b':
- berkeley_format = 1;
+ format = format_bsd;
break;
case 'S':
case 's':
- berkeley_format = 0;
+ format = format_sysv;
+ break;
+ case 'A':
+ case 'a':
+ format = format_avr;
break;
default:
non_fatal (_("invalid argument to --format: %s"), optarg);
@@ -161,6 +333,10 @@ main (int argc, char **argv)
}
break;
+ case OPTION_MCU:
+ avrmcu = optarg;
+ break;
+
case OPTION_TARGET:
target = optarg;
break;
@@ -189,11 +365,14 @@ main (int argc, char **argv)
break;
case 'A':
- berkeley_format = 0;
+ format = format_sysv;
break;
case 'B':
- berkeley_format = 1;
+ format = format_bsd;
break;
+ case 'C':
+ format = format_avr;
+ break;
case 'v':
case 'V':
show_version = 1;
@@ -239,7 +418,7 @@ main (int argc, char **argv)
for (; optind < argc;)
display_file (argv[optind++]);
- if (show_totals && berkeley_format)
+ if (show_totals && format == format_bsd)
{
bfd_size_type total = total_textsize + total_datasize + total_bsssize;
@@ -600,13 +779,117 @@ print_sysv_format (bfd *file)
printf ("\n\n");
}
+
+static avr_device_t *
+avr_find_device (void)
+{
+ unsigned int i;
+ if (avrmcu != NULL)
+ {
+ for (i = 0; i < sizeof(avr) / sizeof(avr[0]); i++)
+ {
+ if (strcmp(avr[i].name, avrmcu) == 0)
+ {
+ /* Match found */
+ return (&avr[i]);
+ }
+ }
+ }
+ return (NULL);
+}
+
+
+
+static void
+print_avr_format (bfd *file)
+{
+ char *avr_name = "Unknown";
+ int flashmax = 0;
+ int rammax = 0;
+ int eeprommax = 0;
+ asection *section;
+ bfd_size_type datasize = 0;
+ bfd_size_type textsize = 0;
+ bfd_size_type bsssize = 0;
+ bfd_size_type bootloadersize = 0;
+ bfd_size_type noinitsize = 0;
+ bfd_size_type eepromsize = 0;
+
+ avr_device_t *avrdevice = avr_find_device();
+ if (avrdevice != NULL)
+ {
+ avr_name = avrdevice->name;
+ flashmax = avrdevice->flash;
+ rammax = avrdevice->ram;
+ eeprommax = avrdevice->eeprom;
+ }
+
+ if ((section = bfd_get_section_by_name (file, ".data")) != NULL)
+ datasize = bfd_section_size (file, section);
+ if ((section = bfd_get_section_by_name (file, ".text")) != NULL)
+ textsize = bfd_section_size (file, section);
+ if ((section = bfd_get_section_by_name (file, ".bss")) != NULL)
+ bsssize = bfd_section_size (file, section);
+ if ((section = bfd_get_section_by_name (file, ".bootloader")) != NULL)
+ bootloadersize = bfd_section_size (file, section);
+ if ((section = bfd_get_section_by_name (file, ".noinit")) != NULL)
+ noinitsize = bfd_section_size (file, section);
+ if ((section = bfd_get_section_by_name (file, ".eeprom")) != NULL)
+ eepromsize = bfd_section_size (file, section);
+
+ bfd_size_type text = textsize + datasize + bootloadersize;
+ bfd_size_type data = datasize + bsssize + noinitsize;
+ bfd_size_type eeprom = eepromsize;
+
+ printf ("AVR Memory Usage\n"
+ "----------------\n"
+ "Device: %s\n\n", avr_name);
+
+ /* Text size */
+ printf ("Program:%8ld bytes", text);
+ if (flashmax > 0)
+ {
+ printf (" (%2.1f%% Full)", ((float)text / flashmax) * 100);
+ }
+ printf ("\n(.text + .data + .bootloader)\n\n");
+
+ /* Data size */
+ printf ("Data: %8ld bytes", data);
+ if (rammax > 0)
+ {
+ printf (" (%2.1f%% Full)", ((float)data / rammax) * 100);
+ }
+ printf ("\n(.data + .bss + .noinit)\n\n");
+
+ /* EEPROM size */
+ if (eeprom > 0)
+ {
+ printf ("EEPROM: %8ld bytes", eeprom);
+ if (eeprommax > 0)
+ {
+ printf (" (%2.1f%% Full)", ((float)eeprom / eeprommax) * 100);
+ }
+ printf ("\n(.eeprom)\n\n");
+ }
+}
+
+
static void
print_sizes (bfd *file)
{
if (show_common)
calculate_common_size (file);
- if (berkeley_format)
- print_berkeley_format (file);
- else
- print_sysv_format (file);
+ switch (format)
+ {
+ case format_sysv:
+ print_sysv_format (file);
+ break;
+ case format_bsd:
+ print_berkeley_format (file);
+ break;
+ case format_avr:
+ default:
+ print_avr_format (file);
+ break;
+ }
}

View file

@ -0,0 +1,45 @@
Not committed.
--------------------------------------------------------------------------------
--- ld/scripttempl/avr.sc.old 2007-09-14 06:32:02.437500000 -0600
+++ ld/scripttempl/avr.sc 2007-09-14 06:50:28.854125000 -0600
@@ -4,9 +4,12 @@ OUTPUT_ARCH(${ARCH})
MEMORY
{
- text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
- data (rw!x) : ORIGIN = 0x800060, LENGTH = $DATA_LENGTH
- eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
+ text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
+ data (rw!x) : ORIGIN = 0x800060, LENGTH = $DATA_LENGTH
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
+ fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
+ lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
+ signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
}
SECTIONS
@@ -196,6 +199,24 @@ SECTIONS
${RELOCATING+ __eeprom_end = . ; }
} ${RELOCATING+ > eeprom}
+ .fuse ${RELOCATING-0}:
+ {
+ KEEP(*(.fuse))
+ KEEP(*(.lfuse))
+ KEEP(*(.hfuse))
+ KEEP(*(.efuse))
+ } ${RELOCATING+ > fuse}
+
+ .lock ${RELOCATING-0}:
+ {
+ KEEP(*(.lock*))
+ } ${RELOCATING+ > lock}
+
+ .signature ${RELOCATING-0}:
+ {
+ KEEP(*(.signature*))
+ } ${RELOCATING+ > signature}
+
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }

View file

@ -0,0 +1,99 @@
Not committed.
Patch by Anatoly Sokolov
--------------------------------------------------------------------------------
Index: ld/emulparams/avr1.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/avr1.sh,v
retrieving revision 1.2
diff -u -r1.2 avr1.sh
--- ld/emulparams/avr1.sh 24 May 2006 07:36:11 -0000 1.2
+++ ld/emulparams/avr1.sh 29 Feb 2008 23:39:37 -0000
@@ -7,5 +7,6 @@
TEMPLATE_NAME=elf32
TEXT_LENGTH=8K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0
EXTRA_EM_FILE=avrelf
Index: ld/emulparams/avr2.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/avr2.sh,v
retrieving revision 1.2
diff -u -r1.2 avr2.sh
--- ld/emulparams/avr2.sh 24 May 2006 07:36:11 -0000 1.2
+++ ld/emulparams/avr2.sh 29 Feb 2008 23:39:37 -0000
@@ -7,5 +7,6 @@
TEMPLATE_NAME=elf32
TEXT_LENGTH=8K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
Index: ld/emulparams/avr3.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/avr3.sh,v
retrieving revision 1.2
diff -u -r1.2 avr3.sh
--- ld/emulparams/avr3.sh 24 May 2006 07:36:11 -0000 1.2
+++ ld/emulparams/avr3.sh 29 Feb 2008 23:39:37 -0000
@@ -7,5 +7,6 @@
TEMPLATE_NAME=elf32
TEXT_LENGTH=128K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
Index: ld/emulparams/avr4.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/avr4.sh,v
retrieving revision 1.2
diff -u -r1.2 avr4.sh
--- ld/emulparams/avr4.sh 24 May 2006 07:36:11 -0000 1.2
+++ ld/emulparams/avr4.sh 29 Feb 2008 23:39:37 -0000
@@ -7,5 +7,6 @@
TEMPLATE_NAME=elf32
TEXT_LENGTH=8K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
Index: ld/emulparams/avr5.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/avr5.sh,v
retrieving revision 1.2
diff -u -r1.2 avr5.sh
--- ld/emulparams/avr5.sh 24 May 2006 07:36:11 -0000 1.2
+++ ld/emulparams/avr5.sh 29 Feb 2008 23:39:37 -0000
@@ -7,5 +7,6 @@
TEMPLATE_NAME=elf32
TEXT_LENGTH=128K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
Index: ld/emulparams/avr6.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/avr6.sh,v
retrieving revision 1.1
diff -u -r1.1 avr6.sh
--- ld/emulparams/avr6.sh 24 May 2006 07:36:11 -0000 1.1
+++ ld/emulparams/avr6.sh 29 Feb 2008 23:39:37 -0000
@@ -7,5 +7,6 @@
TEMPLATE_NAME=elf32
TEXT_LENGTH=1024K
-DATA_LENGTH=0xffa0
+DATA_ORIGIN=0x800200
+DATA_LENGTH=0xfe00
EXTRA_EM_FILE=avrelf
--- ld/scripttempl/avr.sc.orig 2008-02-19 16:36:36.382765500 -0700
+++ ld/scripttempl/avr.sc 2008-02-19 16:41:07.653804500 -0700
@@ -5,7 +5,7 @@ OUTPUT_ARCH(${ARCH})
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
- data (rw!x) : ORIGIN = 0x800060, LENGTH = $DATA_LENGTH
+ data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K

View file

@ -0,0 +1,22 @@
--- bfd/elf32-avr.c.old 2008-11-11 10:30:09.000000000 -0700
+++ bfd/elf32-avr.c 2008-11-11 10:31:40.171875000 -0700
@@ -1298,6 +1298,7 @@ bfd_elf_avr_final_write_processing (bfd
case bfd_mach_avr25:
val = E_AVR_MACH_AVR25;
+ break;
case bfd_mach_avr3:
val = E_AVR_MACH_AVR3;
@@ -1305,9 +1306,11 @@ bfd_elf_avr_final_write_processing (bfd
case bfd_mach_avr31:
val = E_AVR_MACH_AVR31;
+ break;
case bfd_mach_avr35:
val = E_AVR_MACH_AVR35;
+ break;
case bfd_mach_avr4:
val = E_AVR_MACH_AVR4;

View file

@ -0,0 +1,594 @@
Not committed
--------------------------------------------------------------------------------
--- opcodes/avr-dis.c.orig 2007-08-06 13:58:38.000000000 -0600
+++ opcodes/avr-dis.c 2008-04-09 16:37:17.233737600 -0600
@@ -50,7 +50,7 @@ static const char * comment_start = "0x"
static int
avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constraint,
- char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr)
+ char *opcode_str, char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr)
{
int ok = 1;
*sym = 0;
@@ -118,8 +118,18 @@ avr_operand (unsigned int insn, unsigned
case 'z':
*buf++ = 'Z';
- if (insn & 0x1)
- *buf++ = '+';
+
+ /* Check for post-increment. */
+ char *s;
+ for (s = opcode_str; *s; ++s)
+ {
+ if (*s == '+')
+ {
+ *buf++ = '+';
+ break;
+ }
+ }
+
*buf = '\0';
if (AVR_UNDEF_P (insn))
sprintf (comment, _("undefined"));
@@ -226,6 +236,10 @@ avr_operand (unsigned int insn, unsigned
sprintf (comment, "%d", x);
}
break;
+
+ case 'E':
+ sprintf (buf, "%d", (insn >> 4) & 15);
+ break;
case '?':
*buf = '\0';
@@ -331,7 +345,8 @@ print_insn_avr (bfd_vma addr, disassembl
if (opcode->name)
{
- char *op = opcode->constraints;
+ char *constraints = opcode->constraints;
+ char *opcode_str = opcode->opcode;
insn2 = 0;
ok = 1;
@@ -342,14 +357,14 @@ print_insn_avr (bfd_vma addr, disassembl
cmd_len = 4;
}
- if (*op && *op != '?')
+ if (*constraints && *constraints != '?')
{
- int regs = REGISTER_P (*op);
+ int regs = REGISTER_P (*constraints);
- ok = avr_operand (insn, insn2, addr, *op, op1, comment1, 0, &sym_op1, &sym_addr1);
+ ok = avr_operand (insn, insn2, addr, *constraints, opcode_str, op1, comment1, 0, &sym_op1, &sym_addr1);
- if (ok && *(++op) == ',')
- ok = avr_operand (insn, insn2, addr, *(++op), op2,
+ if (ok && *(++constraints) == ',')
+ ok = avr_operand (insn, insn2, addr, *(++constraints), opcode_str, op2,
*comment1 ? comment2 : comment1, regs, &sym_op2, &sym_addr2);
}
}
--- gas/config/tc-avr.c.orig 2008-08-29 10:58:02.000000000 -0600
+++ gas/config/tc-avr.c 2008-09-22 14:11:05.345349200 -0600
@@ -27,20 +27,21 @@
struct avr_opcodes_s
{
- char * name;
- char * constraints;
- int insn_size; /* In words. */
- int isa;
+ char *name;
+ char *constraints;
+ char *opcode;
+ int insn_size; /* In words. */
+ int isa;
unsigned int bin_opcode;
};
#define AVR_INSN(NAME, CONSTR, OPCODE, SIZE, ISA, BIN) \
-{#NAME, CONSTR, SIZE, ISA, BIN},
+{#NAME, CONSTR, OPCODE, SIZE, ISA, BIN},
struct avr_opcodes_s avr_opcodes[] =
{
#include "opcode/avr.h"
- {NULL, NULL, 0, 0, 0}
+ {NULL, NULL, NULL, 0, 0, 0}
};
const char comment_chars[] = ";";
@@ -79,6 +80,13 @@ static struct mcu_type_s mcu_types[] =
{"avr5", AVR_ISA_AVR51, bfd_mach_avr5},
{"avr51", AVR_ISA_AVR51, bfd_mach_avr51},
{"avr6", AVR_ISA_AVR6, bfd_mach_avr6},
+ {"avrxmega1", AVR_ISA_XMEGA, bfd_mach_avrxmega1},
+ {"avrxmega2", AVR_ISA_XMEGA, bfd_mach_avrxmega2},
+ {"avrxmega3", AVR_ISA_XMEGA, bfd_mach_avrxmega3},
+ {"avrxmega4", AVR_ISA_XMEGA, bfd_mach_avrxmega4},
+ {"avrxmega5", AVR_ISA_XMEGA, bfd_mach_avrxmega5},
+ {"avrxmega6", AVR_ISA_XMEGA, bfd_mach_avrxmega6},
+ {"avrxmega7", AVR_ISA_XMEGA, bfd_mach_avrxmega7},
{"at90s1200", AVR_ISA_1200, bfd_mach_avr1},
{"attiny11", AVR_ISA_AVR1, bfd_mach_avr1},
{"attiny12", AVR_ISA_AVR1, bfd_mach_avr1},
@@ -185,6 +193,8 @@ static struct mcu_type_s mcu_types[] =
{"at90usb1287",AVR_ISA_AVR51, bfd_mach_avr51},
{"atmega2560", AVR_ISA_AVR6, bfd_mach_avr6},
{"atmega2561", AVR_ISA_AVR6, bfd_mach_avr6},
+ {"atxmega64a1", AVR_ISA_XMEGA, bfd_mach_avrxmega5},
+ {"atxmega128a1", AVR_ISA_XMEGA, bfd_mach_avrxmega7},
{NULL, 0, 0}
};
@@ -789,7 +799,12 @@ avr_operand (struct avr_opcodes_s *opcod
if (*str == '+')
{
++str;
- op_mask |= 1;
+ char *s;
+ for (s = opcode->opcode; *s; ++s)
+ {
+ if (*s == '+')
+ op_mask |= (1 << (15 - (s - opcode->opcode)));
+ }
}
/* attiny26 can do "lpm" and "lpm r,Z" but not "lpm r,Z+". */
@@ -906,6 +921,16 @@ avr_operand (struct avr_opcodes_s *opcod
}
break;
+ case 'E':
+ {
+ unsigned int x;
+
+ x = avr_get_constant (str, 15);
+ str = input_line_pointer;
+ op_mask |= (x << 4);
+ }
+ break;
+
case '?':
break;
--- include/opcode/avr.h.orig 2008-04-09 14:03:00.411627300 -0600
+++ include/opcode/avr.h 2008-04-09 16:34:28.329060900 -0600
@@ -30,6 +30,8 @@
#define AVR_ISA_BRK 0x0400 /* device has BREAK (on-chip debug) */
#define AVR_ISA_EIND 0x0800 /* device has >128K program memory (none yet) */
#define AVR_ISA_MOVW 0x1000 /* device has MOVW */
+#define AVR_ISA_SPMX 0x2000 /* device has SPM Z[+] */
+#define AVR_ISA_DES 0x4000 /* device has DES */
#define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM)
#define AVR_ISA_PWMx (AVR_ISA_M8 | AVR_ISA_BRK)
@@ -53,6 +55,8 @@
#define AVR_ISA_94K (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | AVR_ISA_LPMX)
#define AVR_ISA_M323 (AVR_ISA_M161 | AVR_ISA_BRK)
#define AVR_ISA_M128 (AVR_ISA_M323 | AVR_ISA_ELPM | AVR_ISA_ELPMX)
+#define AVR_ISA_M256 (AVR_ISA_M128 | AVR_ISA_EIND)
+#define AVR_ISA_XMEGA (AVR_ISA_M256 | AVR_ISA_SPMX | AVR_ISA_DES)
#define AVR_ISA_ALL 0xFFFF
@@ -98,6 +102,7 @@
L - signed pc relative offset from -2048 to 2047
h - absolute code address (call, jmp)
S - immediate value from 0 to 7 (S = s << 4)
+ E - immediate value from 0 to 15, shifted left by 4 (des)
? - use this opcode entry if no parameters, else use next opcode entry
Order is important - some binary opcodes have more than one name,
@@ -158,7 +163,8 @@ AVR_INSN (reti, "", "1001010100011000
AVR_INSN (sleep,"", "1001010110001000", 1, AVR_ISA_1200, 0x9588)
AVR_INSN (break,"", "1001010110011000", 1, AVR_ISA_BRK, 0x9598)
AVR_INSN (wdr, "", "1001010110101000", 1, AVR_ISA_1200, 0x95a8)
-AVR_INSN (spm, "", "1001010111101000", 1, AVR_ISA_SPM, 0x95e8)
+AVR_INSN (spm, "?", "1001010111101000", 1, AVR_ISA_SPM, 0x95e8)
+AVR_INSN (spm, "z", "10010101111+1000", 1, AVR_ISA_SPMX, 0x95e8)
AVR_INSN (adc, "r,r", "000111rdddddrrrr", 1, AVR_ISA_1200, 0x1c00)
AVR_INSN (add, "r,r", "000011rdddddrrrr", 1, AVR_ISA_1200, 0x0c00)
@@ -272,3 +278,6 @@ AVR_INSN (st, "e,r", "100!001rrrrree-+
AVR_INSN (eicall, "", "1001010100011001", 1, AVR_ISA_EIND, 0x9519)
AVR_INSN (eijmp, "", "1001010000011001", 1, AVR_ISA_EIND, 0x9419)
+/* DES instruction for encryption and decryption */
+AVR_INSN (des, "E", "10010100EEEE1011", 1, AVR_ISA_DES, 0x940B)
+
Index: bfd/archures.c
===================================================================
RCS file: /cvs/src/src/bfd/archures.c,v
retrieving revision 1.130
diff -a -u -p -r1.130 archures.c
--- bfd/archures.c 4 Feb 2008 19:15:50 -0000 1.130
+++ bfd/archures.c 14 Feb 2008 18:01:43 -0000
@@ -352,6 +352,13 @@ DESCRIPTION
.#define bfd_mach_avr4 4
.#define bfd_mach_avr5 5
.#define bfd_mach_avr6 6
+.#define bfd_mach_avrxmega1 101
+.#define bfd_mach_avrxmega2 102
+.#define bfd_mach_avrxmega3 103
+.#define bfd_mach_avrxmega4 104
+.#define bfd_mach_avrxmega5 105
+.#define bfd_mach_avrxmega6 106
+.#define bfd_mach_avrxmega7 107
. bfd_arch_bfin, {* ADI Blackfin *}
.#define bfd_mach_bfin 1
. bfd_arch_cr16, {* National Semiconductor CompactRISC (ie CR16). *}
--- bfd/cpu-avr.c.orig 2008-08-08 23:35:12.000000000 -0600
+++ bfd/cpu-avr.c 2008-09-22 14:14:33.969548200 -0600
@@ -126,7 +126,29 @@ static const bfd_arch_info_type arch_inf
N (22, bfd_mach_avr51, "avr:51", FALSE, & arch_info_struct[9]),
/* 3-Byte PC. */
- N (22, bfd_mach_avr6, "avr:6", FALSE, NULL)
+ N (22, bfd_mach_avr6, "avr:6", FALSE, & arch_info_struct[10]),
+
+ /* Xmega 1 */
+ N (24, bfd_mach_avrxmega1, "avr:101", FALSE, & arch_info_struct[11]),
+
+ /* Xmega 2 */
+ N (24, bfd_mach_avrxmega2, "avr:102", FALSE, & arch_info_struct[12]),
+
+ /* Xmega 3 */
+ N (24, bfd_mach_avrxmega3, "avr:103", FALSE, & arch_info_struct[13]),
+
+ /* Xmega 4 */
+ N (24, bfd_mach_avrxmega4, "avr:104", FALSE, & arch_info_struct[14]),
+
+ /* Xmega 5 */
+ N (24, bfd_mach_avrxmega5, "avr:105", FALSE, & arch_info_struct[15]),
+
+ /* Xmega 6 */
+ N (24, bfd_mach_avrxmega6, "avr:106", FALSE, & arch_info_struct[16]),
+
+ /* Xmega 7 */
+ N (24, bfd_mach_avrxmega7, "avr:107", FALSE, NULL)
+
};
const bfd_arch_info_type bfd_avr_arch =
--- include/elf/avr.h.orig 2008-08-08 23:35:13.000000000 -0600
+++ include/elf/avr.h 2008-09-22 14:16:17.550944200 -0600
@@ -40,6 +40,13 @@
#define E_AVR_MACH_AVR5 5
#define E_AVR_MACH_AVR51 51
#define E_AVR_MACH_AVR6 6
+#define E_AVR_MACH_XMEGA1 101
+#define E_AVR_MACH_XMEGA2 102
+#define E_AVR_MACH_XMEGA3 103
+#define E_AVR_MACH_XMEGA4 104
+#define E_AVR_MACH_XMEGA5 105
+#define E_AVR_MACH_XMEGA6 106
+#define E_AVR_MACH_XMEGA7 107
/* Relocations. */
START_RELOC_NUMBERS (elf_avr_reloc_type)
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.244
diff -a -u -p -r1.244 Makefile.am
--- ld/Makefile.am 24 Oct 2007 04:56:47 -0000 1.244
+++ ld/Makefile.am 14 Feb 2008 18:01:45 -0000
@@ -138,6 +138,13 @@ ALL_EMULATIONS = \
eavr4.o \
eavr5.o \
eavr6.o \
+ eavrxmega1.o \
+ eavrxmega2.o \
+ eavrxmega3.o \
+ eavrxmega4.o \
+ eavrxmega5.o \
+ eavrxmega6.o \
+ eavrxmega7.o \
ecoff_i860.o \
ecoff_sparc.o \
eelf32_spu.o \
@@ -622,6 +629,34 @@ eavr6.c: $(srcdir)/emulparams/avr6.sh $(
$(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
${GENSCRIPTS} avr6 "$(tdir_avr2)"
+eavrxmega1.c: $(srcdir)/emulparams/avrxmega1.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega1 "$(tdir_avr2)"
+eavrxmega2.c: $(srcdir)/emulparams/avrxmega2.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega2 "$(tdir_avr2)"
+eavrxmega3.c: $(srcdir)/emulparams/avrxmega3.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega3 "$(tdir_avr2)"
+eavrxmega4.c: $(srcdir)/emulparams/avrxmega4.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega4 "$(tdir_avr2)"
+eavrxmega5.c: $(srcdir)/emulparams/avrxmega5.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega5 "$(tdir_avr2)"
+eavrxmega6.c: $(srcdir)/emulparams/avrxmega6.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega6 "$(tdir_avr2)"
+eavrxmega7.c: $(srcdir)/emulparams/avrxmega7.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega7 "$(tdir_avr2)"
ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i860coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} coff_i860 "$(tdir_coff_i860)"
Index: ld/Makefile.in
===================================================================
RCS file: /cvs/src/src/ld/Makefile.in,v
retrieving revision 1.262
diff -a -u -p -r1.262 Makefile.in
--- ld/Makefile.in 24 Oct 2007 04:56:47 -0000 1.262
+++ ld/Makefile.in 14 Feb 2008 18:01:45 -0000
@@ -385,6 +385,13 @@ ALL_EMULATIONS = \
eavr4.o \
eavr5.o \
eavr6.o \
+ eavrxmega1.o \
+ eavrxmega2.o \
+ eavrxmega3.o \
+ eavrxmega4.o \
+ eavrxmega5.o \
+ eavrxmega6.o \
+ eavrxmega7.o \
ecoff_i860.o \
ecoff_sparc.o \
eelf32_spu.o \
@@ -1448,6 +1455,34 @@ eavr6.c: $(srcdir)/emulparams/avr6.sh $(
$(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
${GENSCRIPTS} avr6 "$(tdir_avr2)"
+eavrxmega1.c: $(srcdir)/emulparams/avrxmega1.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega1 "$(tdir_avr2)"
+eavrxmega2.c: $(srcdir)/emulparams/avrxmega2.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega2 "$(tdir_avr2)"
+eavrxmega3.c: $(srcdir)/emulparams/avrxmega3.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega3 "$(tdir_avr2)"
+eavrxmega4.c: $(srcdir)/emulparams/avrxmega4.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega4 "$(tdir_avr2)"
+eavrxmega5.c: $(srcdir)/emulparams/avrxmega5.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega5 "$(tdir_avr2)"
+eavrxmega6.c: $(srcdir)/emulparams/avrxmega6.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega6 "$(tdir_avr2)"
+eavrxmega7.c: $(srcdir)/emulparams/avrxmega7.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega7 "$(tdir_avr2)"
ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i860coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} coff_i860 "$(tdir_coff_i860)"
--- ld/configure.tgt.orig 2008-08-08 23:35:13.000000000 -0600
+++ ld/configure.tgt 2008-09-22 14:17:42.272546800 -0600
@@ -107,7 +107,7 @@ xscale-*-coff) targ_emul=armcoff ;;
xscale-*-elf) targ_emul=armelf
;;
avr-*-*) targ_emul=avr2
- targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6"
+ targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7"
;;
bfin-*-elf) targ_emul=elf32bfin;
targ_extra_emuls="elf32bfinfd"
Index: ld/emultempl/avrelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/avrelf.em,v
retrieving revision 1.5
diff -a -u -p -r1.5 avrelf.em
--- ld/emultempl/avrelf.em 17 Aug 2007 13:50:48 -0000 1.5
+++ ld/emultempl/avrelf.em 14 Feb 2008 18:01:45 -0000
@@ -71,8 +71,10 @@ avr_elf_${EMULATION_NAME}_before_allocat
gld${EMULATION_NAME}_before_allocation ();
- /* We only need stubs for the avr6 family. */
- if (strcmp ("${EMULATION_NAME}","avr6"))
+ /* We only need stubs for avr6, avrxmega6, and avrxmega7. */
+ if (strcmp ("${EMULATION_NAME}","avr6")
+ && strcmp ("${EMULATION_NAME}","avrxmega6")
+ && strcmp ("${EMULATION_NAME}","avrxmega7") )
avr_no_stubs = TRUE;
avr_elf_set_global_bfd_parameters ();
--- /dev/null 2008-02-14 11:03:14.488602600 -0700
+++ ld/emulparams/avrxmega1.sh 2008-02-14 09:08:29.531250000 -0700
@@ -0,0 +1,12 @@
+ARCH=avr:101
+MACHINE=
+SCRIPT_NAME=avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=elf32
+
+TEXT_LENGTH=1024K
+DATA_ORIGIN=0x802000
+DATA_LENGTH=0xffa0
+EXTRA_EM_FILE=avrelf
--- /dev/null 2008-02-14 11:03:18.394502600 -0700
+++ ld/emulparams/avrxmega2.sh 2008-02-14 09:08:29.546875000 -0700
@@ -0,0 +1,12 @@
+ARCH=avr:102
+MACHINE=
+SCRIPT_NAME=avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=elf32
+
+TEXT_LENGTH=1024K
+DATA_ORIGIN=0x802000
+DATA_LENGTH=0xffa0
+EXTRA_EM_FILE=avrelf
--- /dev/null 2008-02-14 11:03:22.050425000 -0700
+++ ld/emulparams/avrxmega3.sh 2008-02-14 09:08:29.546875000 -0700
@@ -0,0 +1,12 @@
+ARCH=avr:103
+MACHINE=
+SCRIPT_NAME=avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=elf32
+
+TEXT_LENGTH=1024K
+DATA_ORIGIN=0x802000
+DATA_LENGTH=0xffa0
+EXTRA_EM_FILE=avrelf
--- /dev/null 2008-02-14 11:03:25.784465400 -0700
+++ ld/emulparams/avrxmega4.sh 2008-02-14 09:08:29.546875000 -0700
@@ -0,0 +1,12 @@
+ARCH=avr:104
+MACHINE=
+SCRIPT_NAME=avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=elf32
+
+TEXT_LENGTH=1024K
+DATA_ORIGIN=0x802000
+DATA_LENGTH=0xffa0
+EXTRA_EM_FILE=avrelf
--- /dev/null 2008-02-14 11:03:25.784465400 -0700
+++ ld/emulparams/avrxmega5.sh 2008-02-14 09:08:29.546875000 -0700
@@ -0,0 +1,12 @@
+ARCH=avr:105
+MACHINE=
+SCRIPT_NAME=avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=elf32
+
+TEXT_LENGTH=1024K
+DATA_ORIGIN=0x802000
+DATA_LENGTH=0xffa0
+EXTRA_EM_FILE=avrelf
--- /dev/null 2008-02-14 11:03:25.784465400 -0700
+++ ld/emulparams/avrxmega6.sh 2008-02-14 09:08:29.546875000 -0700
@@ -0,0 +1,12 @@
+ARCH=avr:106
+MACHINE=
+SCRIPT_NAME=avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=elf32
+
+TEXT_LENGTH=1024K
+DATA_ORIGIN=0x802000
+DATA_LENGTH=0xffa0
+EXTRA_EM_FILE=avrelf
--- /dev/null 2008-02-14 11:03:25.784465400 -0700
+++ ld/emulparams/avrxmega7.sh 2008-02-14 09:08:29.546875000 -0700
@@ -0,0 +1,12 @@
+ARCH=avr:107
+MACHINE=
+SCRIPT_NAME=avr
+OUTPUT_FORMAT="elf32-avr"
+MAXPAGESIZE=1
+EMBEDDED=yes
+TEMPLATE_NAME=elf32
+
+TEXT_LENGTH=1024K
+DATA_ORIGIN=0x802000
+DATA_LENGTH=0xffa0
+EXTRA_EM_FILE=avrelf
--- bfd/elf32-avr.c.old 2008-10-14 11:27:16.515625000 -0600
+++ bfd/elf32-avr.c 2008-10-14 11:46:35.453125000 -0600
@@ -1324,6 +1324,34 @@ bfd_elf_avr_final_write_processing (bfd
case bfd_mach_avr6:
val = E_AVR_MACH_AVR6;
break;
+
+ case bfd_mach_avrxmega1:
+ val = E_AVR_MACH_XMEGA1;
+ break;
+
+ case bfd_mach_avrxmega2:
+ val = E_AVR_MACH_XMEGA2;
+ break;
+
+ case bfd_mach_avrxmega3:
+ val = E_AVR_MACH_XMEGA3;
+ break;
+
+ case bfd_mach_avrxmega4:
+ val = E_AVR_MACH_XMEGA4;
+ break;
+
+ case bfd_mach_avrxmega5:
+ val = E_AVR_MACH_XMEGA5;
+ break;
+
+ case bfd_mach_avrxmega6:
+ val = E_AVR_MACH_XMEGA6;
+ break;
+
+ case bfd_mach_avrxmega7:
+ val = E_AVR_MACH_XMEGA7;
+ break;
}
elf_elfheader (abfd)->e_machine = EM_AVR;
@@ -1386,6 +1414,34 @@ elf32_avr_object_p (bfd *abfd)
case E_AVR_MACH_AVR6:
e_set = bfd_mach_avr6;
break;
+
+ case E_AVR_MACH_XMEGA1:
+ e_set = bfd_mach_avrxmega1;
+ break;
+
+ case E_AVR_MACH_XMEGA2:
+ e_set = bfd_mach_avrxmega2;
+ break;
+
+ case E_AVR_MACH_XMEGA3:
+ e_set = bfd_mach_avrxmega3;
+ break;
+
+ case E_AVR_MACH_XMEGA4:
+ e_set = bfd_mach_avrxmega4;
+ break;
+
+ case E_AVR_MACH_XMEGA5:
+ e_set = bfd_mach_avrxmega5;
+ break;
+
+ case E_AVR_MACH_XMEGA6:
+ e_set = bfd_mach_avrxmega6;
+ break;
+
+ case E_AVR_MACH_XMEGA7:
+ e_set = bfd_mach_avrxmega7;
+ break;
}
}
return bfd_default_set_arch_mach (abfd, bfd_arch_avr,

View file

@ -0,0 +1,47 @@
--- gas/config/tc-avr.c.orig 2008-10-29 14:10:04.264816900 -0600
+++ gas/config/tc-avr.c 2008-10-29 15:55:03.798197900 -0600
@@ -193,7 +193,11 @@ static struct mcu_type_s mcu_types[] =
{"at90usb1287",AVR_ISA_AVR51, bfd_mach_avr51},
{"atmega2560", AVR_ISA_AVR6, bfd_mach_avr6},
{"atmega2561", AVR_ISA_AVR6, bfd_mach_avr6},
+ {"atxmega64a3", AVR_ISA_XMEGA, bfd_mach_avrxmega4},
{"atxmega64a1", AVR_ISA_XMEGA, bfd_mach_avrxmega5},
+ {"atxmega128a3", AVR_ISA_XMEGA, bfd_mach_avrxmega6},
+ {"atxmega256a3", AVR_ISA_XMEGA, bfd_mach_avrxmega6},
+ {"atxmega256a3b",AVR_ISA_XMEGA, bfd_mach_avrxmega6},
{"atxmega128a1", AVR_ISA_XMEGA, bfd_mach_avrxmega7},
{NULL, 0, 0}
};
@@ -372,6 +376,10 @@ md_show_usage (FILE *stream)
" avr5 - enhanced AVR core with up to 64K program memory\n"
" avr51 - enhanced AVR core with up to 128K program memory\n"
" avr6 - enhanced AVR core with up to 256K program memory\n"
+ " avrxmega4 - XMEGA, > 64K, <= 128K FLASH, <= 64K RAM\n"
+ " avrxmega5 - XMEGA, > 64K, <= 128K FLASH, > 64K RAM\n"
+ " avrxmega6 - XMEGA, > 128K, <= 256K FLASH, <= 64K RAM\n"
+ " avrxmega7 - XMEGA, > 128K, <= 256K FLASH, > 64K RAM\n"
" or immediate microcontroller name.\n"));
fprintf (stream,
_(" -mall-opcodes accept all AVR opcodes, even if not supported by MCU\n"
--- gas/doc/c-avr.texi.orig 2008-08-29 10:58:02.000000000 -0600
+++ gas/doc/c-avr.texi 2008-10-29 15:59:25.299307900 -0600
@@ -76,6 +76,19 @@ at90can128, at90usb1286, at90usb1287).
Instruction set avr6 is for the enhanced AVR core with a 3-byte PC (MCU types:
atmega2560, atmega2561).
+Instruction set avrxmega4 is for the XMEGA AVR cor with up to 64K program
+memory space and less than 64K data space (MCU types: atxmega64a3).
+
+Instruction set avrxmega5 is for the XMEGA AVR core with up to 64K program
+memory space and greater than 64K data space (MCU types: atxmega64a1).
+
+Instruction set avrxmega6 is for the XMEGA AVR core with up to 256K program
+memory space and less than 64K data space (MCU types: atxmega128a3,
+atxmega256a3, atxmega256a3b).
+
+Instruction set avrxmega7 is for the XMEGA AVR core with up to 256K program
+memory space and greater than 64K data space (MCU types: atxmega128a1).
+
@cindex @code{-mall-opcodes} command line option, AVR
@item -mall-opcodes
Accept all AVR opcodes, even if not supported by @code{-mmcu}.

View file

@ -0,0 +1,21 @@
--- gas/config/tc-avr.c.orig 2008-11-03 20:26:36.667612400 -0700
+++ gas/config/tc-avr.c 2008-11-04 10:21:02.655736600 -0700
@@ -181,6 +181,7 @@ static struct mcu_type_s mcu_types[] =
{"atmega32c1", AVR_ISA_AVR5, bfd_mach_avr5},
{"atmega32m1", AVR_ISA_AVR5, bfd_mach_avr5},
{"atmega32u4", AVR_ISA_AVR5, bfd_mach_avr5},
+ {"atmega32u6", AVR_ISA_AVR5, bfd_mach_avr5},
{"at90usb646", AVR_ISA_AVR5, bfd_mach_avr5},
{"at90usb647", AVR_ISA_AVR5, bfd_mach_avr5},
{"at94k", AVR_ISA_94K, bfd_mach_avr5},
--- gas/doc/c-avr.texi.orig 2008-08-29 10:58:02.000000000 -0600
+++ gas/doc/c-avr.texi 2008-11-04 13:20:43.724525000 -0700
@@ -67,7 +67,7 @@ atmega323, atmega324p, atmega325, atmega
atmega328p, atmega329, atmega329p, atmega3290, atmega3290p, atmega406, atmega64,
atmega640, atmega644, atmega644p, atmega645, atmega6450, atmega649, atmega6490,
atmega16hva, at90can32, at90can64, at90pwm216, at90pwm316, atmega16u4,
-atmega32c1, atmega32m1, atmega32u4, at90usb646, at90usb647, at94k).
+atmega32c1, atmega32m1, atmega32u4, atmega32u6, at90usb646, at90usb647, at94k).
Instruction set avr51 is for the enhanced AVR core with exactly 128K program
memory space (MCU types: atmega128, atmega1280, atmega1281, atmega1284p,

View file

@ -0,0 +1,12 @@
--- libiberty/Makefile.in.orig Mon Sep 26 22:55:10 2005
+++ libiberty/Makefile.in Wed Mar 22 22:13:44 2006
@@ -275,7 +275,8 @@
@MAINT@ echo stamp > stamp-functions
INSTALL_DEST = @INSTALL_DEST@
-install: install_to_$(INSTALL_DEST) install-subdir
+#install: install_to_$(INSTALL_DEST) install-subdir
+install:
install_to_libdir: all
${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)

View file

@ -0,0 +1,22 @@
--- configure.ac 2007-05-30 07:48:07.000000000 -0600
+++ configure.ac 2007-07-29 08:33:39.642875000 -0600
@@ -504,7 +504,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
;;
avr-*-*)
- noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
+ noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj} target-libssp"
;;
bfin-*-*)
noconfigdirs="$noconfigdirs gdb"
--- configure 2007-06-20 17:07:21.000000000 -0600
+++ configure 2007-07-29 08:32:35.080375000 -0600
@@ -1344,7 +1344,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
;;
avr-*-*)
- noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
+ noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj} target-libssp"
;;
bfin-*-*)
noconfigdirs="$noconfigdirs gdb"

View file

@ -0,0 +1,12 @@
--- configure.orig 2008-05-25 13:31:15 +0000
+++ configure 2008-05-25 14:06:39 +0000
@@ -2063,9 +2063,6 @@
else
ENABLE_LIBADA=yes
fi;
-if test "${ENABLE_LIBADA}" != "yes" ; then
- noconfigdirs="$noconfigdirs gnattools"
-fi
# Check whether --enable-libssp or --disable-libssp was given.
if test "${enable_libssp+set}" = set; then

View file

@ -0,0 +1,32 @@
Index: cuintp.c
===================================================================
--- gcc/ada/cuintp.c (revision 133957)
+++ gcc/ada/cuintp.c (working copy)
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2008, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -101,11 +101,15 @@ UI_To_gnu (Uint Input, tree type)
large as an integer not to overflow. REAL types are always fine, but
INTEGER or ENUMERAL types we are handed may be too short. We use a
base integer type node for the computations in this case and will
- convert the final result back to the incoming type later on. */
+ convert the final result back to the incoming type later on.
+ The base integer precision must be superior than 16. */
if (TREE_CODE (comp_type) != REAL_TYPE
- && TYPE_PRECISION (comp_type) < TYPE_PRECISION (integer_type_node))
- comp_type = integer_type_node;
+ && TYPE_PRECISION (comp_type) < TYPE_PRECISION (long_integer_type_node))
+ {
+ comp_type = long_integer_type_node;
+ gcc_assert (TYPE_PRECISION (comp_type) > 16);
+ }
gnu_base = build_cst_from_int (comp_type, Base);

View file

@ -0,0 +1,323 @@
Index: gcc/config/avr/avr.md
===================================================================
--- gcc/config/avr/avr.md (revision 129892)
+++ gcc/config/avr/avr.md (working copy)
@@ -45,21 +45,22 @@
(REG_SP 32)
(TMP_REGNO 0) ; temporary register r0
(ZERO_REGNO 1) ; zero register r1
(SREG_ADDR 0x5F)
(RAMPZ_ADDR 0x5B)
(UNSPEC_STRLEN 0)
(UNSPEC_INDEX_JMP 1)
(UNSPEC_SEI 2)
(UNSPEC_CLI 3)
+ (UNSPEC_SWAP 4)
(UNSPECV_PROLOGUE_SAVES 0)
(UNSPECV_EPILOGUE_RESTORES 1)])
(include "predicates.md")
(include "constraints.md")
;; Condition code settings.
(define_attr "cc" "none,set_czn,set_zn,set_n,compare,clobber"
(const_string "none"))
@@ -1185,20 +1186,33 @@
return (AS2 (andi, %A0,lo8(%2)) CR_TAB
AS2 (andi, %B0,hi8(%2)) CR_TAB
AS2 (andi, %C0,hlo8(%2)) CR_TAB
AS2 (andi, %D0,hhi8(%2)));
}
return \"bug\";
}"
[(set_attr "length" "4,4")
(set_attr "cc" "set_n,set_n")])
+(define_peephole2 ; andi
+ [(set (match_operand:QI 0 "d_register_operand" "")
+ (and:QI (match_dup 0)
+ (match_operand:QI 1 "const_int_operand" "")))
+ (set (match_dup 0)
+ (and:QI (match_dup 0)
+ (match_operand:QI 2 "const_int_operand" "")))]
+ ""
+ [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))]
+ {
+ operands[1] = GEN_INT (INTVAL (operands[1]) & INTVAL (operands[2]));
+ })
+
;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
;; ior
(define_insn "iorqi3"
[(set (match_operand:QI 0 "register_operand" "=r,d")
(ior:QI (match_operand:QI 1 "register_operand" "%0,0")
(match_operand:QI 2 "nonmemory_operand" "r,i")))]
""
"@
or %0,%2
@@ -1313,24 +1327,71 @@
(xor:SI (match_operand:SI 1 "register_operand" "%0")
(match_operand:SI 2 "register_operand" "r")))]
""
"eor %0,%2
eor %B0,%B2
eor %C0,%C2
eor %D0,%D2"
[(set_attr "length" "4")
(set_attr "cc" "set_n")])
+;; swap
+
+(define_insn "*swap"
+ [(set (match_operand:QI 0 "register_operand" "=r")
+ (unspec:QI [(match_operand:QI 1 "register_operand" "0")]
+ UNSPEC_SWAP))]
+ ""
+ "swap %0"
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")])
+
;;<< << << << << << << << << << << << << << << << << << << << << << << << << <<
;; arithmetic shift left
-(define_insn "ashlqi3"
+(define_expand "ashlqi3"
+ [(set (match_operand:QI 0 "register_operand" "")
+ (ashift:QI (match_operand:QI 1 "register_operand" "")
+ (match_operand:QI 2 "general_operand" "")))]
+ ""
+ "")
+
+(define_split ; ashlqi3_const4
+ [(set (match_operand:QI 0 "d_register_operand" "")
+ (ashift:QI (match_operand:QI 1 "d_register_operand" "")
+ (const_int 4)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (and:QI (match_dup 0) (const_int -16)))]
+ "")
+
+(define_split ; ashlqi3_const5
+ [(set (match_operand:QI 0 "d_register_operand" "")
+ (ashift:QI (match_operand:QI 1 "d_register_operand" "")
+ (const_int 5)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (ashift:QI (match_dup 0) (const_int 1)))
+ (set (match_dup 0) (and:QI (match_dup 0) (const_int -32)))]
+ "")
+
+(define_split ; ashlqi3_const6
+ [(set (match_operand:QI 0 "d_register_operand" "")
+ (ashift:QI (match_operand:QI 1 "d_register_operand" "")
+ (const_int 6)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (ashift:QI (match_dup 0) (const_int 2)))
+ (set (match_dup 0) (and:QI (match_dup 0) (const_int -64)))]
+ "")
+
+(define_insn "*ashlqi3"
[(set (match_operand:QI 0 "register_operand" "=r,r,r,r,!d,r,r")
(ashift:QI (match_operand:QI 1 "register_operand" "0,0,0,0,0,0,0")
(match_operand:QI 2 "general_operand" "r,L,P,K,n,n,Qm")))]
""
"* return ashlqi3_out (insn, operands, NULL);"
[(set_attr "length" "5,0,1,2,4,6,9")
(set_attr "cc" "clobber,none,set_czn,set_czn,set_czn,set_czn,clobber")])
(define_insn "ashlhi3"
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r,r")
@@ -1346,20 +1407,61 @@
(ashift:SI (match_operand:SI 1 "register_operand" "0,0,0,r,0,0,0")
(match_operand:QI 2 "general_operand" "r,L,P,O,K,n,Qm")))]
""
"* return ashlsi3_out (insn, operands, NULL);"
[(set_attr "length" "8,0,4,4,8,10,12")
(set_attr "cc" "clobber,none,set_n,clobber,set_n,clobber,clobber")])
;; Optimize if a scratch register from LD_REGS happens to be available.
(define_peephole2
+ [(match_scratch:QI 2 "d")
+ (set (match_operand:QI 0 "l_register_operand" "")
+ (ashift:QI (match_operand:QI 1 "l_register_operand" "")
+ (const_int 4)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 2) (const_int -16))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_dup 2)))
+ (clobber (match_dup 2))]
+ "if (!avr_peep2_scratch_safe (operands[2]))
+ FAIL;")
+
+(define_peephole2
+ [(match_scratch:QI 2 "d")
+ (set (match_operand:QI 0 "l_register_operand" "")
+ (ashift:QI (match_operand:QI 1 "l_register_operand" "")
+ (const_int 5)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (ashift:QI (match_dup 0) (const_int 1)))
+ (set (match_dup 2) (const_int -32))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_dup 2)))
+ (clobber (match_dup 2))]
+ "if (!avr_peep2_scratch_safe (operands[2]))
+ FAIL;")
+
+(define_peephole2
+ [(match_scratch:QI 2 "d")
+ (set (match_operand:QI 0 "l_register_operand" "")
+ (ashift:QI (match_operand:QI 1 "l_register_operand" "")
+ (const_int 6)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (ashift:QI (match_dup 0) (const_int 2)))
+ (set (match_dup 2) (const_int -64))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_dup 2)))
+ (clobber (match_dup 2))]
+ "if (!avr_peep2_scratch_safe (operands[2]))
+ FAIL;")
+
+(define_peephole2
[(match_scratch:QI 3 "d")
(set (match_operand:HI 0 "register_operand" "")
(ashift:HI (match_operand:HI 1 "register_operand" "")
(match_operand:QI 2 "const_int_operand" "")))]
""
[(parallel [(set (match_dup 0) (ashift:HI (match_dup 1) (match_dup 2)))
(clobber (match_dup 3))])]
"if (!avr_peep2_scratch_safe (operands[3]))
FAIL;")
@@ -1464,21 +1566,63 @@
(match_operand:QI 2 "const_int_operand" "L,P,O,n")))
(clobber (match_scratch:QI 3 "=X,X,X,&d"))]
"reload_completed"
"* return ashrsi3_out (insn, operands, NULL);"
[(set_attr "length" "0,4,4,10")
(set_attr "cc" "none,clobber,set_n,clobber")])
;; >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>
;; logical shift right
-(define_insn "lshrqi3"
+(define_expand "lshrqi3"
+ [(set (match_operand:QI 0 "register_operand" "")
+ (lshiftrt:QI (match_operand:QI 1 "register_operand" "")
+ (match_operand:QI 2 "general_operand" "")))]
+ ""
+ "")
+
+(define_insn_and_split "*lshrqi3_const4"
+ [(set (match_operand:QI 0 "d_register_operand" "=d")
+ (lshiftrt:QI (match_operand:QI 1 "d_register_operand" "0")
+ (const_int 4)))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (and:QI (match_dup 0) (const_int 15)))]
+ "")
+
+(define_insn_and_split "*lshrqi3_const5"
+ [(set (match_operand:QI 0 "d_register_operand" "=d")
+ (lshiftrt:QI (match_operand:QI 1 "d_register_operand" "0")
+ (const_int 5)))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (lshiftrt:QI (match_dup 0) (const_int 1)))
+ (set (match_dup 0) (and:QI (match_dup 0) (const_int 7)))]
+ "")
+
+(define_insn_and_split "*lshrqi3_const6"
+ [(set (match_operand:QI 0 "d_register_operand" "=d")
+ (lshiftrt:QI (match_operand:QI 1 "d_register_operand" "0")
+ (const_int 6)))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (lshiftrt:QI (match_dup 0) (const_int 2)))
+ (set (match_dup 0) (and:QI (match_dup 0) (const_int 3)))]
+ "")
+
+(define_insn "*lshrqi3"
[(set (match_operand:QI 0 "register_operand" "=r,r,r,r,!d,r,r")
(lshiftrt:QI (match_operand:QI 1 "register_operand" "0,0,0,0,0,0,0")
(match_operand:QI 2 "general_operand" "r,L,P,K,n,n,Qm")))]
""
"* return lshrqi3_out (insn, operands, NULL);"
[(set_attr "length" "5,0,1,2,4,6,9")
(set_attr "cc" "clobber,none,set_czn,set_czn,set_czn,set_czn,clobber")])
(define_insn "lshrhi3"
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r,r")
@@ -1494,20 +1638,61 @@
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0,0,r,0,0,0")
(match_operand:QI 2 "general_operand" "r,L,P,O,K,n,Qm")))]
""
"* return lshrsi3_out (insn, operands, NULL);"
[(set_attr "length" "8,0,4,4,8,10,12")
(set_attr "cc" "clobber,none,clobber,clobber,clobber,clobber,clobber")])
;; Optimize if a scratch register from LD_REGS happens to be available.
(define_peephole2
+ [(match_scratch:QI 2 "d")
+ (set (match_operand:QI 0 "l_register_operand" "")
+ (lshiftrt:QI (match_operand:QI 1 "l_register_operand" "")
+ (const_int 4)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 2) (const_int 15))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_dup 2)))
+ (clobber (match_dup 2))]
+ "if (!avr_peep2_scratch_safe (operands[2]))
+ FAIL;")
+
+(define_peephole2
+ [(match_scratch:QI 2 "d")
+ (set (match_operand:QI 0 "l_register_operand" "")
+ (lshiftrt:QI (match_operand:QI 1 "l_register_operand" "")
+ (const_int 5)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (lshiftrt:QI (match_dup 0) (const_int 1)))
+ (set (match_dup 2) (const_int 7))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_dup 2)))
+ (clobber (match_dup 2))]
+ "if (!avr_peep2_scratch_safe (operands[2]))
+ FAIL;")
+
+(define_peephole2
+ [(match_scratch:QI 2 "d")
+ (set (match_operand:QI 0 "l_register_operand" "")
+ (lshiftrt:QI (match_operand:QI 1 "l_register_operand" "")
+ (const_int 6)))]
+ ""
+ [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
+ (set (match_dup 0) (lshiftrt:QI (match_dup 0) (const_int 2)))
+ (set (match_dup 2) (const_int 3))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_dup 2)))
+ (clobber (match_dup 2))]
+ "if (!avr_peep2_scratch_safe (operands[2]))
+ FAIL;")
+
+(define_peephole2
[(match_scratch:QI 3 "d")
(set (match_operand:HI 0 "register_operand" "")
(lshiftrt:HI (match_operand:HI 1 "register_operand" "")
(match_operand:QI 2 "const_int_operand" "")))]
""
[(parallel [(set (match_dup 0) (lshiftrt:HI (match_dup 1) (match_dup 2)))
(clobber (match_dup 3))])]
"if (!avr_peep2_scratch_safe (operands[3]))
FAIL;")

View file

@ -0,0 +1,47 @@
2008-09-10 Andy Hutchinson <hutchinsonandy@aim.com>
* config/avr/avr.c (legitimate_address_p): Fix problem where subreg
is not recognized as a valid register usage. Allow REG_X to be used
as a base pointer.
* config/avr/avr.h (LEGITIMIZE_RELOAD_ADDRESS): Remove code that
forces a reload when using a base register.
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 140164)
+++ gcc/config/avr/avr.c (working copy)
@@ -1089,6 +1089,8 @@
true_regnum (XEXP (x, 0)));
debug_rtx (x);
}
+ if (!strict && GET_CODE (x) == SUBREG)
+ x = SUBREG_REG (x);
if (REG_P (x) && (strict ? REG_OK_FOR_BASE_STRICT_P (x)
: REG_OK_FOR_BASE_NOSTRICT_P (x)))
r = POINTER_REGS;
@@ -1103,6 +1105,7 @@
if (fit)
{
if (! strict
+ || REGNO (XEXP (x,0)) == REG_X
|| REGNO (XEXP (x,0)) == REG_Y
|| REGNO (XEXP (x,0)) == REG_Z)
r = BASE_POINTER_REGS;
Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h (revision 140164)
+++ gcc/config/avr/avr.h (working copy)
@@ -483,10 +483,6 @@
OPNUM, TYPE); \
goto WIN; \
} \
- push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
- BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
- OPNUM, TYPE); \
- goto WIN; \
} \
else if (! (frame_pointer_needed && XEXP (X,0) == frame_pointer_rtx)) \
{ \

View file

@ -0,0 +1,65 @@
Patch to fix GCC bug #35013.
Index: avr-protos.h
===================================================================
--- gcc/config/avr/avr-protos.h (revision 132369)
+++ gcc/config/avr/avr-protos.h (working copy)
@@ -111,6 +111,7 @@
extern int _reg_unused_after (rtx insn, rtx reg);
extern int avr_jump_mode (rtx x, rtx insn);
extern int byte_immediate_operand (rtx op, enum machine_mode mode);
+extern int text_segment_operand (rtx op, enum machine_mode mode);
extern int test_hard_reg_class (enum reg_class class, rtx x);
extern int jump_over_one_insn_p (rtx insn, rtx dest);
Index: avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 132366)
+++ gcc/config/avr/avr.c (working copy)
@@ -1116,8 +1116,7 @@
default:
if (CONSTANT_ADDRESS_P (addr)
- && ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (addr))
- || GET_CODE (addr) == LABEL_REF))
+ && text_segment_operand (addr, VOIDmode))
{
fprintf (file, "pm(");
output_addr_const (file,addr);
@@ -1428,6 +1427,26 @@
&& INTVAL (op) <= 0xff && INTVAL (op) >= 0);
}
+/* Return true if OP is a program memory reference.*/
+int
+text_segment_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+ switch (GET_CODE (op))
+ {
+ case LABEL_REF :
+ return true;
+ case SYMBOL_REF :
+ return SYMBOL_REF_FUNCTION_P (op);
+ case PLUS :
+ /* Assume canonical format of symbol + constant.
+ Fall through. */
+ case CONST :
+ return text_segment_operand (XEXP (op, 0), VOIDmode);
+ default :
+ return false;
+ }
+}
+
/* Output all insn addresses and their sizes into the assembly language
output file. This is helpful for debugging whether the length attributes
in the md file are correct.
@@ -4465,8 +4484,7 @@
avr_assemble_integer (rtx x, unsigned int size, int aligned_p)
{
if (size == POINTER_SIZE / BITS_PER_UNIT && aligned_p
- && ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (x))
- || GET_CODE (x) == LABEL_REF))
+ && text_segment_operand (x, VOIDmode) )
{
fputs ("\t.word\tpm(", asm_out_file);
output_addr_const (asm_out_file, x);

View file

@ -0,0 +1,48 @@
Fix for bugs #34210, #35508.
===================================================================
--- libgcc/config.host.orig 2008-01-25 13:49:04.000000000 -0700
+++ libgcc/config.host 2008-03-22 22:04:25.965018200 -0600
@@ -77,6 +77,9 @@ strongarm*-*-*)
arm*-*-*)
cpu_type=arm
;;
+avr-*-*)
+ cpu_type=avr
+ ;;
bfin*-*)
cpu_type=bfin
;;
@@ -243,6 +246,8 @@ arm*-*-kaos*)
avr-*-rtems*)
;;
avr-*-*)
+ # Make HImode functions for AVR
+ tmake_file=${cpu_type}/t-avr
;;
bfin*-elf*)
;;
Index: config/avr/t-avr
===================================================================
--- libgcc/config/avr/t-avr (revision 0)
+++ libgcc/config/avr/t-avr (revision 0)
@@ -0,0 +1,19 @@
+# Extra 16-bit integer functions.
+intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _ffsXX2 _clzXX2 \
+ _ctzXX2 _popcountXX2 _parityXX2
+hiintfuncs16 = $(subst XX,hi,$(intfuncs16))
+siintfuncs16 = $(subst XX,si,$(intfuncs16))
+
+iter-items := $(hiintfuncs16)
+iter-labels := $(siintfuncs16)
+iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16))
+
+
+include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
+libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16))
+
+ifeq ($(enable_shared),yes)
+libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16))
+endif
+
+

View file

@ -0,0 +1,81 @@
Index: gcc/rtl-factoring.c
===================================================================
--- gcc/rtl-factoring.c (revision 132522)
+++ gcc/rtl-factoring.c (working copy)
@@ -551,8 +551,8 @@
df_simulate_artificial_refs_at_end (bb, &live);
/* Propagate until INSN if found. */
- for (x = BB_END (bb); x != insn;)
- df_simulate_one_insn_backwards (bb, insn, &live);
+ for (x = BB_END (bb); x != insn; x = PREV_INSN(x))
+ df_simulate_one_insn_backwards (bb, x, &live);
/* Clear registers live after INSN. */
renumbered_reg_set_to_hard_reg_set (&hlive, &live);
@@ -562,7 +562,7 @@
for (i = 0; i < length;)
{
rtx prev = PREV_INSN (x);
- df_simulate_one_insn_backwards (bb, insn, &live);
+ df_simulate_one_insn_backwards (bb, x, &live);
if (INSN_P (x))
{
@@ -949,6 +949,17 @@
return sym;
}
+/* Splits basic block at the requested insn and rebuilds dataflow. */
+
+static basic_block
+asplit_block(basic_block bb, rtx insn)
+{
+ basic_block next;
+ next = split_block (bb, insn)->dest;
+ df_analyze ();
+ return next;
+}
+
/* Ensures that INSN is the last insn in its block and returns the block label
of the next block. */
@@ -959,7 +970,7 @@
if ((insn == BB_END (bb)) && (bb->next_bb != EXIT_BLOCK_PTR))
return block_label (bb->next_bb);
else
- return block_label (split_block (bb, insn)->dest);
+ return block_label (asplit_block (bb, insn));
}
/* Ensures that the last insns of the best pattern and its matching sequences
@@ -1008,8 +1019,9 @@
/* Emit an indirect jump via the link register after the sequence acting
as the return insn. Also emit a barrier and update the basic block. */
- retjmp = emit_jump_insn_after (gen_indirect_jump (pattern_seqs->link_reg),
- BB_END (bb));
+ if (!find_reg_note (BB_END(bb), REG_NORETURN, NULL))
+ retjmp = emit_jump_insn_after (gen_indirect_jump (pattern_seqs->link_reg),
+ BB_END (bb));
emit_barrier_after (BB_END (bb));
/* Replace all outgoing edges with a new one to the block of RETLABEL. */
@@ -1025,7 +1037,7 @@
for (; i < sb->length; i++)
insn = prev_insn_in_block (insn);
- sb->label = block_label (split_block (bb, insn)->dest);
+ sb->label = block_label (asplit_block (bb, insn));
}
/* Emit an insn saving the return address to the link register before the
@@ -1067,7 +1079,7 @@
/* Delete the insns of the sequence. */
for (i = 0; i < sb->length; i++)
insn = prev_insn_in_block (insn);
- delete_basic_block (split_block (bb, insn)->dest);
+ delete_basic_block (asplit_block (bb, insn));
/* Emit an insn saving the return address to the link register
before the deleted sequence. */

View file

@ -0,0 +1,333 @@
Index: gcc/config/avr/libgcc.S
===================================================================
--- gcc/config/avr/libgcc.S (revision 132252)
+++ gcc/config/avr/libgcc.S (working copy)
@@ -594,7 +594,12 @@
out __SP_H__,r29
out __SREG__,__tmp_reg__
out __SP_L__,r28
+#if defined (__AVR_HAVE_EIJMP_EICALL__)
+ eijmp
+#else
ijmp
+#endif
+
.endfunc
#endif /* defined (L_prologue) */
@@ -674,13 +679,22 @@
lpm __tmp_reg__, Z+
lpm r31, Z
mov r30, __tmp_reg__
+
+#if defined (__AVR_HAVE_EIJMP_EICALL__)
+ eijmp
+#else
ijmp
+#endif
+
#else
lpm
adiw r30, 1
push r0
lpm
push r0
+#if defined (__AVR_HAVE_EIJMP_EICALL__)
+ push __zero_reg__
+#endif
ret
#endif
.endfunc
Index: gcc/config/avr/avr.md
===================================================================
--- gcc/config/avr/avr.md (revision 132252)
+++ gcc/config/avr/avr.md (working copy)
@@ -32,6 +32,7 @@
;; p POST_INC or PRE_DEC address as a pointer (X, Y, Z)
;; r POST_INC or PRE_DEC address as a register (r26, r28, r30)
;; ~ Output 'r' if not AVR_MEGA.
+;; ! Output 'e' if AVR_HAVE_EIJMP_EICALL.
;; UNSPEC usage:
;; 0 Length of a string, see "strlenhi".
@@ -2301,22 +2302,22 @@
"(register_operand (operands[0], HImode) || CONSTANT_P (operands[0]))"
"*{
if (which_alternative==0)
- return \"icall\";
+ return \"%!icall\";
else if (which_alternative==1)
{
if (AVR_HAVE_MOVW)
return (AS2 (movw, r30, %0) CR_TAB
- \"icall\");
+ \"%!icall\");
else
return (AS2 (mov, r30, %A0) CR_TAB
AS2 (mov, r31, %B0) CR_TAB
- \"icall\");
+ \"%!icall\");
}
else if (which_alternative==2)
return AS1(%~call,%c0);
return (AS2 (ldi,r30,lo8(%0)) CR_TAB
AS2 (ldi,r31,hi8(%0)) CR_TAB
- \"icall\");
+ \"%!icall\");
}"
[(set_attr "cc" "clobber,clobber,clobber,clobber")
(set_attr_alternative "length"
@@ -2338,22 +2339,22 @@
"(register_operand (operands[0], VOIDmode) || CONSTANT_P (operands[0]))"
"*{
if (which_alternative==0)
- return \"icall\";
+ return \"%!icall\";
else if (which_alternative==1)
{
if (AVR_HAVE_MOVW)
return (AS2 (movw, r30, %1) CR_TAB
- \"icall\");
+ \"%!icall\");
else
return (AS2 (mov, r30, %A1) CR_TAB
AS2 (mov, r31, %B1) CR_TAB
- \"icall\");
+ \"%!icall\");
}
else if (which_alternative==2)
return AS1(%~call,%c1);
return (AS2 (ldi, r30, lo8(%1)) CR_TAB
AS2 (ldi, r31, hi8(%1)) CR_TAB
- \"icall\");
+ \"%!icall\");
}"
[(set_attr "cc" "clobber,clobber,clobber,clobber")
(set_attr_alternative "length"
@@ -2376,13 +2377,20 @@
; indirect jump
(define_insn "indirect_jump"
[(set (pc) (match_operand:HI 0 "register_operand" "!z,*r"))]
- ""
+ "!AVR_HAVE_EIJMP_EICALL"
"@
ijmp
push %A0\;push %B0\;ret"
[(set_attr "length" "1,3")
(set_attr "cc" "none,none")])
+(define_insn "*indirect_jump_avr6"
+ [(set (pc) (match_operand:HI 0 "register_operand" "z"))]
+ "AVR_HAVE_EIJMP_EICALL"
+ "eijmp"
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")])
+
;; table jump
;; Table made from "rjmp" instructions for <=8K devices.
@@ -2391,7 +2399,7 @@
UNSPEC_INDEX_JMP))
(use (label_ref (match_operand 1 "" "")))
(clobber (match_dup 0))]
- "!AVR_MEGA"
+ "(!AVR_MEGA) && (!AVR_HAVE_EIJMP_EICALL)"
"@
ijmp
push %A0\;push %B0\;ret"
@@ -2420,7 +2428,7 @@
lpm __tmp_reg__,Z+
lpm r31,Z
mov r30,__tmp_reg__
- ijmp"
+ %!ijmp"
[(set_attr "length" "6")
(set_attr "cc" "clobber")])
@@ -2429,7 +2437,7 @@
UNSPEC_INDEX_JMP))
(use (label_ref (match_operand 1 "" "")))
(clobber (match_dup 0))]
- "AVR_MEGA"
+ "AVR_MEGA && !AVR_HAVE_EIJMP_EICALL"
"lsl r30
rol r31
lpm
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 132252)
+++ gcc/config/avr/avr.c (working copy)
@@ -127,7 +127,8 @@
{ 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, 0, 0, "__AVR_ARCH__=51" },
+ { 0, 1, 1, 1, 1, 1, 1, 0, "__AVR_ARCH__=6" }
};
/* These names are used as the index into the avr_arch_types[] table
@@ -144,7 +145,8 @@
ARCH_AVR35,
ARCH_AVR4,
ARCH_AVR5,
- ARCH_AVR51
+ ARCH_AVR51,
+ ARCH_AVR6
};
struct mcu_type_s {
@@ -273,6 +275,10 @@
{ "at90can128", ARCH_AVR51, "__AVR_AT90CAN128__" },
{ "at90usb1286", ARCH_AVR51, "__AVR_AT90USB1286__" },
{ "at90usb1287", ARCH_AVR51, "__AVR_AT90USB1287__" },
+ /* 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__" },
@@ -511,9 +517,10 @@
else
{
int offset = frame_pointer_needed ? 2 : 0;
+ int avr_pc_size = AVR_HAVE_EIJMP_EICALL ? 3 : 2;
offset += avr_regs_to_save (NULL);
- return get_frame_size () + 2 + 1 + offset;
+ return get_frame_size () + (avr_pc_size) + 1 + offset;
}
}
@@ -1119,7 +1126,7 @@
&& ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (addr))
|| GET_CODE (addr) == LABEL_REF))
{
- fprintf (file, "pm(");
+ fprintf (file, "gs(");
output_addr_const (file,addr);
fprintf (file ,")");
}
@@ -1144,6 +1151,11 @@
if (!AVR_MEGA)
fputc ('r', file);
}
+ else if (code == '!')
+ {
+ if (AVR_HAVE_EIJMP_EICALL)
+ fputc ('e', file);
+ }
else if (REG_P (x))
{
if (x == zero_reg_rtx)
@@ -4468,7 +4480,7 @@
&& ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (x))
|| GET_CODE (x) == LABEL_REF))
{
- fputs ("\t.word\tpm(", asm_out_file);
+ fputs ("\t.word\tgs(", asm_out_file);
output_addr_const (asm_out_file, x);
fputs (")\n", asm_out_file);
return true;
@@ -5815,7 +5827,7 @@
{
switch_to_section (progmem_section);
if (AVR_MEGA)
- fprintf (stream, "\t.word pm(.L%d)\n", value);
+ fprintf (stream, "\t.word gs(.L%d)\n", value);
else
fprintf (stream, "\trjmp .L%d\n", value);
}
Index: gcc/config/avr/t-avr
===================================================================
--- gcc/config/avr/t-avr (revision 132252)
+++ gcc/config/avr/t-avr (working copy)
@@ -37,8 +37,8 @@
FPBIT = fp-bit.c
-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51
-MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51
+MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6
+MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6
# The many avr2 matches are not listed here - this is the default.
MULTILIB_MATCHES = \
@@ -123,7 +123,9 @@
mmcu?avr51=mmcu?atmega1284p \
mmcu?avr51=mmcu?at90can128 \
mmcu?avr51=mmcu?at90usb1286 \
- mmcu?avr51=mmcu?at90usb1287
+ mmcu?avr51=mmcu?at90usb1287 \
+ mmcu?avr6=mmcu?atmega2560 \
+ mmcu?avr6=mmcu?atmega2561
MULTILIB_EXCEPTIONS =
Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h (revision 132252)
+++ gcc/config/avr/avr.h (working copy)
@@ -80,6 +80,12 @@
builtin_define ("__AVR_MEGA__"); \
if (avr_current_arch->have_jmp_call) \
builtin_define ("__AVR_HAVE_JMP_CALL__"); \
+ if (!avr_current_arch->have_eijmp_eicall) \
+ builtin_define ("__AVR_2_BYTE_PC__"); \
+ if (avr_current_arch->have_eijmp_eicall) \
+ builtin_define ("__AVR_3_BYTE_PC__"); \
+ if (avr_current_arch->have_eijmp_eicall) \
+ builtin_define ("__AVR_HAVE_EIJMP_EICALL__"); \
if (TARGET_NO_INTERRUPTS) \
builtin_define ("__NO_INTERRUPTS__"); \
} \
@@ -100,9 +106,10 @@
#define AVR_HAVE_MOVW (avr_have_movw_lpmx_p)
#define AVR_HAVE_LPMX (avr_have_movw_lpmx_p)
#define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm)
+#define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
-#define AVR_2_BYTE_PC 1
-#define AVR_3_BYTE_PC 0
+#define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
+#define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
#define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
@@ -671,7 +678,7 @@
#define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~')
+#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~' || (CODE) == '!')
#define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
@@ -828,6 +835,7 @@
mmcu=at90usb64*|\
mmcu=at90usb128*|\
mmcu=at94k: -m avr5}\
+%{mmcu=atmega256*:-m avr6}\
%{mmcu=atmega324*|\
mmcu=atmega325*|\
mmcu=atmega328p|\
@@ -856,7 +864,8 @@
mmcu=at90usb*: -Tdata 0x800100}\
%{mmcu=atmega640|\
mmcu=atmega1280|\
- mmcu=atmega1281: -Tdata 0x800200} "
+ mmcu=atmega1281|\
+ mmcu=atmega256*: -Tdata 0x800200} "
#define LIB_SPEC \
"%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
@@ -968,6 +977,8 @@
%{mmcu=atmega1280:crtm1280.o%s} \
%{mmcu=atmega1281:crtm1281.o%s} \
%{mmcu=atmega1284p:crtm1284p.o%s} \
+%{mmcu=atmega2560:crtm2560.o%s} \
+%{mmcu=atmega2561:crtm2561.o%s} \
%{mmcu=at90can128:crtcan128.o%s} \
%{mmcu=at90usb1286:crtusb1286.o%s} \
%{mmcu=at90usb1287:crtusb1287.o%s}"

View file

@ -0,0 +1,36 @@
2008-05-26 Tristan Gingold <gingold@adacore.com>
Anatoly Sokolov <aesok@post.ru>
* config/avr/avr.md ("call_prologue_saves"): Use hi8(gs())/lo8(gs())
instead of pm_lo8/pm_hi8 to makes this call working on avr6.
* config/avr/avr.c (expand_prologue): Tune "call_prologue"
optimization for 'avr6' architecture.
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 135845)
+++ gcc/config/avr/avr.c (working copy)
@@ -682,7 +694,9 @@
/* Prevent any attempt to delete the setting of ZERO_REG! */
emit_insn (gen_rtx_USE (VOIDmode, zero_reg_rtx));
}
- if (minimize && (frame_pointer_needed || live_seq > 6))
+ if (minimize && (frame_pointer_needed
+ || (AVR_2_BYTE_PC && live_seq > 6)
+ || live_seq > 7))
{
insn = emit_move_insn (gen_rtx_REG (HImode, REG_X),
gen_int_mode (size, HImode));
--- gcc/config/avr/avr.md.orig Wed Aug 20 16:55:20 2008
+++ gcc/config/avr/avr.md Wed Aug 20 16:59:52 2008
@@ -2764,8 +2764,8 @@
(use (reg:HI REG_X))
(clobber (reg:HI REG_Z))]
""
- "ldi r30,pm_lo8(1f)
- ldi r31,pm_hi8(1f)
+ "ldi r30,lo8(gs(1f))
+ ldi r31,hi8(gs(1f))
%~jmp __prologue_saves__+((18 - %0) * 2)
1:"
[(set_attr_alternative "length"

View file

@ -0,0 +1,733 @@
--- gcc/config/avr/avr.c.orig 2008-06-08 10:24:28.171355800 -0600
+++ gcc/config/avr/avr.c 2008-06-08 10:29:42.276013800 -0600
@@ -51,6 +51,7 @@
static int avr_naked_function_p (tree);
static int interrupt_function_p (tree);
static int signal_function_p (tree);
+static int nmi_function_p (tree);
static int avr_OS_task_function_p (tree);
static int avr_regs_to_save (HARD_REG_SET *);
static int sequent_regs_live (void);
@@ -118,17 +119,24 @@ int avr_asm_only_p = 0;
int avr_have_movw_lpmx_p = 0;
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" }
+ { 1, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, /* Unknown device specified. */
+ { 1, 0, 0, 0, 0, 0, 0, 0, 0, "__AVR_ARCH__=1" },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, "__AVR_ARCH__=2" },
+ { 0, 0, 0, 1, 0, 0, 0, 0, 0, "__AVR_ARCH__=25" },
+ { 0, 0, 1, 0, 0, 0, 0, 0, 0, "__AVR_ARCH__=3" },
+ { 0, 0, 1, 0, 1, 0, 0, 0, 0, "__AVR_ARCH__=31" },
+ { 0, 0, 1, 1, 0, 0, 0, 0, 0, "__AVR_ARCH__=35" },
+ { 0, 1, 0, 1, 0, 0, 0, 0, 0, "__AVR_ARCH__=4" },
+ { 0, 1, 1, 1, 0, 0, 0, 0, 0, "__AVR_ARCH__=5" },
+ { 0, 1, 1, 1, 1, 1, 0, 0, 0, "__AVR_ARCH__=51" },
+ { 0, 1, 1, 1, 1, 1, 1, 0, 0, "__AVR_ARCH__=6" },
+ { 0, 1, 0, 1, 0, 0, 0, 1, 0, "__AVR_ARCH__=101" },
+ { 0, 1, 1, 1, 0, 0, 0, 1, 0, "__AVR_ARCH__=102" },
+ { 0, 1, 1, 1, 0, 0, 0, 1, 1, "__AVR_ARCH__=103" },
+ { 0, 1, 1, 1, 1, 1, 0, 1, 0, "__AVR_ARCH__=104" },
+ { 0, 1, 1, 1, 1, 1, 0, 1, 1, "__AVR_ARCH__=105" },
+ { 0, 1, 1, 1, 1, 1, 1, 1, 0, "__AVR_ARCH__=106" },
+ { 0, 1, 1, 1, 1, 1, 1, 1, 1, "__AVR_ARCH__=107" }
};
/* These names are used as the index into the avr_arch_types[] table
@@ -146,7 +154,14 @@ enum avr_arch
ARCH_AVR4,
ARCH_AVR5,
ARCH_AVR51,
- ARCH_AVR6
+ ARCH_AVR6,
+ ARCH_AVRXMEGA1,
+ ARCH_AVRXMEGA2,
+ ARCH_AVRXMEGA3,
+ ARCH_AVRXMEGA4,
+ ARCH_AVRXMEGA5,
+ ARCH_AVRXMEGA6,
+ ARCH_AVRXMEGA7
};
struct mcu_type_s {
@@ -279,6 +294,18 @@ static const struct mcu_type_s avr_mcu_t
{ "avr6", ARCH_AVR6, NULL },
{ "atmega2560", ARCH_AVR6, "__AVR_ATmega2560__" },
{ "atmega2561", ARCH_AVR6, "__AVR_ATmega2561__" },
+ /* Enhanced, == 256K. */
+ /* Xmega, <= 8K FLASH. */
+ /* Xmega, > 8K, <= 64K FLASH, <= 64K RAM. */
+ /* Xmega, > 8K, <= 64K FLASH, > 64K RAM. */
+ /* Xmega, > 64K, <= 128K FLASH, <= 64K RAM. */
+ /* Xmega, > 64K, <= 128K FLASH, > 64K RAM. */
+ { "avrxmega5", ARCH_AVRXMEGA5, NULL },
+ { "atxmega64a1", ARCH_AVRXMEGA5, "__AVR_ATxmega64A1__" },
+ /* Xmega, > 128K, <= 256K FLASH, <= 64K RAM. */
+ /* Xmega, > 128K, <= 256K FLASH, > 64K RAM. */
+ { "avrxmega7", ARCH_AVRXMEGA7, NULL },
+ { "atxmega128a1", ARCH_AVRXMEGA7, "__AVR_ATxmega128A1__" },
/* Assembler only. */
{ "avr1", ARCH_AVR1, NULL },
{ "at90s1200", ARCH_AVR1, "__AVR_AT90S1200__" },
@@ -452,6 +479,21 @@ signal_function_p (tree func)
return a != NULL_TREE;
}
+/* Return nonzero if FUNC is a nmi function as specified
+ by the "nmi" attribute. */
+
+static int
+nmi_function_p (tree func)
+{
+ tree a;
+
+ if (TREE_CODE (func) != FUNCTION_DECL)
+ return 0;
+
+ a = lookup_attribute ("nmi", DECL_ATTRIBUTES (func));
+ return a != NULL_TREE;
+}
+
/* Return nonzero if FUNC is a OS_task function. */
static int
@@ -611,6 +653,7 @@ expand_prologue (void)
cfun->machine->is_naked = avr_naked_function_p (current_function_decl);
cfun->machine->is_interrupt = interrupt_function_p (current_function_decl);
cfun->machine->is_signal = signal_function_p (current_function_decl);
+ cfun->machine->is_nmi = nmi_function_p (current_function_decl);
cfun->machine->is_OS_task = avr_OS_task_function_p (current_function_decl);
/* Prologue: naked. */
@@ -646,7 +689,7 @@ expand_prologue (void)
/* Push SREG. */
insn = emit_move_insn (tmp_reg_rtx,
- gen_rtx_MEM (QImode, GEN_INT (SREG_ADDR)));
+ gen_rtx_MEM (QImode, GEN_INT (AVR_SREG_ADDR)));
RTX_FRAME_RELATED_P (insn) = 1;
insn = emit_move_insn (pushbyte, tmp_reg_rtx);
RTX_FRAME_RELATED_P (insn) = 1;
@@ -656,7 +699,7 @@ expand_prologue (void)
&& (TEST_HARD_REG_BIT (set, REG_Z) && TEST_HARD_REG_BIT (set, REG_Z + 1)))
{
insn = emit_move_insn (tmp_reg_rtx,
- gen_rtx_MEM (QImode, GEN_INT (RAMPZ_ADDR)));
+ gen_rtx_MEM (QImode, GEN_INT (AVR_RAMPZ_ADDR)));
RTX_FRAME_RELATED_P (insn) = 1;
insn = emit_move_insn (pushbyte, tmp_reg_rtx);
RTX_FRAME_RELATED_P (insn) = 1;
@@ -929,14 +972,14 @@ expand_epilogue (void)
&& (TEST_HARD_REG_BIT (set, REG_Z) && TEST_HARD_REG_BIT (set, REG_Z + 1)))
{
emit_insn (gen_popqi (tmp_reg_rtx));
- emit_move_insn (gen_rtx_MEM(QImode, GEN_INT(RAMPZ_ADDR)),
+ emit_move_insn (gen_rtx_MEM(QImode, GEN_INT(AVR_RAMPZ_ADDR)),
tmp_reg_rtx);
}
/* Restore SREG using tmp reg as scratch. */
emit_insn (gen_popqi (tmp_reg_rtx));
- emit_move_insn (gen_rtx_MEM(QImode, GEN_INT(SREG_ADDR)),
+ emit_move_insn (gen_rtx_MEM(QImode, GEN_INT(AVR_SREG_ADDR)),
tmp_reg_rtx);
/* Restore tmp REG. */
@@ -1705,8 +1748,9 @@ output_movhi (rtx insn, rtx operands[],
}
/* Use simple load of stack pointer if no interrupts are used
or inside main or signal function prologue where they disabled. */
- else if (TARGET_NO_INTERRUPTS
- || (reload_completed
+ else if (TARGET_NO_INTERRUPTS
+ || (!AVR_XMEGA
+ && reload_completed
&& cfun->machine->is_signal
&& prologue_epilogue_contains (insn)))
{
@@ -1715,7 +1759,8 @@ output_movhi (rtx insn, rtx operands[],
AS2 (out,__SP_L__,%A1));
}
/* In interrupt prolog we know interrupts are enabled. */
- else if (reload_completed
+ else if (!AVR_XMEGA
+ && reload_completed
&& cfun->machine->is_interrupt
&& prologue_epilogue_contains (insn))
{
@@ -1725,12 +1770,25 @@ output_movhi (rtx insn, rtx operands[],
"sei" CR_TAB
AS2 (out,__SP_L__,%A1));
}
- *l = 5;
- return (AS2 (in,__tmp_reg__,__SREG__) CR_TAB
- "cli" CR_TAB
- AS2 (out,__SP_H__,%B1) CR_TAB
- AS2 (out,__SREG__,__tmp_reg__) CR_TAB
- AS2 (out,__SP_L__,%A1));
+ if(AVR_XMEGA)
+ {
+ *l = 6;
+ return (AS2 (mov,__tmp_reg__,r24) CR_TAB
+ AS2 (ldi,r24,0xD8) CR_TAB
+ AS2 (out,__CCP__,r24) CR_TAB
+ AS2 (out,__SP_H__,%B1) CR_TAB
+ AS2 (out,__SP_L__,%A1) CR_TAB
+ AS2 (mov,r24,__tmp_reg__));
+ }
+ else
+ {
+ *l = 5;
+ return (AS2 (in,__tmp_reg__,__SREG__) CR_TAB
+ "cli" CR_TAB
+ AS2 (out,__SP_H__,%B1) CR_TAB
+ AS2 (out,__SREG__,__tmp_reg__) CR_TAB
+ AS2 (out,__SP_L__,%A1));
+ }
}
else if (test_hard_reg_class (STACK_REG, src))
{
@@ -1865,7 +1923,7 @@ out_movqi_r_mr (rtx insn, rtx op[], int
if (CONSTANT_ADDRESS_P (x))
{
- if (CONST_INT_P (x) && INTVAL (x) == SREG_ADDR)
+ if (CONST_INT_P (x) && INTVAL (x) == AVR_SREG_ADDR)
{
*l = 1;
return AS2 (in,%0,__SREG__);
@@ -1873,7 +1931,8 @@ out_movqi_r_mr (rtx insn, rtx op[], int
if (avr_io_address_p (x, 1))
{
*l = 1;
- return AS2 (in,%0,%1-0x20);
+ op[2] = GEN_INT(AVR_IO_OFFSET);
+ return AS2 (in,%0,%1-%2);
}
*l = 2;
return AS2 (lds,%0,%1);
@@ -2061,8 +2120,9 @@ out_movhi_r_mr (rtx insn, rtx op[], int
if (avr_io_address_p (base, 2))
{
*l = 2;
- return (AS2 (in,%A0,%A1-0x20) CR_TAB
- AS2 (in,%B0,%B1-0x20));
+ op[2] = GEN_INT(AVR_IO_OFFSET);
+ return (AS2 (in,%A0,%A1-%2) CR_TAB
+ AS2 (in,%B0,%B1-%2));
}
*l = 4;
return (AS2 (lds,%A0,%A1) CR_TAB
@@ -2553,7 +2613,7 @@ out_movqi_mr_r (rtx insn, rtx op[], int
if (CONSTANT_ADDRESS_P (x))
{
- if (CONST_INT_P (x) && INTVAL (x) == SREG_ADDR)
+ if (CONST_INT_P (x) && INTVAL (x) == AVR_SREG_ADDR)
{
*l = 1;
return AS2 (out,__SREG__,%1);
@@ -2561,7 +2621,8 @@ out_movqi_mr_r (rtx insn, rtx op[], int
if (avr_io_address_p (x, 1))
{
*l = 1;
- return AS2 (out,%0-0x20,%1);
+ op[2] = GEN_INT(AVR_IO_OFFSET);
+ return AS2 (out,%0-%2,%1);
}
*l = 2;
return AS2 (sts,%0,%1);
@@ -2640,11 +2701,20 @@ out_movhi_mr_r (rtx insn, rtx op[], int
if (avr_io_address_p (base, 2))
{
*l = 2;
- return (AS2 (out,%B0-0x20,%B1) CR_TAB
- AS2 (out,%A0-0x20,%A1));
+ op[2] = GEN_INT(AVR_IO_OFFSET);
+ if (AVR_XMEGA)
+ return (AS2 (out,%A0-%2,%B1) CR_TAB
+ AS2 (out,%B0-%2,%A1));
+ else
+ return (AS2 (out,%B0-%2,%B1) CR_TAB
+ AS2 (out,%A0-%2,%A1));
}
- return *l = 4, (AS2 (sts,%B0,%B1) CR_TAB
- AS2 (sts,%A0,%A1));
+ if (AVR_XMEGA)
+ return *l = 4, (AS2 (sts,%A0,%A1) CR_TAB
+ AS2 (sts,%B0,%B1));
+ else
+ return *l = 4, (AS2 (sts,%B0,%B1) CR_TAB
+ AS2 (sts,%A0,%A1));
}
if (reg_base > 0)
{
@@ -2659,11 +2729,20 @@ out_movhi_mr_r (rtx insn, rtx op[], int
AS2 (adiw,r26,1) CR_TAB
AS2 (st,X,__tmp_reg__));
else
- return *l=5, (AS2 (mov,__tmp_reg__,r27) CR_TAB
- AS2 (adiw,r26,1) CR_TAB
- AS2 (st,X,__tmp_reg__) CR_TAB
- AS2 (sbiw,r26,1) CR_TAB
- AS2 (st,X,r26));
+ {
+ if (!AVR_XMEGA)
+ return *l=5, (AS2 (mov,__tmp_reg__,r27) CR_TAB
+ AS2 (adiw,r26,1) CR_TAB
+ AS2 (st,X,__tmp_reg__) CR_TAB
+ AS2 (sbiw,r26,1) CR_TAB
+ AS2 (st,X,r26));
+ else
+ return *l=5, (AS2 (mov,__tmp_reg__,r27) CR_TAB
+ AS2 (st,X,r26) CR_TAB
+ AS2 (adiw,r26,1) CR_TAB
+ AS2 (st,X,__tmp_reg__) CR_TAB
+ AS2 (sbiw,r26,1));
+ }
}
else
{
@@ -2671,14 +2750,27 @@ out_movhi_mr_r (rtx insn, rtx op[], int
return *l=2, (AS2 (st,X+,%A1) CR_TAB
AS2 (st,X,%B1));
else
- return *l=3, (AS2 (adiw,r26,1) CR_TAB
- AS2 (st,X,%B1) CR_TAB
- AS2 (st,-X,%A1));
+ {
+ if (!AVR_XMEGA)
+ return *l=3, (AS2 (adiw,r26,1) CR_TAB
+ AS2 (st,X,%B1) CR_TAB
+ AS2 (st,-X,%A1));
+ else
+ return *l=3, (AS2 (st,X+,%A1) CR_TAB
+ AS2 (st,X,%B1) CR_TAB
+ AS2 (sbiw,r26,1));
+ }
}
}
else
- return *l=2, (AS2 (std,%0+1,%B1) CR_TAB
- AS2 (st,%0,%A1));
+ {
+ if (!AVR_XMEGA)
+ return *l=2, (AS2 (std,%0+1,%B1) CR_TAB
+ AS2 (st,%0,%A1));
+ else
+ return *l=2, (AS2 (st,%0,%A1) CR_TAB
+ AS2 (std,%0+1,%B1));
+ }
}
else if (GET_CODE (base) == PLUS)
{
@@ -2689,48 +2781,104 @@ out_movhi_mr_r (rtx insn, rtx op[], int
if (reg_base != REG_Y)
fatal_insn ("incorrect insn:",insn);
- if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
- return *l = 4, (AS2 (adiw,r28,%o0-62) CR_TAB
- AS2 (std,Y+63,%B1) CR_TAB
- AS2 (std,Y+62,%A1) CR_TAB
- AS2 (sbiw,r28,%o0-62));
-
- return *l = 6, (AS2 (subi,r28,lo8(-%o0)) CR_TAB
- AS2 (sbci,r29,hi8(-%o0)) CR_TAB
- AS2 (std,Y+1,%B1) CR_TAB
- AS2 (st,Y,%A1) CR_TAB
- AS2 (subi,r28,lo8(%o0)) CR_TAB
- AS2 (sbci,r29,hi8(%o0)));
+ if (!AVR_XMEGA)
+ {
+ if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+ return *l = 4, (AS2 (adiw,r28,%o0-62) CR_TAB
+ AS2 (std,Y+63,%B1) CR_TAB
+ AS2 (std,Y+62,%A1) CR_TAB
+ AS2 (sbiw,r28,%o0-62));
+
+ return *l = 6, (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+ AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+ AS2 (std,Y+1,%B1) CR_TAB
+ AS2 (st,Y,%A1) CR_TAB
+ AS2 (subi,r28,lo8(%o0)) CR_TAB
+ AS2 (sbci,r29,hi8(%o0)));
+ }
+ else
+ {
+ if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+ return *l = 4, (AS2 (adiw,r28,%o0-62) CR_TAB
+ AS2 (std,Y+62,%A1) CR_TAB
+ AS2 (std,Y+63,%B1) CR_TAB
+ AS2 (sbiw,r28,%o0-62));
+
+ return *l = 6, (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+ AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+ AS2 (st,Y,%A1) CR_TAB
+ AS2 (std,Y+1,%B1) CR_TAB
+ AS2 (subi,r28,lo8(%o0)) CR_TAB
+ AS2 (sbci,r29,hi8(%o0)));
+ }
}
if (reg_base == REG_X)
{
/* (X + d) = R */
if (reg_src == REG_X)
{
- *l = 7;
- return (AS2 (mov,__tmp_reg__,r26) CR_TAB
- AS2 (mov,__zero_reg__,r27) CR_TAB
- AS2 (adiw,r26,%o0+1) CR_TAB
- AS2 (st,X,__zero_reg__) CR_TAB
- AS2 (st,-X,__tmp_reg__) CR_TAB
- AS1 (clr,__zero_reg__) CR_TAB
+ if (!AVR_XMEGA)
+ {
+ *l = 7;
+ return (AS2 (mov,__tmp_reg__,r26) CR_TAB
+ AS2 (mov,__zero_reg__,r27) CR_TAB
+ AS2 (adiw,r26,%o0+1) CR_TAB
+ AS2 (st,X,__zero_reg__) CR_TAB
+ AS2 (st,-X,__tmp_reg__) CR_TAB
+ AS1 (clr,__zero_reg__) CR_TAB
+ AS2 (sbiw,r26,%o0));
+ }
+ else
+ {
+ *l = 7;
+ return (AS2 (mov,__tmp_reg__,r26) CR_TAB
+ AS2 (mov,__zero_reg__,r27) CR_TAB
+ AS2 (adiw,r26,%o0) CR_TAB
+ AS2 (st,X+,__tmp_reg__) CR_TAB
+ AS2 (st,X,__zero_reg__) CR_TAB
+ AS1 (clr,__zero_reg__) CR_TAB
+ AS2 (sbiw,r26,%o0+1));
+ }
+ }
+ if (!AVR_XMEGA)
+ {
+ *l = 4;
+ return (AS2 (adiw,r26,%o0+1) CR_TAB
+ AS2 (st,X,%B1) CR_TAB
+ AS2 (st,-X,%A1) CR_TAB
AS2 (sbiw,r26,%o0));
}
- *l = 4;
- return (AS2 (adiw,r26,%o0+1) CR_TAB
- AS2 (st,X,%B1) CR_TAB
- AS2 (st,-X,%A1) CR_TAB
- AS2 (sbiw,r26,%o0));
+ else
+ {
+ *l = 4;
+ return (AS2 (adiw,r26,%o0) CR_TAB
+ AS2 (st,X+,%A1) CR_TAB
+ AS2 (st,X,%B1) CR_TAB
+ AS2 (sbiw,r26,%o0+1));
+ }
}
- return *l=2, (AS2 (std,%B0,%B1) CR_TAB
- AS2 (std,%A0,%A1));
+
+ if (!AVR_XMEGA)
+ return *l=2, (AS2 (std,%B0,%B1) CR_TAB
+ AS2 (std,%A0,%A1));
+ else
+ return *l=2, (AS2 (std,%A0,%A1) CR_TAB
+ AS2 (std,%B0,%B1));
}
else if (GET_CODE (base) == PRE_DEC) /* (--R) */
- return *l=2, (AS2 (st,%0,%B1) CR_TAB
- AS2 (st,%0,%A1));
+ {
+ if (mem_volatile_p && AVR_XMEGA)
+ return *l = 4, (AS2 (sbiw,%r0,1) CR_TAB
+ AS2 (st,%p0+,%A1) CR_TAB
+ AS2 (st,%p0,%B1) CR_TAB
+ AS2 (sbiw,%r0,2));
+ else
+ return *l=2, (AS2 (st,%0,%B1) CR_TAB
+ AS2 (st,%0,%A1));
+ }
else if (GET_CODE (base) == POST_INC) /* (R++) */
{
- if (mem_volatile_p)
+ if (mem_volatile_p && !AVR_XMEGA)
{
if (REGNO (XEXP (base, 0)) == REG_X)
{
@@ -2751,7 +2899,7 @@ out_movhi_mr_r (rtx insn, rtx op[], int
*l = 2;
return (AS2 (st,%0,%A1) CR_TAB
- AS2 (st,%0,%B1));
+ AS2 (st,%0,%B1));
}
fatal_insn ("unknown move insn:",insn);
return "";
@@ -4631,6 +4779,7 @@ const struct attribute_spec avr_attribut
{ "progmem", 0, 0, false, false, false, avr_handle_progmem_attribute },
{ "signal", 0, 0, true, false, false, avr_handle_fndecl_attribute },
{ "interrupt", 0, 0, true, false, false, avr_handle_fndecl_attribute },
+ { "nmi", 0, 0, true, false, false, avr_handle_fndecl_attribute },
{ "naked", 0, 0, false, true, true, avr_handle_fntype_attribute },
{ "OS_task", 0, 0, false, true, true, avr_handle_fntype_attribute },
{ NULL, 0, 0, false, false, false, NULL }
@@ -4719,6 +4868,14 @@ avr_handle_fndecl_attribute (tree *node,
func_name);
}
}
+ else if (strncmp (attr, "nmi", strlen ("nmi")) == 0)
+ {
+ if (strncmp (func_name, "__vector", strlen ("__vector")) != 0)
+ {
+ warning (0, "%qs appears to be a misspelled nmi handler",
+ func_name);
+ }
+ }
}
return NULL_TREE;
@@ -4844,7 +5001,8 @@ avr_file_start (void)
/* fprintf (asm_out_file, "\t.arch %s\n", avr_mcu_name);*/
fputs ("__SREG__ = 0x3f\n"
"__SP_H__ = 0x3e\n"
- "__SP_L__ = 0x3d\n", asm_out_file);
+ "__SP_L__ = 0x3d\n"
+ "__CCP__ = 0x34\n", asm_out_file);
fputs ("__tmp_reg__ = 0\n"
"__zero_reg__ = 1\n", asm_out_file);
@@ -5708,15 +5866,18 @@ avr_hard_regno_mode_ok (int regno, enum
return !(regno & 1);
}
-/* Returns 1 if X is a valid address for an I/O register of size SIZE
- (1 or 2). Used for lds/sts -> in/out optimization. Add 0x20 to SIZE
- to check for the lower half of I/O space (for cbi/sbi/sbic/sbis). */
+/* Returns 1 if X is a valid address for an I/O register of size SIZE
+ (1 or 2). Used for lds/sts -> in/out optimization. */
int
avr_io_address_p (rtx x, int size)
{
- return (optimize > 0 && GET_CODE (x) == CONST_INT
- && INTVAL (x) >= 0x20 && INTVAL (x) <= 0x60 - size);
+ if(AVR_XMEGA)
+ return (optimize > 0 && GET_CODE (x) == CONST_INT
+ && INTVAL (x) >= 0 && INTVAL (x) <= 0x40 - size);
+ else
+ return (optimize > 0 && GET_CODE (x) == CONST_INT
+ && INTVAL (x) >= 0x20 && INTVAL (x) <= 0x60 - size);
}
const char *
@@ -5877,16 +6038,17 @@ avr_out_sbxx_branch (rtx insn, rtx opera
if (GET_CODE (operands[1]) == CONST_INT)
{
- if (INTVAL (operands[1]) < 0x40)
+ operands[4] = GEN_INT(AVR_IO_OFFSET); /* operands[3] is for the jump */
+ if (low_io_address_operand (operands[1], VOIDmode))
{
if (comp == EQ)
- output_asm_insn (AS2 (sbis,%1-0x20,%2), operands);
+ output_asm_insn (AS2 (sbis,%1-%4,%2), operands);
else
- output_asm_insn (AS2 (sbic,%1-0x20,%2), operands);
+ output_asm_insn (AS2 (sbic,%1-%4,%2), operands);
}
else
{
- output_asm_insn (AS2 (in,__tmp_reg__,%1-0x20), operands);
+ output_asm_insn (AS2 (in,__tmp_reg__,%1-%4), operands);
if (comp == EQ)
output_asm_insn (AS2 (sbrs,__tmp_reg__,%2), operands);
else
--- gcc/config/avr/avr.h.orig 2008-06-08 10:24:28.186941800 -0600
+++ gcc/config/avr/avr.h 2008-06-08 10:28:40.274905800 -0600
@@ -44,8 +44,11 @@ struct base_arch_s {
/* Core have 'EICALL' and 'EIJMP' instructions. */
int have_eijmp_eicall;
- /* Reserved. */
- int reserved;
+ /* Core is in Xmega family. */
+ int xmega;
+
+ /* Core have RAMPX, RAMPY and RAMPD registers. */
+ int have_rampx_y_d;
const char *const macro;
};
@@ -68,6 +71,13 @@ extern const struct base_arch_s *avr_cur
builtin_define ("__AVR_HAVE_ELPMX__"); \
if (avr_have_movw_lpmx_p) \
builtin_define ("__AVR_HAVE_MOVW__"); \
+ if (avr_current_arch->have_elpm) \
+ { \
+ builtin_define ("__AVR_HAVE_RAMPZ__");\
+ builtin_define ("__AVR_HAVE_ELPM__"); \
+ } \
+ if (avr_current_arch->have_elpmx) \
+ builtin_define ("__AVR_HAVE_ELPMX__"); \
if (avr_have_movw_lpmx_p) \
builtin_define ("__AVR_HAVE_LPMX__"); \
if (avr_asm_only_p) \
@@ -88,6 +98,17 @@ extern const struct base_arch_s *avr_cur
builtin_define ("__AVR_HAVE_EIJMP_EICALL__"); \
if (TARGET_NO_INTERRUPTS) \
builtin_define ("__NO_INTERRUPTS__"); \
+ if (avr_current_arch->xmega) \
+ { \
+ builtin_define ("__AVR_XMEGA__"); \
+ builtin_define ("__AVR_HAVE_SPMX__"); \
+ } \
+ if (avr_current_arch->have_rampx_y_d) \
+ { \
+ builtin_define ("__AVR_HAVE_RAMPX__");\
+ builtin_define ("__AVR_HAVE_RAMPY__");\
+ builtin_define ("__AVR_HAVE_RAMPD__");\
+ } \
} \
while (0)
@@ -107,10 +128,15 @@ extern GTY(()) section *progmem_section;
#define AVR_HAVE_LPMX (avr_have_movw_lpmx_p)
#define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm)
#define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
+#define AVR_XMEGA (avr_current_arch->xmega)
#define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
#define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
+#define AVR_IO_OFFSET (AVR_XMEGA ? 0 : 0x20)
+#define AVR_RAMPZ_ADDR (AVR_XMEGA ? 0x3B : 0x5B)
+#define AVR_SREG_ADDR (AVR_XMEGA ? 0x3F: 0x5F)
+
#define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
#define OVERRIDE_OPTIONS avr_override_options ()
@@ -849,6 +875,8 @@ mmcu=*:-mmcu=%*}"
mmcu=at90usb128*|\
mmcu=at94k: -m avr5}\
%{mmcu=atmega256*:-m avr6}\
+%{mmcu=atxmega64a1:-m avrxmega5} \
+%{mmcu=atxmega128a1:-m avrxmega7} \
%{mmcu=atmega324*|\
mmcu=atmega325*|\
mmcu=atmega328p|\
@@ -994,7 +1022,9 @@ mmcu=*:-mmcu=%*}"
%{mmcu=atmega2561:crtm2561.o%s} \
%{mmcu=at90can128:crtcan128.o%s} \
%{mmcu=at90usb1286:crtusb1286.o%s} \
-%{mmcu=at90usb1287:crtusb1287.o%s}"
+%{mmcu=at90usb1287:crtusb1287.o%s} \
+%{mmcu=atxmega5|mmcu=atxmega64a1:crtx64a1.o%s} \
+%{mmcu=atxmega7|mmcu=atxmega128a1:crtx128a1.o%s}"
#define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
@@ -1050,8 +1080,12 @@ struct machine_function GTY(())
/* 'true' - if current function is a signal function
as specified by the "signal" attribute. */
int is_signal;
-
+
/* 'true' - if current function is a signal function
+ as specified by the "nmi" attribute. */
+ int is_nmi;
+
+ /* 'true' - if current function is a task function
as specified by the "OS_task" attribute. */
int is_OS_task;
};
--- gcc/config/avr/avr.md.orig 2008-06-08 10:24:28.171355800 -0600
+++ gcc/config/avr/avr.md 2008-06-08 10:29:58.610141800 -0600
@@ -47,9 +47,6 @@
(TMP_REGNO 0) ; temporary register r0
(ZERO_REGNO 1) ; zero register r1
- (SREG_ADDR 0x5F)
- (RAMPZ_ADDR 0x5B)
-
(UNSPEC_STRLEN 0)
(UNSPEC_INDEX_JMP 1)
(UNSPEC_SEI 2)
@@ -2681,7 +2678,8 @@
"(optimize > 0)"
{
operands[2] = GEN_INT (exact_log2 (~INTVAL (operands[1]) & 0xff));
- return AS2 (cbi,%0-0x20,%2);
+ operands[3] = GEN_INT(AVR_IO_OFFSET);
+ return AS2 (cbi,%0-%3,%2);
}
[(set_attr "length" "1")
(set_attr "cc" "none")])
@@ -2693,7 +2691,8 @@
"(optimize > 0)"
{
operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1]) & 0xff));
- return AS2 (sbi,%0-0x20,%2);
+ operands[3] = GEN_INT(AVR_IO_OFFSET);
+ return AS2 (sbi,%0-%3,%2);
}
[(set_attr "length" "1")
(set_attr "cc" "none")])
Index: gcc/config/avr/predicates.md
===================================================================
--- gcc/config/avr/predicates.md (revision 132445)
+++ gcc/config/avr/predicates.md (working copy)
@@ -45,12 +45,16 @@
;; Return true if OP is a valid address for lower half of I/O space.
(define_predicate "low_io_address_operand"
(and (match_code "const_int")
- (match_test "IN_RANGE((INTVAL (op)), 0x20, 0x3F)")))
+ (if_then_else (match_test "AVR_XMEGA")
+ (match_test "IN_RANGE((INTVAL (op)), 0x00, 0x1F)")
+ (match_test "IN_RANGE((INTVAL (op)), 0x20, 0x3F)"))))
;; Return true if OP is a valid address for high half of I/O space.
(define_predicate "high_io_address_operand"
(and (match_code "const_int")
- (match_test "IN_RANGE((INTVAL (op)), 0x40, 0x5F)")))
+ (if_then_else (match_test "AVR_XMEGA")
+ (match_test "IN_RANGE((INTVAL (op)), 0x20, 0x3F)")
+ (match_test "IN_RANGE((INTVAL (op)), 0x40, 0x5F)"))))
;; Return 1 if OP is the zero constant for MODE.
(define_predicate "const0_operand"
--- gcc/config/avr/t-avr.orig 2008-02-19 17:25:31.546827500 -0700
+++ gcc/config/avr/t-avr 2008-02-20 09:22:51.709554900 -0700
@@ -37,8 +37,8 @@ fp-bit.c: $(srcdir)/config/fp-bit.c $(sr
FPBIT = fp-bit.c
-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6
-MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6
+MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avrxmega5/mmcu=avrxmega7
+MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega5 avrxmega7
# The many avr2 matches are not listed here - this is the default.
MULTILIB_MATCHES = \
@@ -125,7 +125,9 @@ MULTILIB_MATCHES = \
mmcu?avr51=mmcu?at90usb1286 \
mmcu?avr51=mmcu?at90usb1287 \
mmcu?avr6=mmcu?atmega2560 \
- mmcu?avr6=mmcu?atmega2561
+ mmcu?avr6=mmcu?atmega2561 \
+ mmcu?avrxmega5=mmcu?atxmega64a1 \
+ mmcu?avrxmega7=mmcu?atxmega128a1
MULTILIB_EXCEPTIONS =

View file

@ -0,0 +1,162 @@
--- gcc/config/avr/avr.c.orig 2008-10-29 12:46:40.110056200 -0600
+++ gcc/config/avr/avr.c 2008-10-29 15:38:35.031795900 -0600
@@ -299,10 +299,16 @@ static const struct mcu_type_s avr_mcu_t
/* Xmega, > 8K, <= 64K FLASH, <= 64K RAM. */
/* Xmega, > 8K, <= 64K FLASH, > 64K RAM. */
/* Xmega, > 64K, <= 128K FLASH, <= 64K RAM. */
+ { "avrxmega4", ARCH_AVRXMEGA4, NULL },
+ { "atxmega64a3", ARCH_AVRXMEGA4, "__AVR_ATxmega64A3__" },
/* Xmega, > 64K, <= 128K FLASH, > 64K RAM. */
{ "avrxmega5", ARCH_AVRXMEGA5, NULL },
{ "atxmega64a1", ARCH_AVRXMEGA5, "__AVR_ATxmega64A1__" },
/* Xmega, > 128K, <= 256K FLASH, <= 64K RAM. */
+ { "avrxmega6", ARCH_AVRXMEGA6, NULL },
+ { "atxmega128a3", ARCH_AVRXMEGA6, "__AVR_ATxmega128A3__" },
+ { "atxmega256a3", ARCH_AVRXMEGA6, "__AVR_ATxmega256A3__" },
+ { "atxmega256a3b",ARCH_AVRXMEGA6, "__AVR_ATxmega256A3B__" },
/* Xmega, > 128K, <= 256K FLASH, > 64K RAM. */
{ "avrxmega7", ARCH_AVRXMEGA7, NULL },
{ "atxmega128a1", ARCH_AVRXMEGA7, "__AVR_ATxmega128A1__" },
@@ -694,6 +700,37 @@ expand_prologue (void)
insn = emit_move_insn (pushbyte, tmp_reg_rtx);
RTX_FRAME_RELATED_P (insn) = 1;
+ /* Push RAMPD, RAMPX, RAMPY. */
+ if (AVR_HAVE_RAMPX_Y_D)
+ {
+ /* Push RAMPD. */
+ insn = emit_move_insn (tmp_reg_rtx,
+ gen_rtx_MEM (QImode, GEN_INT (AVR_RAMPD_ADDR)));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ insn = emit_move_insn (pushbyte, tmp_reg_rtx);
+ RTX_FRAME_RELATED_P (insn) = 1;
+
+ /* Push RAMPX. */
+ if (TEST_HARD_REG_BIT (set, REG_X) && TEST_HARD_REG_BIT (set, REG_X + 1))
+ {
+ insn = emit_move_insn (tmp_reg_rtx,
+ gen_rtx_MEM (QImode, GEN_INT (AVR_RAMPX_ADDR)));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ insn = emit_move_insn (pushbyte, tmp_reg_rtx);
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
+
+ /* Push RAMPY. */
+ if (TEST_HARD_REG_BIT (set, REG_Y) && TEST_HARD_REG_BIT (set, REG_Y + 1))
+ {
+ insn = emit_move_insn (tmp_reg_rtx,
+ gen_rtx_MEM (QImode, GEN_INT (AVR_RAMPY_ADDR)));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ insn = emit_move_insn (pushbyte, tmp_reg_rtx);
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
+ }
+
/* Push RAMPZ. */
if(AVR_HAVE_RAMPZ
&& (TEST_HARD_REG_BIT (set, REG_Z) && TEST_HARD_REG_BIT (set, REG_Z + 1)))
@@ -978,6 +1015,31 @@ expand_epilogue (void)
tmp_reg_rtx);
}
+ /* Restore RAMPY, RAMPX, RAMPD using tmp reg as scratch. */
+ if (AVR_HAVE_RAMPX_Y_D)
+ {
+ /* Pop RAMPY. */
+ if (TEST_HARD_REG_BIT (set, REG_Y) && TEST_HARD_REG_BIT (set, REG_Y + 1))
+ {
+ emit_insn (gen_popqi (tmp_reg_rtx));
+ emit_move_insn (gen_rtx_MEM (QImode, GEN_INT (AVR_RAMPY_ADDR)),
+ tmp_reg_rtx);
+ }
+
+ /* Pop RAMPX. */
+ if (TEST_HARD_REG_BIT (set, REG_X) && TEST_HARD_REG_BIT (set, REG_X + 1))
+ {
+ emit_insn (gen_popqi (tmp_reg_rtx));
+ emit_move_insn (gen_rtx_MEM (QImode, GEN_INT (AVR_RAMPX_ADDR)),
+ tmp_reg_rtx);
+ }
+
+ /* Pop RAMPD. */
+ emit_insn (gen_popqi (tmp_reg_rtx));
+ emit_move_insn (gen_rtx_MEM (QImode, GEN_INT (AVR_RAMPD_ADDR)),
+ tmp_reg_rtx);
+ }
+
/* Restore SREG using tmp reg as scratch. */
emit_insn (gen_popqi (tmp_reg_rtx));
--- gcc/config/avr/avr.h.orig 2008-10-29 12:46:40.125681500 -0600
+++ gcc/config/avr/avr.h 2008-10-29 15:37:15.120431900 -0600
@@ -129,11 +129,15 @@ extern GTY(()) section *progmem_section;
#define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm)
#define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
#define AVR_XMEGA (avr_current_arch->xmega)
+#define AVR_HAVE_RAMPX_Y_D (avr_current_arch->have_rampx_y_d)
#define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
#define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
#define AVR_IO_OFFSET (AVR_XMEGA ? 0 : 0x20)
+#define AVR_RAMPD_ADDR (AVR_XMEGA ? 0x38 : 0)
+#define AVR_RAMPX_ADDR (AVR_XMEGA ? 0x39 : 0)
+#define AVR_RAMPY_ADDR (AVR_XMEGA ? 0x3A : 0)
#define AVR_RAMPZ_ADDR (AVR_XMEGA ? 0x3B : 0x5B)
#define AVR_SREG_ADDR (AVR_XMEGA ? 0x3F: 0x5F)
@@ -868,7 +872,10 @@ mmcu=*:-mmcu=%*}"
mmcu=at90usb128*|\
mmcu=at94k: -m avr5}\
%{mmcu=atmega256*:-m avr6}\
+%{mmcu=atxmega64a3:-m avrxmega4} \
%{mmcu=atxmega64a1:-m avrxmega5} \
+%{mmcu=atxmega128a3| \
+ mmcu=atxmega256a3*:-m avrxmega6} \
%{mmcu=atxmega128a1:-m avrxmega7} \
%{mmcu=atmega324*|\
mmcu=atmega325*|\
@@ -1016,7 +1023,11 @@ mmcu=*:-mmcu=%*}"
%{mmcu=at90can128:crtcan128.o%s} \
%{mmcu=at90usb1286:crtusb1286.o%s} \
%{mmcu=at90usb1287:crtusb1287.o%s} \
+%{mmcu=atxmega4|mmcu=atxmega64a3:crtx64a3.o%s} \
%{mmcu=atxmega5|mmcu=atxmega64a1:crtx64a1.o%s} \
+%{mmcu=atxmega6|mmcu=atxmega128a3:crtx128a3.o%s} \
+%{mmcu=atxmega256a3:crtx256a3.o%s} \
+%{mmcu=atxmega256a3b:crtx256a3b.o%s} \
%{mmcu=atxmega7|mmcu=atxmega128a1:crtx128a1.o%s}"
#define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
--- gcc/config/avr/t-avr.orig 2008-10-29 12:46:40.156932100 -0600
+++ gcc/config/avr/t-avr 2008-10-29 14:26:00.176563300 -0600
@@ -37,8 +37,8 @@ fp-bit.c: $(srcdir)/config/fp-bit.c $(sr
FPBIT = fp-bit.c
-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avrxmega5/mmcu=avrxmega7
-MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega5 avrxmega7
+MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avrxmega4/mmcu=avrxmega5/mmcu=avrxmega6/mmcu=avrxmega7
+MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega4 avrxmega5 avrxmega6 avrxmega7
# The many avr2 matches are not listed here - this is the default.
MULTILIB_MATCHES = \
@@ -124,10 +124,14 @@ MULTILIB_MATCHES = \
mmcu?avr51=mmcu?at90can128 \
mmcu?avr51=mmcu?at90usb1286 \
mmcu?avr51=mmcu?at90usb1287 \
- mmcu?avr6=mmcu?atmega2560 \
- mmcu?avr6=mmcu?atmega2561 \
- mmcu?avrxmega5=mmcu?atxmega64a1 \
- mmcu?avrxmega7=mmcu?atxmega128a1
+ mmcu?avr6=mmcu?atmega2560 \
+ mmcu?avr6=mmcu?atmega2561 \
+ mmcu?avrxmega4=mmcu?atxmega64a3 \
+ mmcu?avrxmega5=mmcu?atxmega64a1 \
+ mmcu?avrxmega6=mmcu?atxmega128a3 \
+ mmcu?avrxmega6=mmcu?atxmega256a3 \
+ mmcu?avrxmega6=mmcu?atxmega256a3b \
+ mmcu?avrxmega7=mmcu?atxmega128a1
MULTILIB_EXCEPTIONS =

View file

@ -0,0 +1,46 @@
--- gcc/config/avr/avr.c.old 2008-03-02 13:20:16.906250000 -0700
+++ gcc/config/avr/avr.c 2008-03-02 13:22:31.953125000 -0700
@@ -278,6 +278,7 @@ static const struct mcu_type_s avr_mcu_t
{ "at90can64", ARCH_AVR5, "__AVR_AT90CAN64__" },
{ "at90pwm216", ARCH_AVR5, "__AVR_AT90PWM216__" },
{ "at90pwm316", ARCH_AVR5, "__AVR_AT90PWM316__" },
+ { "atmega32m1", ARCH_AVR5, "__AVR_ATmega32M1__" },
{ "at90usb646", ARCH_AVR5, "__AVR_AT90USB646__" },
{ "at90usb647", ARCH_AVR5, "__AVR_AT90USB647__" },
{ "at94k", ARCH_AVR5, "__AVR_AT94K__" },
--- gcc/config/avr/avr.h.old 2008-03-02 13:20:16.906250000 -0700
+++ gcc/config/avr/avr.h 2008-03-02 13:23:36.593750000 -0700
@@ -869,6 +869,7 @@ mmcu=*:-mmcu=%*}"
mmcu=at90can*|\
mmcu=at90pwm216|\
mmcu=at90pwm316|\
+ mmcu=atmega32m1|\
mmcu=at90usb64*|\
mmcu=at90usb128*|\
mmcu=at94k: -m avr5}\
@@ -900,6 +901,7 @@ mmcu=*:-mmcu=%*}"
mmcu=attiny88|\
mmcu=at90can*|\
mmcu=at90pwm*|\
+ mmcu=atmega32m1|\
mmcu=at90usb*: -Tdata 0x800100}\
%{mmcu=atmega640|\
mmcu=atmega1280|\
@@ -1009,6 +1011,7 @@ mmcu=*:-mmcu=%*}"
%{mmcu=at90can64:crtcan64.o%s} \
%{mmcu=at90pwm216:crt90pwm216.o%s} \
%{mmcu=at90pwm316:crt90pwm316.o%s} \
+%{mmcu=atmega32m1:crtm32m1.o%s} \
%{mmcu=at90usb646:crtusb646.o%s} \
%{mmcu=at90usb647:crtusb647.o%s} \
%{mmcu=at94k:crtat94k.o%s} \
--- gcc/config/avr/t-avr.old 2008-03-02 13:20:16.906250000 -0700
+++ gcc/config/avr/t-avr 2008-03-02 13:21:48.640625000 -0700
@@ -114,6 +114,7 @@ MULTILIB_MATCHES = \
mmcu?avr5=mmcu?at90can64 \
mmcu?avr5=mmcu?at90pwm216 \
mmcu?avr5=mmcu?at90pwm316 \
+ mmcu?avr5=mmcu?atmega32m1 \
mmcu?avr5=mmcu?at90usb646 \
mmcu?avr5=mmcu?at90usb647 \
mmcu?avr5=mmcu?at94k \

View file

@ -0,0 +1,46 @@
--- gcc/config/avr/avr.c.old 2008-03-14 08:14:59.742194500 -0600
+++ gcc/config/avr/avr.c 2008-03-14 08:26:24.509618500 -0600
@@ -279,6 +279,7 @@ static const struct mcu_type_s avr_mcu_t
{ "at90pwm216", ARCH_AVR5, "__AVR_AT90PWM216__" },
{ "at90pwm316", ARCH_AVR5, "__AVR_AT90PWM316__" },
{ "atmega32m1", ARCH_AVR5, "__AVR_ATmega32M1__" },
+ { "atmega32c1", ARCH_AVR5, "__AVR_ATmega32C1__" },
{ "at90usb646", ARCH_AVR5, "__AVR_AT90USB646__" },
{ "at90usb647", ARCH_AVR5, "__AVR_AT90USB647__" },
{ "at94k", ARCH_AVR5, "__AVR_AT94K__" },
--- gcc/config/avr/avr.h.old 2008-03-14 08:14:59.757858500 -0600
+++ gcc/config/avr/avr.h 2008-03-14 08:27:51.946066500 -0600
@@ -869,6 +869,7 @@ mmcu=*:-mmcu=%*}"
mmcu=at90can*|\
mmcu=at90pwm216|\
mmcu=at90pwm316|\
+ mmcu=atmega32c1|\
mmcu=atmega32m1|\
mmcu=at90usb64*|\
mmcu=at90usb128*|\
@@ -901,6 +902,7 @@ mmcu=*:-mmcu=%*}"
mmcu=attiny88|\
mmcu=at90can*|\
mmcu=at90pwm*|\
+ mmcu=atmega32c1|\
mmcu=atmega32m1|\
mmcu=at90usb*: -Tdata 0x800100}\
%{mmcu=atmega640|\
@@ -1011,6 +1013,7 @@ mmcu=*:-mmcu=%*}"
%{mmcu=at90can64:crtcan64.o%s} \
%{mmcu=at90pwm216:crt90pwm216.o%s} \
%{mmcu=at90pwm316:crt90pwm316.o%s} \
+%{mmcu=atmega32c1:crtm32c1.o%s} \
%{mmcu=atmega32m1:crtm32m1.o%s} \
%{mmcu=at90usb646:crtusb646.o%s} \
%{mmcu=at90usb647:crtusb647.o%s} \
--- gcc/config/avr/t-avr.old 2008-03-14 08:14:59.757858500 -0600
+++ gcc/config/avr/t-avr 2008-03-14 08:28:44.169842500 -0600
@@ -114,6 +114,7 @@ MULTILIB_MATCHES = \
mmcu?avr5=mmcu?at90can64 \
mmcu?avr5=mmcu?at90pwm216 \
mmcu?avr5=mmcu?at90pwm316 \
+ mmcu?avr5=mmcu?atmega32c1 \
mmcu?avr5=mmcu?atmega32m1 \
mmcu?avr5=mmcu?at90usb646 \
mmcu?avr5=mmcu?at90usb647 \

View file

@ -0,0 +1,46 @@
--- gcc/config/avr/avr.c.old 2008-03-19 14:34:52.963111900 -0600
+++ gcc/config/avr/avr.c 2008-03-22 07:53:54.900218600 -0600
@@ -281,6 +281,7 @@ static const struct mcu_type_s avr_mcu_t
{ "at90pwm316", ARCH_AVR5, "__AVR_AT90PWM316__" },
{ "atmega32m1", ARCH_AVR5, "__AVR_ATmega32M1__" },
{ "atmega32c1", ARCH_AVR5, "__AVR_ATmega32C1__" },
+ { "atmega32u4", ARCH_AVR5, "__AVR_ATmega32U4__" },
{ "at90usb646", ARCH_AVR5, "__AVR_AT90USB646__" },
{ "at90usb647", ARCH_AVR5, "__AVR_AT90USB647__" },
{ "at94k", ARCH_AVR5, "__AVR_AT94K__" },
--- gcc/config/avr/avr.h.old 2008-03-19 14:34:52.963111900 -0600
+++ gcc/config/avr/avr.h 2008-03-22 07:56:04.463675600 -0600
@@ -871,6 +871,7 @@ mmcu=*:-mmcu=%*}"
mmcu=at90pwm316|\
mmcu=atmega32c1|\
mmcu=atmega32m1|\
+ mmcu=atmega32u4|\
mmcu=at90usb64*|\
mmcu=at90usb128*|\
mmcu=at94k: -m avr5}\
@@ -904,6 +905,7 @@ mmcu=*:-mmcu=%*}"
mmcu=at90pwm*|\
mmcu=atmega32c1|\
mmcu=atmega32m1|\
+ mmcu=atmega32u4|\
mmcu=at90usb*: -Tdata 0x800100}\
%{mmcu=atmega640|\
mmcu=atmega1280|\
@@ -1015,6 +1017,7 @@ mmcu=*:-mmcu=%*}"
%{mmcu=at90pwm316:crt90pwm316.o%s} \
%{mmcu=atmega32c1:crtm32c1.o%s} \
%{mmcu=atmega32m1:crtm32m1.o%s} \
+%{mmcu=atmega32u4:crtm32u4.o%s} \
%{mmcu=at90usb646:crtusb646.o%s} \
%{mmcu=at90usb647:crtusb647.o%s} \
%{mmcu=at94k:crtat94k.o%s} \
--- gcc/config/avr/t-avr.old 2008-03-19 14:34:52.963111900 -0600
+++ gcc/config/avr/t-avr 2008-03-22 08:02:03.137164200 -0600
@@ -116,6 +116,7 @@ MULTILIB_MATCHES = \
mmcu?avr5=mmcu?at90pwm316 \
mmcu?avr5=mmcu?atmega32c1 \
mmcu?avr5=mmcu?atmega32m1 \
+ mmcu?avr5=mmcu?atmega32u4 \
mmcu?avr5=mmcu?at90usb646 \
mmcu?avr5=mmcu?at90usb647 \
mmcu?avr5=mmcu?at94k \

View file

@ -0,0 +1,48 @@
--- gcc/config/avr/avr.c.old 2008-03-24 08:03:54.091795900 -0600
+++ gcc/config/avr/avr.c 2008-03-25 11:35:44.787369000 -0600
@@ -224,6 +224,7 @@ static const struct mcu_type_s avr_mcu_t
{ "avr35", ARCH_AVR35, NULL },
{ "at90usb82", ARCH_AVR35, "__AVR_AT90USB82__" },
{ "at90usb162", ARCH_AVR35, "__AVR_AT90USB162__" },
+ { "attiny167", ARCH_AVR35, "__AVR_ATtiny167__" },
/* Enhanced, <= 8K. */
{ "avr4", ARCH_AVR4, NULL },
{ "atmega8", ARCH_AVR4, "__AVR_ATmega8__" },
--- gcc/config/avr/avr.h.old 2008-03-24 08:03:54.091795900 -0600
+++ gcc/config/avr/avr.h 2008-03-25 12:23:56.468150200 -0600
@@ -853,7 +853,8 @@ mmcu=*:-mmcu=%*}"
mmcu=at43*|\
mmcu=at76*|\
mmcu=at90usb82|\
- mmcu=at90usb162: -m avr3}\
+ mmcu=at90usb162|\
+ mmcu=attiny167: -m avr3}\
%{mmcu=atmega8*|\
mmcu=atmega48*|\
mmcu=at90pwm1|\
@@ -901,6 +902,7 @@ mmcu=*:-mmcu=%*}"
mmcu=atmega32hvb|\
mmcu=attiny48|\
mmcu=attiny88|\
+ mmcu=attiny167|\
mmcu=at90can*|\
mmcu=at90pwm*|\
mmcu=atmega32c1|\
@@ -958,6 +960,7 @@ mmcu=*:-mmcu=%*}"
%{mmcu=attiny43u:crttn43u.o%s} \
%{mmcu=attiny48:crttn48.o%s} \
%{mmcu=attiny88:crttn88.o%s} \
+%{mmcu=attiny167:crttn167.o%s} \
%{mmcu=at43usb320|mmcu=avr3:crt43320.o%s} \
%{mmcu=at43usb355:crt43355.o%s} \
%{mmcu=at76c711:crt76711.o%s} \
--- gcc/config/avr/t-avr.old 2008-03-24 08:03:54.091795900 -0600
+++ gcc/config/avr/t-avr 2008-03-25 12:24:35.371718000 -0600
@@ -63,6 +63,7 @@ MULTILIB_MATCHES = \
mmcu?avr31=mmcu?atmega103 \
mmcu?avr35=mmcu?at90usb82 \
mmcu?avr35=mmcu?at90usb162 \
+ mmcu?avr35=mmcu?attiny167 \
mmcu?avr4=mmcu?atmega48 \
mmcu?avr4=mmcu?atmega48p \
mmcu?avr4=mmcu?atmega8 \

View file

@ -0,0 +1,38 @@
--- gcc/config/avr/avr.c.old 2008-04-02 15:32:52.060936100 -0600
+++ gcc/config/avr/avr.c 2008-04-02 15:41:15.506387300 -0600
@@ -266,7 +266,6 @@ static const struct mcu_type_s avr_mcu_t
{ "atmega329p", ARCH_AVR5, "__AVR_ATmega329P__" },
{ "atmega3290", ARCH_AVR5, "__AVR_ATmega3290__" },
{ "atmega3290p", ARCH_AVR5, "__AVR_ATmega3290P__" },
- { "atmega32hvb", ARCH_AVR5, "__AVR_ATmega32HVB__" },
{ "atmega406", ARCH_AVR5, "__AVR_ATmega406__" },
{ "atmega64", ARCH_AVR5, "__AVR_ATmega64__" },
{ "atmega640", ARCH_AVR5, "__AVR_ATmega640__" },
--- gcc/config/avr/avr.h.old 2008-04-02 15:32:52.060936100 -0600
+++ gcc/config/avr/avr.h 2008-04-02 15:41:38.809251300 -0600
@@ -899,7 +899,6 @@ mmcu=*:-mmcu=%*}"
mmcu=atmega169*|\
mmcu=atmega8hva|\
mmcu=atmega16hva|\
- mmcu=atmega32hvb|\
mmcu=attiny48|\
mmcu=attiny88|\
mmcu=attiny167|\
@@ -1002,7 +1001,6 @@ mmcu=*:-mmcu=%*}"
%{mmcu=atmega329p:crtm329p.o%s} \
%{mmcu=atmega3290:crtm3290.o%s} \
%{mmcu=atmega3290p:crtm3290p.o%s} \
-%{mmcu=atmega32hvb:crtm32hvb.o%s} \
%{mmcu=atmega406:crtm406.o%s} \
%{mmcu=atmega64:crtm64.o%s} \
%{mmcu=atmega640:crtm640.o%s} \
--- gcc/config/avr/t-avr.old 2008-04-02 15:32:51.671301100 -0600
+++ gcc/config/avr/t-avr 2008-04-02 15:41:27.415008100 -0600
@@ -100,7 +100,6 @@ MULTILIB_MATCHES = \
mmcu?avr5=mmcu?atmega329p \
mmcu?avr5=mmcu?atmega3290 \
mmcu?avr5=mmcu?atmega3290p \
- mmcu?avr5=mmcu?atmega32hvb \
mmcu?avr5=mmcu?atmega406 \
mmcu?avr5=mmcu?atmega64 \
mmcu?avr5=mmcu?atmega640 \

View file

@ -0,0 +1,43 @@
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 136946)
+++ gcc/config/avr/avr.c (working copy)
@@ -173,6 +174,7 @@
/* Classic + MOVW, <= 8K. */
{ "avr25", ARCH_AVR25, NULL },
{ "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__" },
--- gcc/config/avr/t-avr.orig Wed Jun 25 18:36:00 2008
+++ gcc/config/avr/t-avr Wed Jun 25 18:39:28 2008
@@ -43,6 +43,7 @@ MULTILIB_DIRNAMES = avr2 avr25 avr3 avr3
# The many avr2 matches are not listed here - this is the default.
MULTILIB_MATCHES = \
mmcu?avr25=mmcu?attiny13 \
+ mmcu?avr25=mmcu?attiny13a \
mmcu?avr25=mmcu?attiny2313 \
mmcu?avr25=mmcu?attiny24 \
mmcu?avr25=mmcu?attiny44 \
Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h (revision 136946)
+++ gcc/config/avr/avr.h (working copy)
@@ -817,7 +817,7 @@
mmcu=at90s8*|\
mmcu=at90c8*|\
mmcu=at86rf401|\
- mmcu=attiny13|\
+ mmcu=attiny13*|\
mmcu=attiny2313|\
mmcu=attiny24|\
mmcu=attiny25|\
@@ -916,6 +916,7 @@
%{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} \

View file

@ -0,0 +1,40 @@
--- gcc/config/avr/avr.c.old 2008-11-04 14:14:27.405669400 -0700
+++ gcc/config/avr/avr.c 2008-11-04 14:14:55.772086800 -0700
@@ -283,6 +283,7 @@ static const struct mcu_type_s avr_mcu_t
{ "atmega32m1", ARCH_AVR5, "__AVR_ATmega32M1__" },
{ "atmega32c1", ARCH_AVR5, "__AVR_ATmega32C1__" },
{ "atmega32u4", ARCH_AVR5, "__AVR_ATmega32U4__" },
+ { "atmega32u6", ARCH_AVR5, "__AVR_ATmega32U6__" },
{ "at90usb646", ARCH_AVR5, "__AVR_AT90USB646__" },
{ "at90usb647", ARCH_AVR5, "__AVR_AT90USB647__" },
{ "at94k", ARCH_AVR5, "__AVR_AT94K__" },
--- gcc/config/avr/avr.h.old 2008-11-04 14:15:07.629280600 -0700
+++ gcc/config/avr/avr.h 2008-11-04 14:16:11.692586600 -0700
@@ -871,7 +871,7 @@ mmcu=*:-mmcu=%*}"
mmcu=at90pwm316|\
mmcu=atmega32c1|\
mmcu=atmega32m1|\
- mmcu=atmega32u4|\
+ mmcu=atmega32u*|\
mmcu=at90usb64*|\
mmcu=at90usb128*|\
mmcu=at94k: -m avr5}\
@@ -908,7 +908,7 @@ mmcu=*:-mmcu=%*}"
mmcu=at90pwm*|\
mmcu=atmega32c1|\
mmcu=atmega32m1|\
- mmcu=atmega32u4|\
+ mmcu=atmega32u*|\
mmcu=at90usb*: -Tdata 0x800100}\
%{mmcu=atmega640|\
mmcu=atmega1280|\
--- gcc/config/avr/t-avr.old 2008-11-04 14:17:13.610006800 -0700
+++ gcc/config/avr/t-avr 2008-11-04 14:17:24.793674400 -0700
@@ -118,6 +118,7 @@ MULTILIB_MATCHES = \
mmcu?avr5=mmcu?atmega32c1 \
mmcu?avr5=mmcu?atmega32m1 \
mmcu?avr5=mmcu?atmega32u4 \
+ mmcu?avr5=mmcu?atmega32u6 \
mmcu?avr5=mmcu?at90usb646 \
mmcu?avr5=mmcu?at90usb647 \
mmcu?avr5=mmcu?at94k \

View file

@ -0,0 +1,195 @@
Not committed
Adds OS_main attribute feature.
Written by Anatoly Sokolov.
Apply patch after XMEGA patch.
--------------------------------------------------------------------------------
Index: gcc/function.c
===================================================================
--- gcc/function.c (revision 133747)
+++ gcc/function.c (working copy)
@@ -4756,6 +4756,14 @@
}
int
+prologue_contains (const_rtx insn)
+{
+ if (contains (insn, &prologue))
+ return 1;
+ return 0;
+}
+
+int
prologue_epilogue_contains (const_rtx insn)
{
if (contains (insn, &prologue))
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h (revision 133747)
+++ gcc/rtl.h (working copy)
@@ -2128,6 +2128,7 @@
/* In function.c */
extern void reposition_prologue_and_epilogue_notes (void);
+extern int prologue_contains (const_rtx);
extern int prologue_epilogue_contains (const_rtx);
extern int sibcall_epilogue_contains (const_rtx);
extern void mark_temp_addr_taken (rtx);
--- gcc/config/avr/avr.h.orig 2008-03-31 16:48:03.477537900 -0600
+++ gcc/config/avr/avr.h 2008-03-31 17:07:51.442457900 -0600
@@ -1095,4 +1095,8 @@ struct machine_function GTY(())
/* 'true' - if current function is a task function
as specified by the "OS_task" attribute. */
int is_OS_task;
+
+ /* 'true' - if current function is a 'main' function
+ as specified by the "OS_main" attribute. */
+ int is_OS_main;
};
--- gcc/config/avr/avr.c.orig Mon Mar 31 19:47:54 2008
+++ gcc/config/avr/avr.c Mon Mar 31 20:50:08 2008
@@ -53,6 +53,7 @@ static int interrupt_function_p (tree);
static int signal_function_p (tree);
static int nmi_function_p (tree);
static int avr_OS_task_function_p (tree);
+static int avr_OS_main_function_p (tree);
static int avr_regs_to_save (HARD_REG_SET *);
static void avr_args (HARD_REG_SET *);
static int sequent_regs_live (HARD_REG_SET *);
@@ -509,6 +513,19 @@ avr_OS_task_function_p (tree func)
return a != NULL_TREE;
}
+/* Return nonzero if FUNC is a OS_main function. */
+
+static int
+avr_OS_main_function_p (tree func)
+{
+ tree a;
+
+ gcc_assert (TREE_CODE (func) == FUNCTION_DECL);
+
+ a = lookup_attribute ("OS_main", TYPE_ATTRIBUTES (TREE_TYPE (func)));
+ return a != NULL_TREE;
+}
+
/* Return the number of hard registers to push/pop in the prologue/epilogue
of the current function, and optionally store these registers in SET. */
@@ -527,9 +544,10 @@ avr_regs_to_save (HARD_REG_SET *set)
count = 0;
/* No need to save any registers if the function never returns or
- is have "OS_task" attribute. */
+ is have "OS_task" or "OS_main" attribute. */
if (TREE_THIS_VOLATILE (current_function_decl)
- || cfun->machine->is_OS_task)
+ || cfun->machine->is_OS_task
+ || cfun->machine->is_OS_main)
return 0;
for (reg = 0; reg < 32; reg++)
@@ -646,6 +664,8 @@ expand_prologue (void)
rtx pushword = gen_rtx_MEM (HImode,
gen_rtx_POST_DEC (HImode, stack_pointer_rtx));
rtx insn;
+ int method1_length;
+ int sp_plus_length;
last_insn_address = 0;
@@ -655,6 +675,7 @@ expand_prologue (void)
cfun->machine->is_signal = signal_function_p (current_function_decl);
cfun->machine->is_nmi = nmi_function_p (current_function_decl);
cfun->machine->is_OS_task = avr_OS_task_function_p (current_function_decl);
+ cfun->machine->is_OS_main = avr_OS_main_function_p (current_function_decl);
/* Prologue: naked. */
if (cfun->machine->is_naked)
@@ -669,6 +690,7 @@ expand_prologue (void)
&& !cfun->machine->is_interrupt
&& !cfun->machine->is_signal
&& !cfun->machine->is_OS_task
+ && !cfun->machine->is_OS_main
&& live_seq);
if (cfun->machine->is_interrupt || cfun->machine->is_signal)
@@ -738,7 +760,7 @@ expand_prologue (void)
}
if (frame_pointer_needed)
{
- if(!cfun->machine->is_OS_task)
+ if (!(cfun->machine->is_OS_task || cfun->machine->is_OS_main))
{
/* Push frame pointer. */
insn = emit_move_insn (pushword, frame_pointer_rtx);
@@ -768,7 +790,7 @@ expand_prologue (void)
if (TARGET_TINY_STACK)
{
if (size < -63 || size > 63)
- warning (0, "large frame pointer change (%d) with -mtiny-stack", size);
+ warning (0, "large frame pointer change (%ld) with -mtiny-stack", size);
/* The high byte (r29) doesn't change - prefer 'subi' (1 cycle)
over 'sbiw' (2 cycles, same size). */
@@ -780,7 +802,6 @@ expand_prologue (void)
myfp = frame_pointer_rtx;
}
/* Calculate length. */
- int method1_length;
method1_length =
get_attr_length (gen_move_insn (frame_pointer_rtx, stack_pointer_rtx));
method1_length +=
@@ -878,6 +899,7 @@ expand_epilogue (void)
HARD_REG_SET set;
int minimize;
HOST_WIDE_INT size = get_frame_size();
+ int sp_plus_length;
/* epilogue: naked */
if (cfun->machine->is_naked)
@@ -893,6 +915,7 @@ expand_epilogue (void)
&& !cfun->machine->is_interrupt
&& !cfun->machine->is_signal
&& !cfun->machine->is_OS_task
+ && !cfun->machine->is_OS_main
&& live_seq);
if (minimize && (frame_pointer_needed || live_seq > 4))
@@ -955,7 +978,7 @@ expand_epilogue (void)
emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
}
}
- if(!cfun->machine->is_OS_task)
+ if (!(cfun->machine->is_OS_task || cfun->machine->is_OS_main))
{
/* Restore previous frame_pointer. */
emit_insn (gen_pophi (frame_pointer_rtx));
@@ -1787,10 +1810,18 @@ output_movhi (rtx insn, rtx operands[],
}
/* Use simple load of stack pointer if no interrupts are used
or inside main or signal function prologue where they disabled. */
- else if (TARGET_NO_INTERRUPTS
+ else if ((!AVR_XMEGA && TARGET_NO_INTERRUPTS)
|| (!AVR_XMEGA
- && reload_completed
+ && reload_completed
&& cfun->machine->is_signal
+ && prologue_epilogue_contains (insn))
+ || (!AVR_XMEGA
+ && reload_completed
+ && cfun->machine->is_OS_main
+ && prologue_contains (insn))
+ || (AVR_XMEGA
+ && reload_completed
+ && cfun->machine->is_nmi
&& prologue_epilogue_contains (insn)))
{
*l = 2;
@@ -4821,6 +4852,7 @@ const struct attribute_spec avr_attribut
{ "nmi", 0, 0, true, false, false, avr_handle_fndecl_attribute },
{ "naked", 0, 0, false, true, true, avr_handle_fntype_attribute },
{ "OS_task", 0, 0, false, true, true, avr_handle_fntype_attribute },
+ { "OS_main", 0, 0, false, true, true, avr_handle_fntype_attribute },
{ NULL, 0, 0, false, false, false, NULL }
};

View file

@ -0,0 +1,175 @@
Index: gcc/ada/mlib-tgt-specific.adb
===================================================================
--- gcc/ada/mlib-tgt-specific.adb.orig Tue Jun 10 22:01:39 2008
+++ gcc/ada/mlib-tgt-specific.adb Tue Jun 10 22:02:33 2008
@@ -3,11 +3,11 @@
-- GNAT COMPILER COMPONENTS --
-- --
-- M L I B . T G T . S P E C I F I C --
--- (Default empty version) --
+-- (AVR Version) --
-- --
-- B o d y --
-- --
--- Copyright (C) 2007, AdaCore --
+-- Copyright (C) 2002-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,14 +24,108 @@
-- --
------------------------------------------------------------------------------
--- Default version
+-- This is the AVR version of the body.
package body MLib.Tgt.Specific is
- -- By default, libraries are not supported at all
+ -- Non default subprograms
+
+ procedure Build_Dynamic_Library
+ (Ofiles : Argument_List;
+ Options : Argument_List;
+ Interfaces : Argument_List;
+ Lib_Filename : String;
+ Lib_Dir : String;
+ Symbol_Data : Symbol_Record;
+ Driver_Name : Name_Id := No_Name;
+ Lib_Version : String := "";
+ Auto_Init : Boolean := False);
+
+ function DLL_Ext return String;
+
+ function Dynamic_Option return String;
+
+ function PIC_Option return String;
+
+ function Library_Major_Minor_Id_Supported return Boolean;
+
+ function Standalone_Library_Auto_Init_Is_Supported return Boolean;
function Support_For_Libraries return Library_Support;
- -- Function indicating if libraries are supported
+
+ ---------------------------
+ -- Build_Dynamic_Library --
+ ---------------------------
+
+ procedure Build_Dynamic_Library
+ (Ofiles : Argument_List;
+ Options : Argument_List;
+ Interfaces : Argument_List;
+ Lib_Filename : String;
+ Lib_Dir : String;
+ Symbol_Data : Symbol_Record;
+ Driver_Name : Name_Id := No_Name;
+ Lib_Version : String := "";
+ Auto_Init : Boolean := False)
+ is
+ pragma Unreferenced (Ofiles);
+ pragma Unreferenced (Options);
+ pragma Unreferenced (Interfaces);
+ pragma Unreferenced (Lib_Filename);
+ pragma Unreferenced (Lib_Dir);
+ pragma Unreferenced (Symbol_Data);
+ pragma Unreferenced (Driver_Name);
+ pragma Unreferenced (Lib_Version);
+ pragma Unreferenced (Auto_Init);
+
+ begin
+ null;
+ end Build_Dynamic_Library;
+
+ -------------
+ -- DLL_Ext --
+ -------------
+
+ function DLL_Ext return String is
+ begin
+ return "";
+ end DLL_Ext;
+
+ --------------------
+ -- Dynamic_Option --
+ --------------------
+
+ function Dynamic_Option return String is
+ begin
+ return "";
+ end Dynamic_Option;
+
+ --------------------------------------
+ -- Library_Major_Minor_Id_Supported --
+ --------------------------------------
+
+ function Library_Major_Minor_Id_Supported return Boolean is
+ begin
+ return False;
+ end Library_Major_Minor_Id_Supported;
+
+ ----------------
+ -- PIC_Option --
+ ----------------
+
+ function PIC_Option return String is
+ begin
+ return "";
+ end PIC_Option;
+
+ -----------------------------------------------
+ -- Standalone_Library_Auto_Init_Is_Supported --
+ -----------------------------------------------
+
+ function Standalone_Library_Auto_Init_Is_Supported return Boolean is
+ begin
+ return False;
+ end Standalone_Library_Auto_Init_Is_Supported;
---------------------------
-- Support_For_Libraries --
@@ -39,9 +133,17 @@
function Support_For_Libraries return Library_Support is
begin
- return None;
+ return Static_Only;
end Support_For_Libraries;
begin
+ Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
+ DLL_Ext_Ptr := DLL_Ext'Access;
+ Dynamic_Option_Ptr := Dynamic_Option'Access;
+ Library_Major_Minor_Id_Supported_Ptr :=
+ Library_Major_Minor_Id_Supported'Access;
+ PIC_Option_Ptr := PIC_Option'Access;
+ Standalone_Library_Auto_Init_Is_Supported_Ptr :=
+ Standalone_Library_Auto_Init_Is_Supported'Access;
Support_For_Libraries_Ptr := Support_For_Libraries'Access;
end MLib.Tgt.Specific;
--- gcc/ada/make.adb.orig Thu Dec 13 10:45:44 2007
+++ gcc/ada/make.adb Tue Jun 10 22:18:35 2008
@@ -5054,6 +5054,11 @@
-- Warn the user, if necessary, so that he is not surprized
-- that specific switches are not taken into account.
+ if Opt.Verbose_Mode then
+ Write_Str ("Init library build (RE1)");
+ Write_Eol;
+ end if;
+
declare
Defaults : constant Variable_Value :=
Prj.Util.Value_Of
@@ -5725,6 +5730,11 @@
(Proj1).Need_To_Build_Lib := False;
end loop;
end;
+
+ if Opt.Verbose_Mode then
+ Write_Str ("build library build (RE2)");
+ Write_Eol;
+ end if;
-- Build the libraries, if any need to be built

View file

@ -0,0 +1,96 @@
Index: gcc/ada/gnatbind.adb
===================================================================
--- gcc/ada/gnatbind.adb
+++ gcc/ada/gnatbind.adb
@@ -346,6 +346,11 @@
then
Add_Lib_Search_Dir (Argv (4 .. Argv'Last));
+ -- -freestanding
+
+ elsif Argv (2 .. Argv'Last) = "freestanding" then
+ Opt.Freestanding := True;
+
-- -nostdlib
elsif Argv (2 .. Argv'Last) = "nostdlib" then
Index: gcc/ada/bindgen.adb
===================================================================
--- gcc/ada/bindgen.adb.orig Thu Dec 13 10:20:52 2007
+++ gcc/ada/bindgen.adb Wed Feb 13 20:47:32 2008
@@ -1480,6 +1480,10 @@
WBI (" procedure Ada_Main_Program;");
end if;
+ if Opt.Freestanding then
+ WBI (" pragma No_Return (Ada_Main_Program);");
+ end if;
+
Set_String (" pragma Import (Ada, Ada_Main_Program, """);
Get_Name_String (Units.Table (First_Unit_Entry).Uname);
Set_Main_Program_Name;
@@ -1506,7 +1510,7 @@
-- with a pragma Volatile in order to tell the compiler to preserve
-- this variable at any level of optimization.
- if Bind_Main_Program then
+ if Bind_Main_Program and then not Opt.Freestanding then
WBI
(" Ensure_Reference : aliased System.Address := " &
"Ada_Main_Program_Name'Address;");
@@ -1570,7 +1574,9 @@
WBI (" " & Ada_Init_Name.all & ";");
if not No_Main_Subprogram then
- WBI (" Break_Start;");
+ if not Opt.Freestanding then
+ WBI (" Break_Start;");
+ end if;
if ALIs.Table (ALIs.First).Main_Program = Proc then
WBI (" Ada_Main_Program;");
@@ -2349,6 +2355,10 @@
end if;
end if;
+ if Opt.Freestanding then
+ WBI (" pragma No_Return (" & Get_Main_Name & ");");
+ end if;
+
WBI (" pragma Export (C, " & Get_Main_Name & ", """ &
Get_Main_Name & """);");
end if;
@@ -2650,7 +2660,7 @@
-- circumstances to a symbol duplication during the link (for instance
-- when a C program uses 2 Ada libraries)
- if Bind_Main_Program then
+ if Bind_Main_Program and then not Opt.Freestanding then
WBI ("");
WBI ("char __gnat_version[] = ""GNAT Version: " &
Gnat_Version_String & """;");
@@ -2933,7 +2943,7 @@
-- Start of processing for Gen_Versions_Ada
begin
- if Bind_For_Library then
+ if Bind_For_Library or else Opt.Freestanding then
-- When building libraries, the version number of each unit can
-- not be computed, since the binder does not know the full list
--- gcc/ada/opt.ads.orig Wed Feb 13 20:14:03 2008
+++ gcc/ada/opt.ads Wed Feb 13 20:16:05 2008
@@ -509,6 +509,13 @@
-- GNATMAKE, GPRMAKE, GPRBUILD
-- Set to force recompilations even when the objects are up-to-date.
+ Freestanding : Boolean := False;
+ -- GNATBIND
+ -- Set to True if no environment exists. This is typically the
+ -- case in embedded systems without an operating system. The main
+ -- program does not read command line parameters nor does it
+ -- return.
+
Full_Path_Name_For_Brief_Errors : Boolean := False;
-- PROJECT MANAGER
-- When True, in Brief_Output mode, each error message line

View file

@ -0,0 +1,63 @@
--- gcc/ada/targparm.ads.orig Wed Dec 19 16:22:26 2007
+++ gcc/ada/targparm.ads Wed Feb 13 20:02:42 2008
@@ -381,9 +381,11 @@
-- allows that standard format to be modified.
Duration_32_Bits_On_Target : Boolean := False;
+ -- Default_Duration_Delta_Microseconds : Pos := 1_000;
-- If True, then Duration is represented in 32 bits and the delta and
- -- small values are set to 20.0*(10**(-3)) (i.e. it is a count in units
- -- of 20 milliseconds.
+ -- and small values are set to Duration_Delta_Microseconds*(10**(-6))
+ -- (i.e. for Duration_Delta_Microseconds = 20000 it is a count in
+ -- units of 20 milliseconds.
------------------------------------
-- Back-End Code Generation Flags --
--- gcc/ada/switch-c.adb.orig Thu Dec 13 10:20:52 2007
+++ gcc/ada/switch-c.adb Wed Feb 13 20:08:37 2008
@@ -345,6 +345,19 @@
return;
+ -- -gnated switch (Duration'Delta)
+
+ when 'd' =>
+ Ptr := Ptr + 1;
+
+ -- Possible '=' sign between -gnated and the value
+ if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
+ Ptr := Ptr + 1;
+ end if;
+
+ Scan_Pos (Switch_Chars, Max, Ptr,
+ Opt.Duration_Delta_Microseconds, C);
+
-- -gnateD switch (preprocessing symbol definition)
when 'D' =>
--- gcc/ada/opt.ads.orig Thu Dec 13 10:22:25 2007
+++ gcc/ada/opt.ads Wed Feb 13 20:14:03 2008
@@ -360,6 +360,10 @@
-- Set to True (by -gnatL) to dump source text intermingled with generated
-- code. Effective only if either of Debug/Print_Generated_Code is true.
+ Duration_Delta_Microseconds : Pos := 1_000;
+ -- GNAT
+ -- set to the time tick on the target
+
Dynamic_Elaboration_Checks : Boolean := False;
-- GNAT
-- Set True for dynamic elaboration checking mode, as set by the -gnatE
--- gcc/ada/cstand.adb.orig Mon Sep 10 12:47:10 2007
+++ gcc/ada/cstand.adb Wed Feb 13 20:02:42 2008
@@ -1209,7 +1209,8 @@
if Duration_32_Bits_On_Target then
Dlo := Intval (Type_Low_Bound (Standard_Integer_32));
Dhi := Intval (Type_High_Bound (Standard_Integer_32));
- Delta_Val := UR_From_Components (UI_From_Int (20), Uint_3, 10);
+ Delta_Val := UR_From_Components
+ (UI_From_Int (Duration_Delta_Microseconds), Uint_6, 10);
-- In standard 64-bit mode, the size is 64-bits and the delta and
-- small values are set to nanoseconds (1.0**(10.0**(-9))

View file

@ -0,0 +1,45 @@
--- gcc/ada/gnat1drv.adb.orig Thu Dec 13 10:27:21 2007
+++ gcc/ada/gnat1drv.adb Wed Feb 13 20:00:03 2008
@@ -246,6 +246,42 @@
("cannot generate representation information, no code generated");
Write_Eol;
Write_Eol;
+ Write_Eol;
+ Write_Str ("Source Search Path:");
+ Write_Eol;
+
+ for J in 1 .. Nb_Dir_In_Src_Search_Path loop
+ Write_Str (" ");
+
+ if Dir_In_Src_Search_Path (J)'Length = 0 then
+ Write_Str ("<Current_Directory>");
+ else
+ Write_Str (To_Host_Dir_Spec
+ (Dir_In_Src_Search_Path (J).all, True).all);
+ end if;
+
+ Write_Eol;
+ end loop;
+
+ Write_Eol;
+ Write_Eol;
+ Write_Str ("Object Search Path:");
+ Write_Eol;
+
+ for J in 1 .. Nb_Dir_In_Obj_Search_Path loop
+ Write_Str (" ");
+
+ if Dir_In_Obj_Search_Path (J)'Length = 0 then
+ Write_Str ("<Current_Directory>");
+ else
+ Write_Str (To_Host_Dir_Spec
+ (Dir_In_Obj_Search_Path (J).all, True).all);
+ end if;
+
+ Write_Eol;
+ end loop;
+
+ Write_Eol;
end if;
end Check_Rep_Info;

View file

@ -0,0 +1,80 @@
Index: gcc/ada/decl.c
===================================================================
--- gcc/ada/decl.c (revision 134945)
+++ gcc/ada/decl.c (working copy)
@@ -122,6 +122,17 @@ static void check_ok_for_atomic (tree, E
static int compatible_signatures_p (tree ftype1, tree ftype2);
static void rest_of_type_decl_compilation_no_defer (tree);
+/* Return true if GNAT_ADDRESS is a compile time known value.
+ In particular catch System'To_Address. */
+
+static bool
+compile_time_known_address_p (Node_Id gnat_address)
+{
+ return ((Nkind (gnat_address) == N_Unchecked_Type_Conversion
+ && Compile_Time_Known_Value (Expression (gnat_address)))
+ || Compile_Time_Known_Value (gnat_address));
+}
+
/* Given GNAT_ENTITY, an entity in the incoming GNAT tree, return a
GCC type corresponding to that entity. GNAT_ENTITY is assumed to
refer to an Ada type. */
@@ -1026,7 +1037,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
= build_reference_type_for_mode (gnu_type, ptr_mode, true);
gnu_address = convert (gnu_type, gnu_address);
used_by_ref = true;
- const_flag = !Is_Public (gnat_entity);
+ const_flag = !Is_Public (gnat_entity)
+ || compile_time_known_address_p (Expression (Address_Clause
+ (gnat_entity)));
/* If we don't have an initializing expression for the underlying
variable, the initializing expression for the pointer is the
@@ -1058,9 +1071,24 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
= build_reference_type_for_mode (gnu_type, ptr_mode, true);
gnu_size = NULL_TREE;
- gnu_expr = NULL_TREE;
/* No point in taking the address of an initializing expression
that isn't going to be used. */
+ gnu_expr = NULL_TREE;
+
+ /* If it has an address clause whose value is known at compile
+ time, make the object a CONST_DECL. This will avoid a
+ useless dereference. */
+ if (Present (Address_Clause (gnat_entity)))
+ {
+ Node_Id gnat_address
+ = Expression (Address_Clause (gnat_entity));
+
+ if (compile_time_known_address_p (gnat_address))
+ {
+ gnu_expr = gnat_to_gnu (gnat_address);
+ const_flag = true;
+ }
+ }
used_by_ref = true;
}
@@ -1258,7 +1286,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
for these. */
if (TREE_CODE (gnu_decl) == CONST_DECL
&& (definition || Sloc (gnat_entity) > Standard_Location)
- && (Is_Public (gnat_entity)
+ && ((Is_Public (gnat_entity)
+ && !Present (Address_Clause (gnat_entity)))
|| optimize == 0
|| Address_Taken (gnat_entity)
|| Is_Aliased (gnat_entity)
@@ -1271,6 +1300,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
gnat_entity);
SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var);
+
+ /* As debugging information will be generated for the variable,
+ do not generate information for the constant. */
+ DECL_IGNORED_P (gnu_decl) = true;
}
/* If this is declared in a block that contains a block with an

View file

@ -0,0 +1,583 @@
Index: gcc/config/avr/predicates.md
===================================================================
--- gcc/config/avr/predicates.md (revision 134489)
+++ gcc/config/avr/predicates.md (working copy)
@@ -27,6 +27,11 @@
(and (match_code "reg")
(match_test "REGNO (op) >= 16 && REGNO (op) <= 31")))
+;; Registers from r16 to 24.
+(define_predicate "a_register_operand"
+ (and (match_code "reg")
+ (match_test "REGNO (op) >= 16 && REGNO (op) <= 24")))
+
(define_predicate "even_register_operand"
(and (match_code "reg")
(and (match_test "REGNO (op) <= 31")
--- gcc/config/avr/avr.md.orig 2008-12-02 12:44:25.418762100 -0700
+++ gcc/config/avr/avr.md 2008-12-02 15:31:40.788948300 -0700
@@ -49,12 +49,26 @@
(UNSPEC_STRLEN 0)
(UNSPEC_INDEX_JMP 1)
- (UNSPEC_SEI 2)
- (UNSPEC_CLI 3)
- (UNSPEC_SWAP 4)
-
+ (UNSPEC_SWAP 2)
+ (UNSPEC_FMUL 3)
+ (UNSPEC_FMULS 4)
+ (UNSPEC_FMULSU 5)
+
(UNSPECV_PROLOGUE_SAVES 0)
- (UNSPECV_EPILOGUE_RESTORES 1)])
+ (UNSPECV_EPILOGUE_RESTORES 1)
+ (UNSPECV_SEI 2)
+ (UNSPECV_CLI 3)
+ (UNSPECV_NOP 4)
+ (UNSPECV_NOP2 5)
+ (UNSPECV_SLEEP 6)
+ (UNSPECV_WDR 7)
+
+ (UNSPECV_DELAY_CYCLES 100)
+ (UNSPECV_DELAY_CYCLES_1 101)
+ (UNSPECV_DELAY_CYCLES_2 102)
+ (UNSPECV_DELAY_CYCLES_3 103)
+ (UNSPECV_DELAY_CYCLES_4 104)])
+
(include "predicates.md")
(include "constraints.md")
@@ -2537,13 +2551,6 @@
(const_int 1))
(const_int 3)])])
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop"
- [(set_attr "cc" "none")
- (set_attr "length" "1")])
-
; indirect jump
(define_insn "indirect_jump"
[(set (pc) (match_operand:HI 0 "register_operand" "!z,*r"))]
@@ -2923,7 +2930,7 @@
;; Enable Interrupts
(define_insn "enable_interrupt"
- [(unspec [(const_int 0)] UNSPEC_SEI)]
+ [(unspec_volatile [(const_int 0)] UNSPECV_SEI)]
""
"sei"
[(set_attr "length" "1")
@@ -2932,7 +2939,7 @@
;; Disable Interrupts
(define_insn "disable_interrupt"
- [(unspec [(const_int 0)] UNSPEC_CLI)]
+ [(unspec_volatile [(const_int 0)] UNSPECV_CLI)]
""
"cli"
[(set_attr "length" "1")
@@ -3032,3 +3039,219 @@
expand_epilogue ();
DONE;
}")
+
+;;delay_cycles_delay_cycles_delay_cycles_delay_cycles_delay_cycles_delay
+;; delay_cycles
+
+(define_expand "delay_cycles"
+ [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i")]
+ UNSPECV_DELAY_CYCLES)]
+ ""
+ "
+ rtx loop_reg;
+ unsigned int cycles = INTVAL (operands[0]);
+ if (IN_RANGE(cycles, 83886082, 0xFFFFFFFF))
+ {
+ unsigned int loop_count = ((cycles - 9) / 6) + 1;
+ unsigned int cycles_used = (((loop_count - 1) * 6) + 9);
+ emit_insn (gen_delay_cycles_4 (gen_int_mode (loop_count, SImode)));
+ cycles -= cycles_used;
+ }
+ if (IN_RANGE(cycles, 262145, 83886081))
+ {
+ unsigned int loop_count = ((cycles - 7) / 5) + 1;
+ if (loop_count > 0xFFFFFF)
+ loop_count = 0xFFFFFF;
+ unsigned int cycles_used = (((loop_count - 1) * 5) + 7);
+ emit_insn (gen_delay_cycles_3 (gen_int_mode (loop_count, SImode)));
+ cycles -= cycles_used;
+ }
+ if (IN_RANGE(cycles, 768, 262144))
+ {
+ unsigned int loop_count = ((cycles - 5) / 4) + 1;
+ if (loop_count > 0xFFFF)
+ loop_count = 0xFFFF;
+ unsigned int cycles_used = (((loop_count - 1) * 4) + 5);
+ emit_insn (gen_delay_cycles_2 (gen_int_mode (loop_count, HImode)));
+ cycles -= cycles_used;
+ }
+ if (IN_RANGE(cycles, 6, 767))
+ {
+ unsigned int loop_count = (cycles/ 3);
+ if (loop_count > 255)
+ loop_count = 255;
+ unsigned int cycles_used = (loop_count * 3);
+ emit_insn (gen_delay_cycles_1 (gen_int_mode (loop_count, QImode)));
+ cycles -= cycles_used;
+ }
+ while (cycles >= 2)
+ {
+ emit_insn (gen_nop2 ());
+ cycles -= 2;
+ }
+ if (cycles == 1)
+ {
+ emit_insn (gen_nop ());
+ cycles--;
+ }
+ DONE;
+ ")
+
+(define_insn "delay_cycles_1"
+[(unspec_volatile [(const_int 0)] UNSPECV_DELAY_CYCLES_1)
+ (match_operand:QI 0 "immediate_operand" "")
+ (clobber (match_scratch:QI 1 "=&d"))]
+ ""
+ " ldi %1,lo8(%0)
+ 1:dec %1
+ brne 1b"
+ [(set_attr "length" "3")
+ (set_attr "cc" "clobber")])
+
+(define_insn "delay_cycles_2"
+ [(unspec_volatile [(const_int 0)] UNSPECV_DELAY_CYCLES_2)
+ (match_operand:HI 0 "immediate_operand" "")
+ (clobber (match_scratch:HI 1 "=&w"))]
+ ""
+ " ldi %A1,lo8(%0)
+ ldi %B1,hi8(%0)
+ 1:sbiw %A1,1
+ brne 1b"
+ [(set_attr "length" "4")
+ (set_attr "cc" "clobber")])
+
+(define_insn "delay_cycles_3"
+ [(unspec_volatile [(const_int 0)] UNSPECV_DELAY_CYCLES_3)
+ (match_operand:SI 0 "immediate_operand" "")
+ (clobber (match_scratch:SI 1 "=&d"))]
+ ""
+ " ldi %A1,lo8(%0)
+ ldi %B1,hi8(%0)
+ ldi %C1,hlo8(%0)
+ 1:subi %A1,1
+ sbci %B1,0
+ sbci %C1,0
+ brne 1b"
+ [(set_attr "length" "7")
+ (set_attr "cc" "clobber")])
+
+(define_insn "delay_cycles_4"
+ [(unspec_volatile [(const_int 0)] UNSPECV_DELAY_CYCLES_4)
+ (match_operand:SI 0 "immediate_operand" "")
+ (clobber (match_scratch:SI 1 "=&d"))]
+ ""
+ " ldi %A1,lo8(%0)
+ ldi %B1,hi8(%0)
+ ldi %C1,hlo8(%0)
+ ldi %D1,hhi8(%0)
+ 1:subi %A1,1
+ sbci %B1,0
+ sbci %C1,0
+ sbci %D1,0
+ brne 1b"
+ [(set_attr "length" "9")
+ (set_attr "cc" "clobber")])
+
+;; CPU instructions
+
+;; NOP
+(define_insn "nop"
+ [(unspec_volatile [(const_int 0)] UNSPECV_NOP)]
+ ""
+ "nop"
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")])
+
+;; NOP2
+(define_insn "nop2"
+ [(unspec_volatile [(const_int 0)] UNSPECV_NOP2)]
+ ""
+ "rjmp ."
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")])
+
+;; SEI, Enable Interrupts
+;(define_insn "sei"
+; [(unspec_volatile [(const_int 0)] UNSPECV_SEI)]
+; ""
+; "sei"
+; [(set_attr "length" "1")
+; (set_attr "cc" "none")
+; ])
+
+;; CLI, Disable Interrupts
+;(define_insn "cli"
+; [(unspec_volatile [(const_int 0)] UNSPECV_CLI)]
+; ""
+; "cli"
+; [(set_attr "length" "1")
+; (set_attr "cc" "none")
+; ])
+
+;; SLEEP
+(define_insn "sleep"
+ [(unspec_volatile [(const_int 0)] UNSPECV_SLEEP)]
+ ""
+ "sleep"
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")
+ ])
+
+;; WDR
+(define_insn "wdr"
+ [(unspec_volatile [(const_int 0)] UNSPECV_WDR)]
+ ""
+ "wdr"
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")
+ ])
+
+;; SWAP
+(define_insn "swap"
+ [(set (match_operand:QI 0 "register_operand" "=r")
+ (unspec:QI [(match_operand:QI 1 "register_operand" "0")]
+ UNSPEC_SWAP))]
+ ""
+ "swap %0"
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")])
+
+;; FMUL
+(define_insn "fmul"
+ [(set (match_operand:HI 0 "a_register_operand" "=r")
+ (unspec:HI [(match_operand:QI 1 "a_register_operand" "r")
+ (match_operand:QI 2 "a_register_operand" "r")]
+ UNSPEC_FMUL))]
+ "AVR_HAVE_MUL"
+ "fmul %1,%2
+ movw %0,r0
+ clr r1"
+ [(set_attr "length" "3")
+ (set_attr "cc" "clobber")])
+
+;; FMULS
+(define_insn "fmuls"
+ [(set (match_operand:HI 0 "a_register_operand" "=r")
+ (unspec:HI [(match_operand:QI 1 "a_register_operand" "r")
+ (match_operand:QI 2 "a_register_operand" "r")]
+ UNSPEC_FMULS))]
+ "AVR_HAVE_MUL"
+ "fmuls %1,%2
+ movw %0,r0
+ clr r1"
+ [(set_attr "length" "3")
+ (set_attr "cc" "clobber")])
+
+;; FMULSU
+(define_insn "fmulsu"
+ [(set (match_operand:HI 0 "a_register_operand" "=r")
+ (unspec:HI [(match_operand:QI 1 "a_register_operand" "r")
+ (match_operand:QI 2 "a_register_operand" "r")]
+ UNSPEC_FMULSU))]
+ "AVR_HAVE_MUL"
+ "fmulsu %1,%2
+ movw %0,r0
+ clr r1"
+ [(set_attr "length" "3")
+ (set_attr "cc" "clobber")])
+
--- gcc/config/avr/avr.c.orig 2008-12-01 10:51:45.062273700 -0700
+++ gcc/config/avr/avr.c 2008-12-01 11:18:33.980387900 -0700
@@ -30,6 +30,7 @@
#include "insn-config.h"
#include "conditions.h"
#include "insn-attr.h"
+#include "insn-codes.h"
#include "flags.h"
#include "reload.h"
#include "tree.h"
@@ -39,7 +40,9 @@
#include "obstack.h"
#include "function.h"
#include "recog.h"
+#include "optabs.h"
#include "ggc.h"
+#include "langhooks.h"
#include "tm_p.h"
#include "target.h"
#include "target-def.h"
@@ -83,6 +86,9 @@ static bool avr_rtx_costs (rtx, int, int
static int avr_address_cost (rtx);
static bool avr_return_in_memory (const_tree, const_tree);
static struct machine_function * avr_init_machine_status (void);
+static void avr_init_builtins (void);
+static rtx avr_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
+
/* Allocate registers from r25 to r8 for parameters for function calls. */
#define FIRST_CUM_REG 26
@@ -373,6 +379,12 @@ int avr_case_values_threshold = 30000;
#undef TARGET_STRICT_ARGUMENT_NAMING
#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
+#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS avr_init_builtins
+
+#undef TARGET_EXPAND_BUILTIN
+#define TARGET_EXPAND_BUILTIN avr_expand_builtin
+
struct gcc_target targetm = TARGET_INITIALIZER;
void
@@ -6258,4 +6270,237 @@ avr_return_in_memory (const_tree type, c
return false;
}
+/* Codes for all the AVR builtins. */
+
+enum avr_builtins
+{
+ AVR_BUILTIN_SEI,
+ AVR_BUILTIN_CLI,
+ AVR_BUILTIN_WDR,
+ AVR_BUILTIN_SLEEP,
+ AVR_BUILTIN_SWAP,
+ AVR_BUILTIN_FMUL,
+ AVR_BUILTIN_FMULS,
+ AVR_BUILTIN_FMULSU,
+ AVR_BUILTIN_DELAY_CYCLES
+};
+
+#define def_builtin(NAME, TYPE, CODE) \
+do { \
+ add_builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \
+ NULL, NULL_TREE); \
+} while (0)
+
+/* Set up all builtin functions for this target. */
+
+static void
+avr_init_builtins (void)
+{
+ tree void_ftype_void
+ = build_function_type (void_type_node, void_list_node);
+ tree uchar_ftype_uchar
+ = build_function_type_list (unsigned_char_type_node,
+ unsigned_char_type_node,
+ NULL_TREE);
+ tree uint_ftype_uchar_uchar
+ = build_function_type_list (unsigned_type_node,
+ unsigned_char_type_node,
+ unsigned_char_type_node,
+ NULL_TREE);
+ tree int_ftype_char_char
+ = build_function_type_list (integer_type_node,
+ char_type_node,
+ char_type_node,
+ NULL_TREE);
+ tree int_ftype_char_uchar
+ = build_function_type_list (integer_type_node,
+ char_type_node,
+ unsigned_char_type_node,
+ NULL_TREE);
+ tree void_ftype_ulong
+ = build_function_type_list (void_type_node,
+ long_unsigned_type_node,
+ NULL_TREE);
+
+ def_builtin ("__builtin_avr_sei", void_ftype_void, AVR_BUILTIN_SEI);
+ def_builtin ("__builtin_avr_cli", void_ftype_void, AVR_BUILTIN_CLI);
+ def_builtin ("__builtin_avr_wdr", void_ftype_void, AVR_BUILTIN_WDR);
+ def_builtin ("__builtin_avr_sleep", void_ftype_void, AVR_BUILTIN_SLEEP);
+
+ if (AVR_HAVE_MUL)
+ {
+ def_builtin ("__builtin_avr_fmul", uint_ftype_uchar_uchar,
+ AVR_BUILTIN_FMUL);
+ def_builtin ("__builtin_avr_fmuls", int_ftype_char_char,
+ AVR_BUILTIN_FMULS);
+ def_builtin ("__builtin_avr_fmulsu", int_ftype_char_uchar,
+ AVR_BUILTIN_FMULSU);
+ }
+
+ def_builtin ("__builtin_avr_swap", uchar_ftype_uchar, AVR_BUILTIN_SWAP);
+ def_builtin ("__builtin_avr_delay_cycles", void_ftype_ulong,
+ AVR_BUILTIN_DELAY_CYCLES);
+}
+
+struct builtin_description
+{
+ const enum insn_code icode;
+ const char *const name;
+ const enum avr_builtins code;
+};
+
+static const struct builtin_description bdesc_1arg[] =
+{
+ { CODE_FOR_swap, "__builtin_avr_swap", AVR_BUILTIN_SWAP }
+};
+
+static const struct builtin_description bdesc_2arg[] =
+{
+ { CODE_FOR_fmul, "__builtin_avr_fmul", AVR_BUILTIN_FMUL },
+ { CODE_FOR_fmuls, "__builtin_avr_fmuls", AVR_BUILTIN_FMULS },
+ { CODE_FOR_fmulsu, "__builtin_avr_fmulsu", AVR_BUILTIN_FMULSU }
+};
+
+/* Subroutine of avr_expand_builtin to take care of unop insns. */
+
+static rtx
+avr_expand_unop_builtin (enum insn_code icode, tree exp,
+ rtx target)
+{
+ rtx pat;
+ tree arg0 = CALL_EXPR_ARG (exp, 0);
+ rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
+ enum machine_mode op0mode = GET_MODE (op0);
+ enum machine_mode tmode = insn_data[icode].operand[0].mode;
+ enum machine_mode mode0 = insn_data[icode].operand[1].mode;
+
+ if (! target
+ || GET_MODE (target) != tmode
+ || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
+ target = gen_reg_rtx (tmode);
+
+ if (op0mode == SImode && mode0 == HImode)
+ {
+ op0mode = HImode;
+ op0 = gen_lowpart (HImode, op0);
+ }
+ gcc_assert (op0mode == mode0 || op0mode == VOIDmode);
+
+ if (! (*insn_data[icode].operand[1].predicate) (op0, mode0))
+ op0 = copy_to_mode_reg (mode0, op0);
+
+ pat = GEN_FCN (icode) (target, op0);
+ if (! pat)
+ return 0;
+ emit_insn (pat);
+ return target;
+}
+
+/* Subroutine of avr_expand_builtin to take care of binop insns. */
+
+static rtx
+avr_expand_binop_builtin (enum insn_code icode, tree exp, rtx target)
+{
+ rtx pat;
+ tree arg0 = CALL_EXPR_ARG (exp, 0);
+ tree arg1 = CALL_EXPR_ARG (exp, 1);
+ rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
+ rtx op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
+ enum machine_mode op0mode = GET_MODE (op0);
+ enum machine_mode op1mode = GET_MODE (op1);
+ enum machine_mode tmode = insn_data[icode].operand[0].mode;
+ enum machine_mode mode0 = insn_data[icode].operand[1].mode;
+ enum machine_mode mode1 = insn_data[icode].operand[2].mode;
+
+ if (! target
+ || GET_MODE (target) != tmode
+ || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
+ target = gen_reg_rtx (tmode);
+
+ if ((op0mode == SImode || op0mode == VOIDmode) && mode0 == HImode)
+ {
+ op0mode = HImode;
+ op0 = gen_lowpart (HImode, op0);
+ }
+ if ((op1mode == SImode || op1mode == VOIDmode) && mode1 == HImode)
+ {
+ op1mode = HImode;
+ op1 = gen_lowpart (HImode, op1);
+ }
+ /* In case the insn wants input operands in modes different from
+ the result, abort. */
+ gcc_assert ((op0mode == mode0 || op0mode == VOIDmode)
+ && (op1mode == mode1 || op1mode == VOIDmode));
+
+ if (! (*insn_data[icode].operand[1].predicate) (op0, mode0))
+ op0 = copy_to_mode_reg (mode0, op0);
+ if (! (*insn_data[icode].operand[2].predicate) (op1, mode1))
+ op1 = copy_to_mode_reg (mode1, op1);
+
+ pat = GEN_FCN (icode) (target, op0, op1);
+ if (! pat)
+ return 0;
+
+ emit_insn (pat);
+ return target;
+}
+
+/* Expand an expression EXP that calls a built-in function,
+ with result going to TARGET if that's convenient
+ (and in mode MODE if that's convenient).
+ SUBTARGET may be used as the target for computing one of EXP's operands.
+ IGNORE is nonzero if the value is to be ignored. */
+
+static rtx
+avr_expand_builtin (tree exp, rtx target,
+ rtx subtarget ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ int ignore ATTRIBUTE_UNUSED)
+{
+ size_t i;
+ const struct builtin_description *d;
+ tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
+ unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
+ rtx pat;
+ tree arg0;
+ rtx op0;
+
+ switch (fcode)
+ {
+ case AVR_BUILTIN_SEI:
+ emit_insn (gen_enable_interrupt ());
+ return 0;
+ case AVR_BUILTIN_CLI:
+ emit_insn (gen_disable_interrupt ());
+ return 0;
+ case AVR_BUILTIN_WDR:
+ emit_insn (gen_wdr ());
+ return 0;
+ case AVR_BUILTIN_SLEEP:
+ emit_insn (gen_sleep ());
+ return 0;
+ case AVR_BUILTIN_DELAY_CYCLES:
+ {
+ arg0 = CALL_EXPR_ARG (exp, 0);
+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
+
+ if (!CONSTANT_P (op0))
+ error ("__builtin_avr_delay_cycles expects an integer constant.");
+
+ emit_insn (gen_delay_cycles (op0));
+ return 0;
+ }
+ }
+
+ for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
+ if (d->code == fcode)
+ return avr_expand_unop_builtin (d->icode, exp, target);
+
+ for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
+ if (d->code == fcode)
+ return avr_expand_binop_builtin (d->icode, exp, target);
+
+ gcc_unreachable ();
+}
+
#include "gt-avr.h"

View file

@ -0,0 +1,65 @@
--- gdb/avr-tdep.c.orig 2008-01-11 06:19:59.000000000 -0700
+++ gdb/avr-tdep.c 2008-06-18 16:01:50.309167300 -0600
@@ -181,8 +181,10 @@ struct avr_unwind_cache
struct gdbarch_tdep
{
- /* FIXME: TRoth: is there anything to put here? */
- int foo;
+ /* Size of the PC on the current AVR target. This is equal 2 for
+ most AVRs except for the ATmega256x devices that have a 3-byte
+ PC. */
+ int pcsize;
};
/* Lookup the name of a register given it's number. */
@@ -1030,22 +1032,28 @@ avr_frame_prev_register (struct frame_in
on the stack is in big endian byte order, even though most
everything else about the avr is little endian. Ick! */
- /* FIXME: number of bytes read here will need updated for the
- mega256 when it is available. */
-
ULONGEST pc;
unsigned char tmp;
- unsigned char buf[2];
+ unsigned char buf[3];
- read_memory (info->saved_regs[regnum].addr, buf, 2);
+ read_memory (info->saved_regs[regnum].addr, buf, tdep->pcsize);
/* Convert the PC read from memory as a big-endian to
little-endian order. */
- tmp = buf[0];
- buf[0] = buf[1];
- buf[1] = tmp;
+ if (tdep->pcsize == 2)
+ {
+ tmp = buf[0];
+ buf[0] = buf[1];
+ buf[1] = tmp;
+ }
+ else
+ {
+ tmp = buf[0];
+ buf[0] = buf[2];
+ buf[2] = tmp;
+ }
- pc = (extract_unsigned_integer (buf, 2) * 2);
+ pc = (extract_unsigned_integer (buf, tdep->pcsize) * 2);
store_unsigned_integer
(bufferp, register_size (get_frame_arch (next_frame), regnum),
pc);
@@ -1280,6 +1288,11 @@ avr_gdbarch_init (struct gdbarch_info in
case bfd_mach_avr3:
case bfd_mach_avr4:
case bfd_mach_avr5:
+ tdep->pcsize = 2;
+ break;
+
+ case bfd_mach_avr6:
+ tdep->pcsize = 3;
break;
}

View file

@ -0,0 +1,23 @@
===================================================================
RCS file: /cvs/src/src/winsup/mingw/include/io.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- mingw/include/io.h 2007/02/08 08:15:32 1.16
+++ mingw/include/io.h 2007/03/05 08:25:32 1.17
@@ -293,6 +293,15 @@
_CRTIMP int __cdecl write (int, const void*, unsigned int);
#endif /* _UWIN */
+#ifdef __USE_MINGW_ACCESS
+/* Old versions of MSVCRT access() just ignored X_OK, while the version
+ shipped with Vista, returns an error code. This will restore the
+ old behaviour */
+static inline int __mingw_access (const char* __fname, int __mode)
+ { return _access (__fname, __mode & ~X_OK); }
+#define access(__f,__m) __mingw_access (__f, __m)
+#endif
+
/* Wide character versions. Also declared in wchar.h. */
/* Where do these live? Not in libmoldname.a nor in libmsvcrt.a */
#if 0