As Eric Weddington wrote:

> See attached patches for 1.4 branch and HEAD.

As MS-Outlook users (so both Eric and Per Arnold) apparently cannot
set the MIME types of their attachments to anything useful, and
savannah's mailman auto-cleans attachments of type
application/octet-stream, here are the patches forwarded on behalf of
Eric.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
Index: ChangeLog
===================================================================
RCS file: /sources/avr-libc/avr-libc/ChangeLog,v
retrieving revision 1.623.2.151
diff -u -p -r1.623.2.151 ChangeLog
--- ChangeLog   29 May 2007 19:23:44 -0000      1.623.2.151
+++ ChangeLog   6 Jun 2007 21:43:46 -0000
@@ -1,3 +1,16 @@
+2007-06-06 Eric B. Weddington <[EMAIL PROTECTED]>
+
+       * include/avr/common.h: New file.
+       * include/avr/io.h: Move definitions to common.h. Fix documentation.
+       * common/macros.inc: Use new common register definitions.
+       * crt1/gcrt1.S: Use new common register definitions.
+       * include/avr/iomxx0_1.h: Define EIND as normal without conditional
+         compilation.
+       * libc/stdlib/stdlib_private.h: Use new common register definitions.
+       * libm/fplib/strtod.S: Use new common register definitions. Check if
+         the stack high register exists and don't use it if it does not exist.
+       * doc/api/doxygen.config.in: Add avr/io.h back into the documentation 
list.
+
 2007-05-29 Eric B. Weddington <[EMAIL PROTECTED]>
 
        * Makefile.am: Add ChangeLog-2006 to distribution list.
Index: common/macros.inc
===================================================================
RCS file: /sources/avr-libc/avr-libc/common/macros.inc,v
retrieving revision 1.6.2.4
diff -u -p -r1.6.2.4 macros.inc
--- common/macros.inc   18 Jan 2007 21:43:18 -0000      1.6.2.4
+++ common/macros.inc   6 Jun 2007 21:44:00 -0000
@@ -334,7 +334,7 @@
        .macro  LPM_R0_ZPLUS_INIT hhi
 #if __AVR_ENHANCED__
   #if BIG_CODE
-       out     _SFR_IO_ADDR(RAMPZ), \hhi
+       out     AVR_RAMPZ_ADDR, \hhi
   #endif
 #endif
        .endm
@@ -351,7 +351,7 @@
 #else
   #if BIG_CODE
     /* ELPM without post-increment, load RAMPZ each time (ATmega103) */
-       out     _SFR_IO_ADDR(RAMPZ), \hhi
+       out     AVR_RAMPZ_ADDR, \hhi
        elpm
        adiw    r30,1
        adc     \hhi, __zero_reg__
Index: crt1/gcrt1.S
===================================================================
RCS file: /sources/avr-libc/avr-libc/crt1/gcrt1.S,v
retrieving revision 1.8.2.1
diff -u -p -r1.8.2.1 gcrt1.S
--- crt1/gcrt1.S        8 May 2007 20:58:39 -0000       1.8.2.1
+++ crt1/gcrt1.S        6 Jun 2007 21:44:00 -0000
@@ -1,4 +1,5 @@
 /* Copyright (c) 2002, Marek Michalkiewicz <[EMAIL PROTECTED]>
+   Copyright (c) 2007, Eric B. Weddington
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -142,13 +143,13 @@ __init:
 
        .section .init2,"ax",@progbits
        clr     __zero_reg__
-       out     _SFR_IO_ADDR(SREG), __zero_reg__
+       out     AVR_STATUS_ADDR, __zero_reg__
        ldi     r28,lo8(__stack)
-#ifdef SPH
+#ifdef _HAVE_AVR_STACK_POINTER_HI
        ldi     r29,hi8(__stack)
-       out     _SFR_IO_ADDR(SPH), r29
+       out     AVR_STACK_POINTER_HI_ADDR, r29
 #endif
-       out     _SFR_IO_ADDR(SPL), r28
+       out     AVR_STACK_POINTER_LO_ADDR, r28
 
 #if BIG_CODE
        /* Only for >64K devices with RAMPZ, replaces the default code
@@ -173,7 +174,7 @@ __do_copy_data:
 .L__do_copy_data_carry:
        inc     r16
 #endif
-       out     _SFR_IO_ADDR(RAMPZ), r16
+       out     AVR_RAMPZ_ADDR, r16
        rjmp    .L__do_copy_data_start
 .L__do_copy_data_loop:
 #ifdef __AVR_ENHANCED__
Index: doc/api/doxygen.config.in
===================================================================
RCS file: /sources/avr-libc/avr-libc/doc/api/doxygen.config.in,v
retrieving revision 1.19.2.5
diff -u -p -r1.19.2.5 doxygen.config.in
--- doc/api/doxygen.config.in   30 Mar 2007 04:13:22 -0000      1.19.2.5
+++ doc/api/doxygen.config.in   6 Jun 2007 21:44:33 -0000
@@ -473,6 +473,7 @@ INPUT                  = @top_srcdir@/in
                          @top_srcdir@/include/avr/interrupt.h \
                          @top_srcdir@/doc/api/interrupts.dox \
                          @top_srcdir@/doc/api/vectortable.dox \
+                         @top_srcdir@/include/avr/io.h \
                          @top_srcdir@/include/avr/pgmspace.h \
                          @top_srcdir@/include/avr/portpins.h \
                          @top_srcdir@/include/avr/power.h \
Index: include/avr/io.h
===================================================================
RCS file: /sources/avr-libc/avr-libc/include/avr/io.h,v
retrieving revision 1.24.2.17
diff -u -p -r1.24.2.17 io.h
--- include/avr/io.h    13 May 2007 20:36:03 -0000      1.24.2.17
+++ include/avr/io.h    6 Jun 2007 21:44:42 -0000
@@ -1,4 +1,5 @@
 /* Copyright (c) 2002,2003,2005,2006,2007 Marek Michalkiewicz, Joerg Wunsch
+   Copyright (c) 2007 Eric B. Weddington
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -39,16 +40,22 @@
     command-line switch.  This is done by diverting to the appropriate
     file <tt>&lt;avr/io</tt><em>XXXX</em><tt>.h&gt;</tt> which should
     never be included directly.  Some register names common to all
-    AVR devices are defined directly within <tt>&lt;avr/io.h&gt;</tt>,
+    AVR devices are defined directly within <tt>&lt;avr/common.h&gt;</tt>,
+    which is included in <tt>&lt;avr/io.h&gt;</tt>,
     but most of the details come from the respective include file.
 
-    Note that this file always includes
-    \code #include <avr/sfr_defs.h> \endcode
-    See \ref avr_sfr for the details.
+    Note that this file always includes the following files:
+    \code 
+    #include <avr/sfr_defs.h>
+    #include <avr/portpins.h>
+    #include <avr/common.h>
+    #include <avr/version.h>
+    \endcode
+    See \ref avr_sfr for more details about that header file.
 
     Included are definitions of the IO register set and their
     respective bit values as specified in the Atmel documentation.
-    Note that Atmel is not very consistent in its naming conventions,
+    Note that inconsistencies in naming conventions,
     so even identical functions sometimes get different names on
     different devices.
 
@@ -86,94 +93,6 @@
 
 #include <avr/sfr_defs.h>
 
-#ifndef __AVR_HAVE_MOVW__
-#  if  defined(__AVR_ENHANCED__) && __AVR_ENHANCED__
-#   define __AVR_HAVE_MOVW__ 1
-#  endif
-#endif
-
-#ifndef __AVR_HAVE_LPMX__
-# if  defined(__AVR_ENHANCED__) && __AVR_ENHANCED__
-#  define __AVR_HAVE_LPMX__ 1
-# endif
-#endif
-
-/*
- * Registers common to all AVR devices.
- */
-
-#if __AVR_ARCH__ != 1
-/*
- * AVR architecture 1 has no RAM, thus no stack pointer.
- *
- * All other archs do have a stack pointer.  Some devices have only
- * less than 256 bytes of possible RAM locations (128 Bytes of SRAM
- * and no option for external RAM), thus SPH is officially "reserved"
- * for them.  We catch this case below after including the
- * device-specific ioXXXX.h file, by examining XRAMEND, and
- * #undef-ining SP and SPH in that case.
- */
-/* Stack Pointer */
-#define SP        _SFR_IO16(0x3D)
-#define SPL       _SFR_IO8(0x3D)
-#define SPH       _SFR_IO8(0x3E)
-#endif /* #if __AVR_ARCH__ != 1 */
-
-/* Status REGister */
-#define SREG      _SFR_IO8(0x3F)
-
-/* Status Register - SREG */
-#define    SREG_I       7
-#define    SREG_T       6
-#define    SREG_H       5
-#define    SREG_S       4
-#define    SREG_V       3
-#define    SREG_N       2
-#define    SREG_Z       1
-#define    SREG_C       0
-
-/* Pointer definition */
-#if __AVR_ARCH__ != 1
-/* avr1 has only the Z pointer */
-#define    XL           r26
-#define    XH           r27
-#define    YL           r28
-#define    YH           r29
-#endif /* #if __AVR_ARCH__ != 1 */
-#define    ZL           r30
-#define    ZH           r31
-
-/*
- * Only few devices come without EEPROM.  In order to assemble the
- * EEPROM library components without defining a specific device, we
- * keep the EEPROM-related definitions here.
- */
-#if defined(__COMPILING_AVR_LIBC__)
-
-/* EEPROM Control Register */
-#define EECR   _SFR_IO8(0x1C)
-
-/* EEPROM Data Register */
-#define EEDR   _SFR_IO8(0x1D)
-
-/* EEPROM Address Register */
-#define EEAR   _SFR_IO16(0x1E)
-#define EEARL  _SFR_IO8(0x1E)
-#define EEARH  _SFR_IO8(0x1F)
-
-/* EEPROM Control Register */
-#define    EERIE        3
-#define    EEMWE        2
-#define    EEWE         1
-#define    EERE         0
-
-/* Extended indirect addressing of ATmega256x devices */
-#if __AVR_ARCH__ == 6
-#  define EIND     _SFR_IO8(0X3C)
-#endif
-
-#endif /* __COMPILING_AVR_LIBC__ */
-
 #if defined (__AVR_AT94K__)
 #  include <avr/ioat94k.h>
 #elif defined (__AVR_AT43USB320__)
@@ -359,13 +278,7 @@
 
 #include <avr/portpins.h>
 
-#if __AVR_ARCH__ != 1
-#  if XRAMEND < 0x100 && !defined(__COMPILING_AVR_LIBC__)
-#    undef SP
-#    define SP     _SFR_IO8(0x3D)
-#    undef SPH
-#  endif
-#endif
+#include <avr/common.h>
 
 #include <avr/version.h>
 
Index: include/avr/iomxx0_1.h
===================================================================
RCS file: /sources/avr-libc/avr-libc/include/avr/iomxx0_1.h,v
retrieving revision 1.7.2.3
diff -u -p -r1.7.2.3 iomxx0_1.h
--- include/avr/iomxx0_1.h      1 Jan 2007 21:43:51 -0000       1.7.2.3
+++ include/avr/iomxx0_1.h      6 Jun 2007 21:44:57 -0000
@@ -463,9 +463,7 @@
 #define RAMPZ   _SFR_IO8(0X3B)
 #define RAMPZ0  0
 
-#if !(__AVR_ARCH__ == 6 && defined(__COMPILING_AVR_LIBC__))
-#  define EIND    _SFR_IO8(0X3C)
-#endif
+#define EIND    _SFR_IO8(0X3C)
 #define EIND0   0
 
 /* SP [0x3D..0x3E] */
Index: libc/stdlib/stdlib_private.h
===================================================================
RCS file: /sources/avr-libc/avr-libc/libc/stdlib/stdlib_private.h,v
retrieving revision 1.2
diff -u -p -r1.2 stdlib_private.h
--- libc/stdlib/stdlib_private.h        13 Sep 2005 13:29:54 -0000      1.2
+++ libc/stdlib/stdlib_private.h        6 Jun 2007 21:45:03 -0000
@@ -31,6 +31,7 @@
 
 #include <inttypes.h>
 #include <stdlib.h>
+#include <avr/io.h>
 
 #if !defined(__DOXYGEN__)
 
@@ -83,6 +84,6 @@ extern char mymem[];    
 extern char __heap_start;
 extern char __heap_end;
 
-#define STACK_POINTER() ((char *)SP)
+#define STACK_POINTER() ((char *)AVR_STACK_POINTER_REG)
 
 #endif /* MALLOC_TEST */
--- include/avr/common.h        1969-12-31 17:00:00.000000000 -0700
+++ include/avr/common.h        2007-06-06 13:29:02.360846200 -0600
@@ -0,0 +1,235 @@
+/* Copyright (c) 2007 Eric B. Weddington
+   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$ */
+
+
+#ifndef _AVR_COMMON_H
+#define _AVR_COMMON_H
+
+#include <avr/sfr_defs.h>
+
+/* 
+This purpose of this header is to define registers that have not been 
+previously defined in the individual device IO header files, and to define 
+other symbols that are common across AVR device families.
+
+This file is designed to be included in <avr/io.h> after the individual
+device IO header files, and after <avr/sfr_defs.h>
+
+*/
+
+/*------------ Registers Not Previously Defined ------------*/
+
+/* 
+These are registers that are not previously defined in the individual
+IO header files, OR they are defined here because they are used in parts of
+avr-libc even if a device is not selected but a general architecture has
+been selected.
+*/
+
+
+/*
+Stack pointer register.
+
+AVR architecture 1 has no RAM, thus no stack pointer. 
+
+All other architectures do have a stack pointer.  Some devices have only
+less than 256 bytes of possible RAM locations (128 Bytes of SRAM
+and no option for external RAM), thus SPH is officially "reserved"
+for them.
+
+*/
+#if __AVR_ARCH__ != 1
+
+#  ifndef SPL
+#    define SPL _SFR_IO8(0x3D)
+#  endif
+#  if XRAMEND < 0x100
+#    ifndef SP
+#      define SP  _SFR_IO8(0x3D)
+#    endif
+#  else
+#    ifndef SP
+#      define SP  _SFR_IO16(0x3D)
+#    endif
+#    ifndef SPH
+#      define SPH _SFR_IO8(0x3E)
+#    endif
+#  endif /* XRAMEND < 0x100 && !defined(__COMPILING_AVR_LIBC__) */
+
+#endif /* __AVR_ARCH__ != 1 */
+
+
+/* Status Register */
+#ifndef SREG
+#  define SREG _SFR_IO8(0x3F)
+#endif
+
+/* SREG bit definitions */
+#ifndef SREG_C
+#  define SREG_C  (0)
+#endif
+#ifndef SREG_Z
+#  define SREG_Z  (1)
+#endif
+#ifndef SREG_N
+#  define SREG_N  (2)
+#endif
+#ifndef SREG_V
+#  define SREG_V  (3)
+#endif
+#ifndef SREG_S
+#  define SREG_S  (4)
+#endif
+#ifndef SREG_H
+#  define SREG_H  (5)
+#endif
+#ifndef SREG_T
+#  define SREG_T  (6)
+#endif
+#ifndef SREG_I
+#  define SREG_I  (7)
+#endif
+
+
+/* AVR 6 Architecture */
+#if __AVR_ARCH__ == 6
+#  ifndef EIND
+#    define EIND  _SFR_IO8(0X3C)
+#  endif
+#endif /* __AVR_ARCH__ == 6 */
+
+
+
+#if defined(__COMPILING_AVR_LIBC__)
+
+/*
+Only few devices come without EEPROM.  In order to assemble the
+EEPROM library components without defining a specific device, we
+keep the EEPROM-related definitions here.
+*/
+
+/* EEPROM Control Register */
+#  ifndef EECR
+#    define EECR   _SFR_IO8(0x1C)
+#  endif
+
+/* EEPROM Data Register */
+#  ifndef EEDR
+#    define EEDR   _SFR_IO8(0x1D)
+#  endif
+
+/* EEPROM Address Register */
+#  ifndef EEAR
+#    define EEAR   _SFR_IO16(0x1E)
+#  endif
+#  ifndef EEARL
+#    define EEARL  _SFR_IO8(0x1E)
+#  endif
+#  ifndef EEARH
+#    define EEARH  _SFR_IO8(0x1F)
+#  endif
+
+/* EEPROM Control Register bits */
+#  ifndef EERE
+#    define EERE   (0)
+#  endif
+#  ifndef EEWE
+#    define EEWE   (1)
+#  endif
+#  ifndef EEMWE
+#    define EEMWE  (2)
+#  endif
+#  ifndef EERIE
+#    define EERIE  (3)
+#  endif
+
+#endif /* __COMPILING_AVR_LIBC__ */
+
+
+
+/*------------ Common Symbols ------------*/
+
+/* 
+Generic definitions for registers that are common across multiple AVR devices
+and families.
+*/
+
+/* Pointer registers definitions */
+#if __AVR_ARCH__ != 1  /* avr1 does not have X and Y pointers */
+#  define XL  r26
+#  define XH  r27
+#  define YL  r28
+#  define YH  r29
+#endif /* #if __AVR_ARCH__ != 1 */
+#define ZL  r30
+#define ZH  r31
+
+
+/* Status Register */
+#if defined(SREG)
+#  define AVR_STATUS_REG   SREG
+#  define AVR_STATUS_ADDR  _SFR_IO_ADDR(SREG)
+#endif
+
+/* Stack Pointer (combined) Register */
+#if defined(SP)
+#  define AVR_STACK_POINTER_REG   SP
+#  define AVR_STACK_POINTER_ADDR  _SFR_IO_ADDR(SP)
+#endif
+
+/* Stack Pointer High Register */
+#if defined(SPH)
+#  define _HAVE_AVR_STACK_POINTER_HI 1
+#  define AVR_STACK_POINTER_HI_REG   SPH
+#  define AVR_STACK_POINTER_HI_ADDR  _SFR_IO_ADDR(SPH)
+#endif
+
+/* Stack Pointer Low Register */
+#if defined(SPL)
+#  define AVR_STACK_POINTER_LO_REG   SPL
+#  define AVR_STACK_POINTER_LO_ADDR  _SFR_IO_ADDR(SPL)
+#endif
+
+/* RAMPZ Register */
+#if defined(RAMPZ)
+#  define AVR_RAMPZ_REG   RAMPZ
+#  define AVR_RAMPZ_ADDR  _SFR_IO_ADDR(RAMPZ)
+#endif
+
+/* Extended Indirect Register */
+#if defined(EIND)
+#  define AVR_EXTENDED_INDIRECT_REG   EIND
+#  define AVR_EXTENDED_INDIRECT_ADDR  _SFR_IO_ADDR(EIND)
+#endif
+
+
+#endif /* _AVR_COMMON_H */
Index: ChangeLog
===================================================================
RCS file: /sources/avr-libc/avr-libc/ChangeLog,v
retrieving revision 1.623.2.151
diff -u -p -r1.623.2.151 ChangeLog
--- ChangeLog   29 May 2007 19:23:44 -0000      1.623.2.151
+++ ChangeLog   6 Jun 2007 21:43:46 -0000
@@ -1,3 +1,16 @@
+2007-06-06 Eric B. Weddington <[EMAIL PROTECTED]>
+
+       * include/avr/common.h: New file.
+       * include/avr/io.h: Move definitions to common.h. Fix documentation.
+       * common/macros.inc: Use new common register definitions.
+       * crt1/gcrt1.S: Use new common register definitions.
+       * include/avr/iomxx0_1.h: Define EIND as normal without conditional
+         compilation.
+       * libc/stdlib/stdlib_private.h: Use new common register definitions.
+       * libm/fplib/strtod.S: Use new common register definitions. Check if
+         the stack high register exists and don't use it if it does not exist.
+       * doc/api/doxygen.config.in: Add avr/io.h back into the documentation 
list.
+
 2007-05-29 Eric B. Weddington <[EMAIL PROTECTED]>
 
        * Makefile.am: Add ChangeLog-2006 to distribution list.
Index: common/macros.inc
===================================================================
RCS file: /sources/avr-libc/avr-libc/common/macros.inc,v
retrieving revision 1.6.2.4
diff -u -p -r1.6.2.4 macros.inc
--- common/macros.inc   18 Jan 2007 21:43:18 -0000      1.6.2.4
+++ common/macros.inc   6 Jun 2007 21:44:00 -0000
@@ -334,7 +334,7 @@
        .macro  LPM_R0_ZPLUS_INIT hhi
 #if __AVR_ENHANCED__
   #if BIG_CODE
-       out     _SFR_IO_ADDR(RAMPZ), \hhi
+       out     AVR_RAMPZ_ADDR, \hhi
   #endif
 #endif
        .endm
@@ -351,7 +351,7 @@
 #else
   #if BIG_CODE
     /* ELPM without post-increment, load RAMPZ each time (ATmega103) */
-       out     _SFR_IO_ADDR(RAMPZ), \hhi
+       out     AVR_RAMPZ_ADDR, \hhi
        elpm
        adiw    r30,1
        adc     \hhi, __zero_reg__
Index: crt1/gcrt1.S
===================================================================
RCS file: /sources/avr-libc/avr-libc/crt1/gcrt1.S,v
retrieving revision 1.8.2.1
diff -u -p -r1.8.2.1 gcrt1.S
--- crt1/gcrt1.S        8 May 2007 20:58:39 -0000       1.8.2.1
+++ crt1/gcrt1.S        6 Jun 2007 21:44:00 -0000
@@ -1,4 +1,5 @@
 /* Copyright (c) 2002, Marek Michalkiewicz <[EMAIL PROTECTED]>
+   Copyright (c) 2007, Eric B. Weddington
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -142,13 +143,13 @@ __init:
 
        .section .init2,"ax",@progbits
        clr     __zero_reg__
-       out     _SFR_IO_ADDR(SREG), __zero_reg__
+       out     AVR_STATUS_ADDR, __zero_reg__
        ldi     r28,lo8(__stack)
-#ifdef SPH
+#ifdef _HAVE_AVR_STACK_POINTER_HI
        ldi     r29,hi8(__stack)
-       out     _SFR_IO_ADDR(SPH), r29
+       out     AVR_STACK_POINTER_HI_ADDR, r29
 #endif
-       out     _SFR_IO_ADDR(SPL), r28
+       out     AVR_STACK_POINTER_LO_ADDR, r28
 
 #if BIG_CODE
        /* Only for >64K devices with RAMPZ, replaces the default code
@@ -173,7 +174,7 @@ __do_copy_data:
 .L__do_copy_data_carry:
        inc     r16
 #endif
-       out     _SFR_IO_ADDR(RAMPZ), r16
+       out     AVR_RAMPZ_ADDR, r16
        rjmp    .L__do_copy_data_start
 .L__do_copy_data_loop:
 #ifdef __AVR_ENHANCED__
Index: doc/api/doxygen.config.in
===================================================================
RCS file: /sources/avr-libc/avr-libc/doc/api/doxygen.config.in,v
retrieving revision 1.19.2.5
diff -u -p -r1.19.2.5 doxygen.config.in
--- doc/api/doxygen.config.in   30 Mar 2007 04:13:22 -0000      1.19.2.5
+++ doc/api/doxygen.config.in   6 Jun 2007 21:44:33 -0000
@@ -473,6 +473,7 @@ INPUT                  = @top_srcdir@/in
                          @top_srcdir@/include/avr/interrupt.h \
                          @top_srcdir@/doc/api/interrupts.dox \
                          @top_srcdir@/doc/api/vectortable.dox \
+                         @top_srcdir@/include/avr/io.h \
                          @top_srcdir@/include/avr/pgmspace.h \
                          @top_srcdir@/include/avr/portpins.h \
                          @top_srcdir@/include/avr/power.h \
Index: include/avr/io.h
===================================================================
RCS file: /sources/avr-libc/avr-libc/include/avr/io.h,v
retrieving revision 1.24.2.17
diff -u -p -r1.24.2.17 io.h
--- include/avr/io.h    13 May 2007 20:36:03 -0000      1.24.2.17
+++ include/avr/io.h    6 Jun 2007 21:44:42 -0000
@@ -1,4 +1,5 @@
 /* Copyright (c) 2002,2003,2005,2006,2007 Marek Michalkiewicz, Joerg Wunsch
+   Copyright (c) 2007 Eric B. Weddington
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -39,16 +40,22 @@
     command-line switch.  This is done by diverting to the appropriate
     file <tt>&lt;avr/io</tt><em>XXXX</em><tt>.h&gt;</tt> which should
     never be included directly.  Some register names common to all
-    AVR devices are defined directly within <tt>&lt;avr/io.h&gt;</tt>,
+    AVR devices are defined directly within <tt>&lt;avr/common.h&gt;</tt>,
+    which is included in <tt>&lt;avr/io.h&gt;</tt>,
     but most of the details come from the respective include file.
 
-    Note that this file always includes
-    \code #include <avr/sfr_defs.h> \endcode
-    See \ref avr_sfr for the details.
+    Note that this file always includes the following files:
+    \code 
+    #include <avr/sfr_defs.h>
+    #include <avr/portpins.h>
+    #include <avr/common.h>
+    #include <avr/version.h>
+    \endcode
+    See \ref avr_sfr for more details about that header file.
 
     Included are definitions of the IO register set and their
     respective bit values as specified in the Atmel documentation.
-    Note that Atmel is not very consistent in its naming conventions,
+    Note that inconsistencies in naming conventions,
     so even identical functions sometimes get different names on
     different devices.
 
@@ -86,94 +93,6 @@
 
 #include <avr/sfr_defs.h>
 
-#ifndef __AVR_HAVE_MOVW__
-#  if  defined(__AVR_ENHANCED__) && __AVR_ENHANCED__
-#   define __AVR_HAVE_MOVW__ 1
-#  endif
-#endif
-
-#ifndef __AVR_HAVE_LPMX__
-# if  defined(__AVR_ENHANCED__) && __AVR_ENHANCED__
-#  define __AVR_HAVE_LPMX__ 1
-# endif
-#endif
-
-/*
- * Registers common to all AVR devices.
- */
-
-#if __AVR_ARCH__ != 1
-/*
- * AVR architecture 1 has no RAM, thus no stack pointer.
- *
- * All other archs do have a stack pointer.  Some devices have only
- * less than 256 bytes of possible RAM locations (128 Bytes of SRAM
- * and no option for external RAM), thus SPH is officially "reserved"
- * for them.  We catch this case below after including the
- * device-specific ioXXXX.h file, by examining XRAMEND, and
- * #undef-ining SP and SPH in that case.
- */
-/* Stack Pointer */
-#define SP        _SFR_IO16(0x3D)
-#define SPL       _SFR_IO8(0x3D)
-#define SPH       _SFR_IO8(0x3E)
-#endif /* #if __AVR_ARCH__ != 1 */
-
-/* Status REGister */
-#define SREG      _SFR_IO8(0x3F)
-
-/* Status Register - SREG */
-#define    SREG_I       7
-#define    SREG_T       6
-#define    SREG_H       5
-#define    SREG_S       4
-#define    SREG_V       3
-#define    SREG_N       2
-#define    SREG_Z       1
-#define    SREG_C       0
-
-/* Pointer definition */
-#if __AVR_ARCH__ != 1
-/* avr1 has only the Z pointer */
-#define    XL           r26
-#define    XH           r27
-#define    YL           r28
-#define    YH           r29
-#endif /* #if __AVR_ARCH__ != 1 */
-#define    ZL           r30
-#define    ZH           r31
-
-/*
- * Only few devices come without EEPROM.  In order to assemble the
- * EEPROM library components without defining a specific device, we
- * keep the EEPROM-related definitions here.
- */
-#if defined(__COMPILING_AVR_LIBC__)
-
-/* EEPROM Control Register */
-#define EECR   _SFR_IO8(0x1C)
-
-/* EEPROM Data Register */
-#define EEDR   _SFR_IO8(0x1D)
-
-/* EEPROM Address Register */
-#define EEAR   _SFR_IO16(0x1E)
-#define EEARL  _SFR_IO8(0x1E)
-#define EEARH  _SFR_IO8(0x1F)
-
-/* EEPROM Control Register */
-#define    EERIE        3
-#define    EEMWE        2
-#define    EEWE         1
-#define    EERE         0
-
-/* Extended indirect addressing of ATmega256x devices */
-#if __AVR_ARCH__ == 6
-#  define EIND     _SFR_IO8(0X3C)
-#endif
-
-#endif /* __COMPILING_AVR_LIBC__ */
-
 #if defined (__AVR_AT94K__)
 #  include <avr/ioat94k.h>
 #elif defined (__AVR_AT43USB320__)
@@ -359,13 +278,7 @@
 
 #include <avr/portpins.h>
 
-#if __AVR_ARCH__ != 1
-#  if XRAMEND < 0x100 && !defined(__COMPILING_AVR_LIBC__)
-#    undef SP
-#    define SP     _SFR_IO8(0x3D)
-#    undef SPH
-#  endif
-#endif
+#include <avr/common.h>
 
 #include <avr/version.h>
 
Index: include/avr/iomxx0_1.h
===================================================================
RCS file: /sources/avr-libc/avr-libc/include/avr/iomxx0_1.h,v
retrieving revision 1.7.2.3
diff -u -p -r1.7.2.3 iomxx0_1.h
--- include/avr/iomxx0_1.h      1 Jan 2007 21:43:51 -0000       1.7.2.3
+++ include/avr/iomxx0_1.h      6 Jun 2007 21:44:57 -0000
@@ -463,9 +463,7 @@
 #define RAMPZ   _SFR_IO8(0X3B)
 #define RAMPZ0  0
 
-#if !(__AVR_ARCH__ == 6 && defined(__COMPILING_AVR_LIBC__))
-#  define EIND    _SFR_IO8(0X3C)
-#endif
+#define EIND    _SFR_IO8(0X3C)
 #define EIND0   0
 
 /* SP [0x3D..0x3E] */
Index: libc/stdlib/stdlib_private.h
===================================================================
RCS file: /sources/avr-libc/avr-libc/libc/stdlib/stdlib_private.h,v
retrieving revision 1.2
diff -u -p -r1.2 stdlib_private.h
--- libc/stdlib/stdlib_private.h        13 Sep 2005 13:29:54 -0000      1.2
+++ libc/stdlib/stdlib_private.h        6 Jun 2007 21:45:03 -0000
@@ -31,6 +31,7 @@
 
 #include <inttypes.h>
 #include <stdlib.h>
+#include <avr/io.h>
 
 #if !defined(__DOXYGEN__)
 
@@ -83,6 +84,6 @@ extern char mymem[];    
 extern char __heap_start;
 extern char __heap_end;
 
-#define STACK_POINTER() ((char *)SP)
+#define STACK_POINTER() ((char *)AVR_STACK_POINTER_REG)
 
 #endif /* MALLOC_TEST */
Index: libm/fplib/strtod.S
===================================================================
RCS file: /sources/avr-libc/avr-libc/libm/fplib/Attic/strtod.S,v
retrieving revision 1.10.2.1
diff -u -p -r1.10.2.1 strtod.S
--- libm/fplib/strtod.S 1 Jan 2007 21:43:51 -0000       1.10.2.1
+++ libm/fplib/strtod.S 6 Jun 2007 21:45:05 -0000
@@ -243,8 +243,12 @@ GLOBAL(strtod)
        ST      Z,rEndptrH
 1:
        LDI     ZL,18-6 ; number of all 'pushed' registers - not pushed ones
-       IN      YL,_SFR_IO_ADDR(SPL)
-       IN      YH,_SFR_IO_ADDR(SPH)
+       IN      YL,AVR_STACK_POINTER_LO_ADDR
+#ifdef _HAVE_AVR_STACK_POINTER_HI
+       IN      YH,AVR_STACK_POINTER_HI_ADDR
+#else
+    CLR YH
+#endif
        EPILOGUE_RESTORES(6)
 
 .L_overflow:
@@ -376,7 +380,7 @@ GLOBAL(strtod)
        clr     XH
 #if __AVR_3_BYTE_PC__
        pop     ZH
-       out     _SFR_IO_ADDR(EIND), ZH
+       out     AVR_EXTENDED_INDIRECT_ADDR, ZH
 #endif /* __AVR_3_BYTE_PC__ */
        pop     ZH
        pop     ZL
--- include/avr/common.h        1969-12-31 17:00:00.000000000 -0700
+++ include/avr/common.h        2007-06-06 13:29:02.360846200 -0600
@@ -0,0 +1,235 @@
+/* Copyright (c) 2007 Eric B. Weddington
+   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$ */
+
+
+#ifndef _AVR_COMMON_H
+#define _AVR_COMMON_H
+
+#include <avr/sfr_defs.h>
+
+/* 
+This purpose of this header is to define registers that have not been 
+previously defined in the individual device IO header files, and to define 
+other symbols that are common across AVR device families.
+
+This file is designed to be included in <avr/io.h> after the individual
+device IO header files, and after <avr/sfr_defs.h>
+
+*/
+
+/*------------ Registers Not Previously Defined ------------*/
+
+/* 
+These are registers that are not previously defined in the individual
+IO header files, OR they are defined here because they are used in parts of
+avr-libc even if a device is not selected but a general architecture has
+been selected.
+*/
+
+
+/*
+Stack pointer register.
+
+AVR architecture 1 has no RAM, thus no stack pointer. 
+
+All other architectures do have a stack pointer.  Some devices have only
+less than 256 bytes of possible RAM locations (128 Bytes of SRAM
+and no option for external RAM), thus SPH is officially "reserved"
+for them.
+
+*/
+#if __AVR_ARCH__ != 1
+
+#  ifndef SPL
+#    define SPL _SFR_IO8(0x3D)
+#  endif
+#  if XRAMEND < 0x100
+#    ifndef SP
+#      define SP  _SFR_IO8(0x3D)
+#    endif
+#  else
+#    ifndef SP
+#      define SP  _SFR_IO16(0x3D)
+#    endif
+#    ifndef SPH
+#      define SPH _SFR_IO8(0x3E)
+#    endif
+#  endif /* XRAMEND < 0x100 && !defined(__COMPILING_AVR_LIBC__) */
+
+#endif /* __AVR_ARCH__ != 1 */
+
+
+/* Status Register */
+#ifndef SREG
+#  define SREG _SFR_IO8(0x3F)
+#endif
+
+/* SREG bit definitions */
+#ifndef SREG_C
+#  define SREG_C  (0)
+#endif
+#ifndef SREG_Z
+#  define SREG_Z  (1)
+#endif
+#ifndef SREG_N
+#  define SREG_N  (2)
+#endif
+#ifndef SREG_V
+#  define SREG_V  (3)
+#endif
+#ifndef SREG_S
+#  define SREG_S  (4)
+#endif
+#ifndef SREG_H
+#  define SREG_H  (5)
+#endif
+#ifndef SREG_T
+#  define SREG_T  (6)
+#endif
+#ifndef SREG_I
+#  define SREG_I  (7)
+#endif
+
+
+/* AVR 6 Architecture */
+#if __AVR_ARCH__ == 6
+#  ifndef EIND
+#    define EIND  _SFR_IO8(0X3C)
+#  endif
+#endif /* __AVR_ARCH__ == 6 */
+
+
+
+#if defined(__COMPILING_AVR_LIBC__)
+
+/*
+Only few devices come without EEPROM.  In order to assemble the
+EEPROM library components without defining a specific device, we
+keep the EEPROM-related definitions here.
+*/
+
+/* EEPROM Control Register */
+#  ifndef EECR
+#    define EECR   _SFR_IO8(0x1C)
+#  endif
+
+/* EEPROM Data Register */
+#  ifndef EEDR
+#    define EEDR   _SFR_IO8(0x1D)
+#  endif
+
+/* EEPROM Address Register */
+#  ifndef EEAR
+#    define EEAR   _SFR_IO16(0x1E)
+#  endif
+#  ifndef EEARL
+#    define EEARL  _SFR_IO8(0x1E)
+#  endif
+#  ifndef EEARH
+#    define EEARH  _SFR_IO8(0x1F)
+#  endif
+
+/* EEPROM Control Register bits */
+#  ifndef EERE
+#    define EERE   (0)
+#  endif
+#  ifndef EEWE
+#    define EEWE   (1)
+#  endif
+#  ifndef EEMWE
+#    define EEMWE  (2)
+#  endif
+#  ifndef EERIE
+#    define EERIE  (3)
+#  endif
+
+#endif /* __COMPILING_AVR_LIBC__ */
+
+
+
+/*------------ Common Symbols ------------*/
+
+/* 
+Generic definitions for registers that are common across multiple AVR devices
+and families.
+*/
+
+/* Pointer registers definitions */
+#if __AVR_ARCH__ != 1  /* avr1 does not have X and Y pointers */
+#  define XL  r26
+#  define XH  r27
+#  define YL  r28
+#  define YH  r29
+#endif /* #if __AVR_ARCH__ != 1 */
+#define ZL  r30
+#define ZH  r31
+
+
+/* Status Register */
+#if defined(SREG)
+#  define AVR_STATUS_REG   SREG
+#  define AVR_STATUS_ADDR  _SFR_IO_ADDR(SREG)
+#endif
+
+/* Stack Pointer (combined) Register */
+#if defined(SP)
+#  define AVR_STACK_POINTER_REG   SP
+#  define AVR_STACK_POINTER_ADDR  _SFR_IO_ADDR(SP)
+#endif
+
+/* Stack Pointer High Register */
+#if defined(SPH)
+#  define _HAVE_AVR_STACK_POINTER_HI 1
+#  define AVR_STACK_POINTER_HI_REG   SPH
+#  define AVR_STACK_POINTER_HI_ADDR  _SFR_IO_ADDR(SPH)
+#endif
+
+/* Stack Pointer Low Register */
+#if defined(SPL)
+#  define AVR_STACK_POINTER_LO_REG   SPL
+#  define AVR_STACK_POINTER_LO_ADDR  _SFR_IO_ADDR(SPL)
+#endif
+
+/* RAMPZ Register */
+#if defined(RAMPZ)
+#  define AVR_RAMPZ_REG   RAMPZ
+#  define AVR_RAMPZ_ADDR  _SFR_IO_ADDR(RAMPZ)
+#endif
+
+/* Extended Indirect Register */
+#if defined(EIND)
+#  define AVR_EXTENDED_INDIRECT_REG   EIND
+#  define AVR_EXTENDED_INDIRECT_ADDR  _SFR_IO_ADDR(EIND)
+#endif
+
+
+#endif /* _AVR_COMMON_H */
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to