2004-04-13 Theodore A. Roth * configure.in: * crt1/Makefile.am: * include/avr/io.h: Add support infrastructure for mega48, mega88, mega168, tiny13, tiny2313 and at90can128. Index: configure.in =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/configure.in,v retrieving revision 1.102 diff -u -p -p -r1.102 configure.in --- configure.in 6 Apr 2004 17:53:58 -0000 1.102 +++ configure.in 13 Apr 2004 19:31:45 -0000 @@ -265,6 +265,32 @@ fi AC_SUBST(DOC_INST_DIR) +dnl Some devices are only handled by newer version of gcc. This macro lets us +dnl probe to see if the installed avr-gcc supports a questionable device. +AC_DEFUN( + CHECK_AVR_DEVICE, + [ + old_CC=${CC} + old_CFLAGS=${CFLAGS} + CFLAGS="-mmcu=$1" + CC=`echo "${CC}" | sed 's/-mmcu=avr.//'` + AC_MSG_CHECKING(if ${CC} has support for $1) + AC_TRY_LINK( + [], + [int main (void) {}], + [has_dev_support=yes], + [has_dev_support=no] + ) + if test "x$has_dev_support" = "xyes" + then + HAS_$1=yes + fi + AC_MSG_RESULT($has_dev_support) + CC=${old_CC} + CFLAGS=${old_CFLAGS} + ] +) + dnl we need to set some compiler switches according to the current dnl avr library configuration @@ -315,14 +341,40 @@ else AVR_CRT_MEGA='crtm103.o' AVR_CRT_OTHER='crt43320.o crt43355.o crt76711.o' ;; - avr4) avrlib_cflags=${avrlib_opt_space} + avr4) + CHECK_AVR_DEVICE(attiny13) + CHECK_AVR_DEVICE(attiny2313) + CHECK_AVR_DEVICE(atmega48) + CHECK_AVR_DEVICE(atmega88) + avrlib_cflags=${avrlib_opt_space} avrlib_asflags='-mmcu=avr4' - AVR_CRT_MEGA='crtm8.o crtm8515.o crtm8535.o # crtm83.o crtm85.o' + AVR_CRT_MEGA='crtm8.o crtm8515.o crtm8535.o' + if test "x$HAS_atmega48" = "xyes"; then + AVR_CRT_MEGA="$AVR_CRT_MEGA crtm48" + fi + if test "x$HAS_atmega88" = "xyes"; then + AVR_CRT_MEGA="$AVR_CRT_MEGA crtm88" + fi + if test "x$HAS_tiny13" = "xyes"; then + AVR_CRT_TINY="$AVR_CRT_TINY crttn13" + fi + if test "x$HAS_tiny2313" = "xyes"; then + AVR_CRT_TINY="$AVR_CRT_TINY crttn2313" + fi ;; - avr5) avrlib_cflags=${avrlib_opt_speed} + avr5) + CHECK_AVR_DEVICE(atmega168) + CHECK_AVR_DEVICE(at90can128) + avrlib_cflags=${avrlib_opt_speed} avrlib_asflags='-mmcu=avr5' AVR_CRT_MEGA='crtm161.o crtm162.o crtm163.o crtm169.o crtm323.o crtm128.o crtm16.o crtm32.o crtm64.o' + if test "x$HAS_atmega168" = "xyes"; then + AVR_CRT_MRGA="$AVR_CRT_MEGA crtm168" + fi AVR_CRT_OTHER='crtat94k.o' + if test "x$HAS_at90can128" = "xyes"; then + AVR_CRT_OTHER="$AVR_CRT_OTHER crtcan128" + fi ;; *) AC_MSG_ERROR(unexpected value '${with_multisubdir}' for with_multisubdir) ;; Index: crt1/Makefile.am =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/crt1/Makefile.am,v retrieving revision 1.2 diff -u -p -p -r1.2 Makefile.am --- crt1/Makefile.am 27 Feb 2003 21:40:18 -0000 1.2 +++ crt1/Makefile.am 13 Apr 2004 19:31:45 -0000 @@ -1,4 +1,7 @@ -# Copyright (c) 2002, Reinhard Jessich +# +# $Id$ +# +# Copyright (c) 2002, 2004 Reinhard Jessich # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -54,6 +57,9 @@ $(AVR_CRT_TINY): crttn%.o: gcrt1.S # $(AVR_CRT_OTHER) - devices that don't follow a common naming convention. crtat94k.o: gcrt1.S $(COMPILE) $(AVR_CRT_ASFLAGS) -mmcu=at94k -c $< -o $@ + +crtcan128.o: gcrt1.S + $(COMPILE) $(AVR_CRT_ASFLAGS) -mmcu=at90can128 -c $< -o $@ crt43320.o: gcrt1.S $(COMPILE) $(AVR_CRT_ASFLAGS) -mmcu=at43usb320 -c $< -o $@ Index: include/avr/io.h =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/include/avr/io.h,v retrieving revision 1.11 diff -u -p -p -r1.11 io.h --- include/avr/io.h 20 Oct 2003 18:45:28 -0000 1.11 +++ include/avr/io.h 13 Apr 2004 19:31:45 -0000 @@ -161,6 +161,8 @@ # include #elif defined (__AVR_ATmega128__) # include +#elif defined (__AVR_AT90CAN128__) +# include #elif defined (__AVR_ATmega64__) # include #elif defined (__AVR_ATmega103__) @@ -177,10 +179,16 @@ # include #elif defined (__AVR_ATmega163__) # include +#elif defined (__AVR_ATmega168__) +# include #elif defined (__AVR_ATmega169__) # include #elif defined (__AVR_ATmega8__) # include +#elif defined (__AVR_ATmega48__) +# include +#elif defined (__AVR_ATmega88__) +# include #elif defined (__AVR_ATmega8515__) # include #elif defined (__AVR_ATmega8535__) @@ -209,6 +217,10 @@ # include #elif defined (__AVR_AT90S2313__) # include +#elif defined (__AVR_ATtiny2313__) +# include +#elif defined (__AVR_ATtiny13__) +# include /* avr1: the following only supported for assembler programs */ #elif defined (__AVR_ATtiny28__) # include