OSDN Git Service

PR target/49868
authorgjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Feb 2012 08:44:08 +0000 (08:44 +0000)
committergjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Feb 2012 08:44:08 +0000 (08:44 +0000)
PR target/52261
* doc/extend.texi (AVR Named Address Spaces): No more try to fix
address spaces located outside of device flash.
* config/avr/avr.h (base_arch_s): Remove field n_segments.
(mcu_type_s): Add field n_flash.
* config/avr/avr-devices.c (avr_arch_types): Remove .n_segments.
Set .have_elpm and .have_elpmx to 1 for avrxmega4 and avrxmega5.
(AVR_MCU): Add N_FLASH argument.
* config/avr/avr-mcus.def (AVR_MCU): Add initializer for .n_flash.
* config/avr/avr-c.c (avr_cpu_cpp_builtins): Only define built-in
macro __FLASH<n> if that address space makes sense for the device.
* config/avr/avr.c (avr_out_lpm): Don't try to fix address spaces
outside of target flash.
(avr_asm_named_section): Ditto.
(avr_asm_select_section): Ditto.
(avr_addr_space_convert): Ditto.
(avr_emit_movmemhi): Ditto.
(avr_nonconst_pointer_addrspace, avr_pgm_check_var_decl): Error if
address space is outside of device flash.
(avr_insert_attributes): Ditto.
(avr_xload_libgcc_p): Use avr_current_device->n_flash instead of
avr_current_arch->n_segments.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184614 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/avr/avr-c.c
gcc/config/avr/avr-devices.c
gcc/config/avr/avr-mcus.def
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/doc/extend.texi

index 27e196e..3adb7c9 100644 (file)
@@ -1,3 +1,30 @@
+2012-02-28  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR target/49868
+       PR target/52261
+       * doc/extend.texi (AVR Named Address Spaces): No more try to fix
+       address spaces located outside of device flash.
+
+       * config/avr/avr.h (base_arch_s): Remove field n_segments.
+       (mcu_type_s): Add field n_flash.
+       * config/avr/avr-devices.c (avr_arch_types): Remove .n_segments.
+       Set .have_elpm and .have_elpmx to 1 for avrxmega4 and avrxmega5.
+       (AVR_MCU): Add N_FLASH argument.
+       * config/avr/avr-mcus.def (AVR_MCU): Add initializer for .n_flash.
+       * config/avr/avr-c.c (avr_cpu_cpp_builtins): Only define built-in
+       macro __FLASH<n> if that address space makes sense for the device.
+       * config/avr/avr.c (avr_out_lpm): Don't try to fix address spaces
+       outside of target flash.
+       (avr_asm_named_section): Ditto.
+       (avr_asm_select_section): Ditto.
+       (avr_addr_space_convert): Ditto.
+       (avr_emit_movmemhi): Ditto.
+       (avr_nonconst_pointer_addrspace, avr_pgm_check_var_decl): Error if
+       address space is outside of device flash.
+       (avr_insert_attributes): Ditto.
+       (avr_xload_libgcc_p): Use avr_current_device->n_flash instead of
+       avr_current_arch->n_segments.
+
 2012-02-27  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/52352
index aabeb21..64f5f80 100644 (file)
@@ -143,7 +143,11 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
       int i;
       
       for (i = 0; avr_addrspace[i].name; i++)
-        if (!ADDR_SPACE_GENERIC_P (i))
+        if (!ADDR_SPACE_GENERIC_P (i)
+            /* Only supply __FLASH<n> macro if the address space is reasonable
+               for this target.  The address space qualifier itself is still
+               supported, but using it will throw an error.  */
+            && avr_addrspace[i].segment < avr_current_device->n_flash)
           {
             const char *name = avr_addrspace[i].name;
             char *Name = (char*) alloca (1 + strlen (name));
index d044854..4f8696b 100644 (file)
@@ -30,34 +30,34 @@ const struct base_arch_s
 avr_arch_types[] =
 {
   /* unknown device specified */
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1, NULL,              "avr2"  },
+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, NULL,              "avr2"  },
   /*
-    A  M  J  LM E  E  E  X  R   d S   S O  # F  A
-    S  U  M  PO L  L  I  M  A   a t   F ff 6 l  r
-    M  L  P  MV P  P  J  E  M   t a   R s  4 a  c 
-             XW M  M  M  G  P   a r     e    s  h
-                   X  P  A  D     t     t  k h  ID   */
-  { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1,  "1",   "avr1"  },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1,  "2",   "avr2"  },
-  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  "25",  "avr25" },
-  { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1,  "3",   "avr3"  },
-  { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0x0060, 32, 2,  "31",  "avr31" },
-  { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  "35",  "avr35" },
-  { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  "4",   "avr4"  },
-  { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1,  "5",   "avr5"  },
-  { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, 32, 2,  "51",  "avr51" },
-  { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0x0060, 32, 4,  "6",   "avr6"  },
+    A  M  J  LM E  E  E  X  R   d S   S O   A
+    S  U  M  PO L  L  I  M  A   a t   F ff  r
+    M  L  P  MV P  P  J  E  M   t a   R s   c 
+             XW M  M  M  G  P   a r     e   h
+                   X  P  A  D     t     t   ID   */
+  { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, "1",   "avr1"  },
+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, "2",   "avr2"  },
+  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, "25",  "avr25" },
+  { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, "3",   "avr3"  },
+  { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0x0060, 32, "31",  "avr31" },
+  { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, "35",  "avr35" },
+  { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, "4",   "avr4"  },
+  { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, "5",   "avr5"  },
+  { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, 32, "51",  "avr51" },
+  { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0x0060, 32, "6",   "avr6"  },
 
-  { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0x2000,  0, 1,  "102", "avrxmega2" },
-  { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0x2000,  0, 1,  "104", "avrxmega4" }, /* Same */
-  { 0, 1, 1, 1, 0, 0, 0, 1, 1, 0x2000,  0, 1,  "105", "avrxmega5" },
-  { 0, 1, 1, 1, 1, 1, 1, 1, 0, 0x2000,  0, 4,  "106", "avrxmega6" },
-  { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0x2000,  0, 4,  "107", "avrxmega7" }
+  { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0x2000,  0, "102", "avrxmega2" },
+  { 0, 1, 1, 1, 1, 1, 0, 1, 0, 0x2000,  0, "104", "avrxmega4" },
+  { 0, 1, 1, 1, 1, 1, 0, 1, 1, 0x2000,  0, "105", "avrxmega5" },
+  { 0, 1, 1, 1, 1, 1, 1, 1, 0, 0x2000,  0, "106", "avrxmega6" },
+  { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0x2000,  0, "107", "avrxmega7" }
 };
 
 const struct mcu_type_s avr_mcu_types[] = {
-#define AVR_MCU(NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, LIBRARY_NAME) \
-  { NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, LIBRARY_NAME },
+#define AVR_MCU(NAME,ARCH,MACRO,SHORT_SP,ERRATA_SKIP,DATA_SEC,N_FLASH,LIB_NAME)\
+  { NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, N_FLASH, LIB_NAME },
 #include "avr-mcus.def"
 #undef AVR_MCU
     /* End of list.  */
index 03a92b4..462d6a2 100644 (file)
 
    Before including this file, define a macro:
 
-   AVR_MCU (NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, LIBRARY_NAME)
+   AVR_MCU (NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, N_FLASH, LIBRARY_NAME)
 
    where the arguments are the fields of struct mcu_type_s.  */
 
 /* "avr2" must be first for the "0" default to work as intended.  */
 
 /* Classic, <= 8K.  */
-AVR_MCU ("avr2",                 ARCH_AVR2, NULL,                        0, 1, 0x0060, "s8515")
-AVR_MCU ("at90s2313",            ARCH_AVR2, "__AVR_AT90S2313__",         1, 0, 0x0060, "s2313")
-AVR_MCU ("at90s2323",            ARCH_AVR2, "__AVR_AT90S2323__",         1, 0, 0x0060, "s2323")
-AVR_MCU ("at90s2333",            ARCH_AVR2, "__AVR_AT90S2333__",         1, 0, 0x0060, "s2333")
-AVR_MCU ("at90s2343",            ARCH_AVR2, "__AVR_AT90S2343__",         1, 0, 0x0060, "s2343")
-AVR_MCU ("attiny22",             ARCH_AVR2, "__AVR_ATtiny22__",          1, 0, 0x0060, "tn22")
-AVR_MCU ("attiny26",             ARCH_AVR2, "__AVR_ATtiny26__",          1, 0, 0x0060, "tn26")
-AVR_MCU ("at90s4414",            ARCH_AVR2, "__AVR_AT90S4414__",         0, 0, 0x0060, "s4414")
-AVR_MCU ("at90s4433",            ARCH_AVR2, "__AVR_AT90S4433__",         1, 0, 0x0060, "s4433")
-AVR_MCU ("at90s4434",            ARCH_AVR2, "__AVR_AT90S4434__",         0, 0, 0x0060, "s4434")
-AVR_MCU ("at90s8515",            ARCH_AVR2, "__AVR_AT90S8515__",         0, 1, 0x0060, "s8515")
-AVR_MCU ("at90c8534",            ARCH_AVR2, "__AVR_AT90C8534__",         0, 0, 0x0060, "c8534")
-AVR_MCU ("at90s8535",            ARCH_AVR2, "__AVR_AT90S8535__",         0, 0, 0x0060, "s8535")
+AVR_MCU ("avr2",                 ARCH_AVR2, NULL,                        0, 1, 0x0060, 6, "s8515")
+AVR_MCU ("at90s2313",            ARCH_AVR2, "__AVR_AT90S2313__",         1, 0, 0x0060, 1, "s2313")
+AVR_MCU ("at90s2323",            ARCH_AVR2, "__AVR_AT90S2323__",         1, 0, 0x0060, 1, "s2323")
+AVR_MCU ("at90s2333",            ARCH_AVR2, "__AVR_AT90S2333__",         1, 0, 0x0060, 1, "s2333")
+AVR_MCU ("at90s2343",            ARCH_AVR2, "__AVR_AT90S2343__",         1, 0, 0x0060, 1, "s2343")
+AVR_MCU ("attiny22",             ARCH_AVR2, "__AVR_ATtiny22__",          1, 0, 0x0060, 1, "tn22")
+AVR_MCU ("attiny26",             ARCH_AVR2, "__AVR_ATtiny26__",          1, 0, 0x0060, 1, "tn26")
+AVR_MCU ("at90s4414",            ARCH_AVR2, "__AVR_AT90S4414__",         0, 0, 0x0060, 1, "s4414")
+AVR_MCU ("at90s4433",            ARCH_AVR2, "__AVR_AT90S4433__",         1, 0, 0x0060, 1, "s4433")
+AVR_MCU ("at90s4434",            ARCH_AVR2, "__AVR_AT90S4434__",         0, 0, 0x0060, 1, "s4434")
+AVR_MCU ("at90s8515",            ARCH_AVR2, "__AVR_AT90S8515__",         0, 1, 0x0060, 1, "s8515")
+AVR_MCU ("at90c8534",            ARCH_AVR2, "__AVR_AT90C8534__",         0, 0, 0x0060, 1, "c8534")
+AVR_MCU ("at90s8535",            ARCH_AVR2, "__AVR_AT90S8535__",         0, 0, 0x0060, 1, "s8535")
 /* Classic + MOVW, <= 8K.  */
-AVR_MCU ("avr25",                ARCH_AVR25, NULL,                       0, 0, 0x0060, "tn85")
-AVR_MCU ("ata6289",              ARCH_AVR25, "__AVR_ATA6289__",          0, 0, 0x0100, "a6289")
-AVR_MCU ("attiny13",             ARCH_AVR25, "__AVR_ATtiny13__",         1, 0, 0x0060, "tn13")
-AVR_MCU ("attiny13a",            ARCH_AVR25, "__AVR_ATtiny13A__",        1, 0, 0x0060, "tn13a")
-AVR_MCU ("attiny2313",           ARCH_AVR25, "__AVR_ATtiny2313__",       1, 0, 0x0060, "tn2313")
-AVR_MCU ("attiny2313a",          ARCH_AVR25, "__AVR_ATtiny2313A__",      1, 0, 0x0060, "tn2313a")
-AVR_MCU ("attiny24",             ARCH_AVR25, "__AVR_ATtiny24__",         1, 0, 0x0060, "tn24")
-AVR_MCU ("attiny24a",            ARCH_AVR25, "__AVR_ATtiny24A__",        1, 0, 0x0060, "tn24a")
-AVR_MCU ("attiny4313",           ARCH_AVR25, "__AVR_ATtiny4313__",       0, 0, 0x0060, "tn4313")
-AVR_MCU ("attiny44",             ARCH_AVR25, "__AVR_ATtiny44__",         0, 0, 0x0060, "tn44")
-AVR_MCU ("attiny44a",            ARCH_AVR25, "__AVR_ATtiny44A__",        0, 0, 0x0060, "tn44a")
-AVR_MCU ("attiny84",             ARCH_AVR25, "__AVR_ATtiny84__",         0, 0, 0x0060, "tn84")
-AVR_MCU ("attiny84a",            ARCH_AVR25, "__AVR_ATtiny84A__",        0, 0, 0x0060, "tn84")
-AVR_MCU ("attiny25",             ARCH_AVR25, "__AVR_ATtiny25__",         1, 0, 0x0060, "tn25")
-AVR_MCU ("attiny45",             ARCH_AVR25, "__AVR_ATtiny45__",         0, 0, 0x0060, "tn45")
-AVR_MCU ("attiny85",             ARCH_AVR25, "__AVR_ATtiny85__",         0, 0, 0x0060, "tn85")
-AVR_MCU ("attiny261",            ARCH_AVR25, "__AVR_ATtiny261__",        1, 0, 0x0060, "tn261")
-AVR_MCU ("attiny261a",           ARCH_AVR25, "__AVR_ATtiny261A__",       1, 0, 0x0060, "tn261a")
-AVR_MCU ("attiny461",            ARCH_AVR25, "__AVR_ATtiny461__",        0, 0, 0x0060, "tn461")
-AVR_MCU ("attiny461a",           ARCH_AVR25, "__AVR_ATtiny461A__",       0, 0, 0x0060, "tn461a")
-AVR_MCU ("attiny861",            ARCH_AVR25, "__AVR_ATtiny861__",        0, 0, 0x0060, "tn861")
-AVR_MCU ("attiny861a",           ARCH_AVR25, "__AVR_ATtiny861A__",       0, 0, 0x0060, "tn861a")
-AVR_MCU ("attiny43u",            ARCH_AVR25, "__AVR_ATtiny43U__",        0, 0, 0x0060, "tn43u")
-AVR_MCU ("attiny87",             ARCH_AVR25, "__AVR_ATtiny87__",         0, 0, 0x0100, "tn87")
-AVR_MCU ("attiny48",             ARCH_AVR25, "__AVR_ATtiny48__",         0, 0, 0x0100, "tn48")
-AVR_MCU ("attiny88",             ARCH_AVR25, "__AVR_ATtiny88__",         0, 0, 0x0100, "tn88")
-AVR_MCU ("at86rf401",            ARCH_AVR25, "__AVR_AT86RF401__",        0, 0, 0x0060, "86401")
+AVR_MCU ("avr25",                ARCH_AVR25, NULL,                       0, 0, 0x0060, 1, "tn85")
+AVR_MCU ("ata6289",              ARCH_AVR25, "__AVR_ATA6289__",          0, 0, 0x0100, 1, "a6289")
+AVR_MCU ("attiny13",             ARCH_AVR25, "__AVR_ATtiny13__",         1, 0, 0x0060, 1, "tn13")
+AVR_MCU ("attiny13a",            ARCH_AVR25, "__AVR_ATtiny13A__",        1, 0, 0x0060, 1, "tn13a")
+AVR_MCU ("attiny2313",           ARCH_AVR25, "__AVR_ATtiny2313__",       1, 0, 0x0060, 1, "tn2313")
+AVR_MCU ("attiny2313a",          ARCH_AVR25, "__AVR_ATtiny2313A__",      1, 0, 0x0060, 1, "tn2313a")
+AVR_MCU ("attiny24",             ARCH_AVR25, "__AVR_ATtiny24__",         1, 0, 0x0060, 1, "tn24")
+AVR_MCU ("attiny24a",            ARCH_AVR25, "__AVR_ATtiny24A__",        1, 0, 0x0060, 1, "tn24a")
+AVR_MCU ("attiny4313",           ARCH_AVR25, "__AVR_ATtiny4313__",       0, 0, 0x0060, 1, "tn4313")
+AVR_MCU ("attiny44",             ARCH_AVR25, "__AVR_ATtiny44__",         0, 0, 0x0060, 1, "tn44")
+AVR_MCU ("attiny44a",            ARCH_AVR25, "__AVR_ATtiny44A__",        0, 0, 0x0060, 1, "tn44a")
+AVR_MCU ("attiny84",             ARCH_AVR25, "__AVR_ATtiny84__",         0, 0, 0x0060, 1, "tn84")
+AVR_MCU ("attiny84a",            ARCH_AVR25, "__AVR_ATtiny84A__",        0, 0, 0x0060, 1, "tn84")
+AVR_MCU ("attiny25",             ARCH_AVR25, "__AVR_ATtiny25__",         1, 0, 0x0060, 1, "tn25")
+AVR_MCU ("attiny45",             ARCH_AVR25, "__AVR_ATtiny45__",         0, 0, 0x0060, 1, "tn45")
+AVR_MCU ("attiny85",             ARCH_AVR25, "__AVR_ATtiny85__",         0, 0, 0x0060, 1, "tn85")
+AVR_MCU ("attiny261",            ARCH_AVR25, "__AVR_ATtiny261__",        1, 0, 0x0060, 1, "tn261")
+AVR_MCU ("attiny261a",           ARCH_AVR25, "__AVR_ATtiny261A__",       1, 0, 0x0060, 1, "tn261a")
+AVR_MCU ("attiny461",            ARCH_AVR25, "__AVR_ATtiny461__",        0, 0, 0x0060, 1, "tn461")
+AVR_MCU ("attiny461a",           ARCH_AVR25, "__AVR_ATtiny461A__",       0, 0, 0x0060, 1, "tn461a")
+AVR_MCU ("attiny861",            ARCH_AVR25, "__AVR_ATtiny861__",        0, 0, 0x0060, 1, "tn861")
+AVR_MCU ("attiny861a",           ARCH_AVR25, "__AVR_ATtiny861A__",       0, 0, 0x0060, 1, "tn861a")
+AVR_MCU ("attiny43u",            ARCH_AVR25, "__AVR_ATtiny43U__",        0, 0, 0x0060, 1, "tn43u")
+AVR_MCU ("attiny87",             ARCH_AVR25, "__AVR_ATtiny87__",         0, 0, 0x0100, 1, "tn87")
+AVR_MCU ("attiny48",             ARCH_AVR25, "__AVR_ATtiny48__",         0, 0, 0x0100, 1, "tn48")
+AVR_MCU ("attiny88",             ARCH_AVR25, "__AVR_ATtiny88__",         0, 0, 0x0100, 1, "tn88")
+AVR_MCU ("at86rf401",            ARCH_AVR25, "__AVR_AT86RF401__",        0, 0, 0x0060, 1, "86401")
 /* Classic, > 8K, <= 64K.  */
-AVR_MCU ("avr3",                 ARCH_AVR3, NULL,                        0, 0, 0x0060, "43355")
-AVR_MCU ("at43usb355",           ARCH_AVR3, "__AVR_AT43USB355__",        0, 0, 0x0060, "43355")
-AVR_MCU ("at76c711",             ARCH_AVR3, "__AVR_AT76C711__",          0, 0, 0x0060, "76711")
+AVR_MCU ("avr3",                 ARCH_AVR3, NULL,                        0, 0, 0x0060, 1, "43355")
+AVR_MCU ("at43usb355",           ARCH_AVR3, "__AVR_AT43USB355__",        0, 0, 0x0060, 1, "43355")
+AVR_MCU ("at76c711",             ARCH_AVR3, "__AVR_AT76C711__",          0, 0, 0x0060, 1, "76711")
 /* Classic, == 128K.  */
-AVR_MCU ("avr31",                ARCH_AVR31, NULL,                       0, 1, 0x0060, "m103")
-AVR_MCU ("atmega103",            ARCH_AVR31, "__AVR_ATmega103__",        0, 1, 0x0060, "m103")
-AVR_MCU ("at43usb320",           ARCH_AVR31, "__AVR_AT43USB320__",       0, 0, 0x0060, "43320")
+AVR_MCU ("avr31",                ARCH_AVR31, NULL,                       0, 1, 0x0060, 2, "m103")
+AVR_MCU ("atmega103",            ARCH_AVR31, "__AVR_ATmega103__",        0, 1, 0x0060, 2, "m103")
+AVR_MCU ("at43usb320",           ARCH_AVR31, "__AVR_AT43USB320__",       0, 0, 0x0060, 2, "43320")
 /* Classic + MOVW + JMP/CALL.  */
-AVR_MCU ("avr35",                ARCH_AVR35, NULL,                       0, 0, 0x0100, "usb162")
-AVR_MCU ("at90usb82",            ARCH_AVR35, "__AVR_AT90USB82__",        0, 0, 0x0100, "usb82")
-AVR_MCU ("at90usb162",           ARCH_AVR35, "__AVR_AT90USB162__",       0, 0, 0x0100, "usb162")
-AVR_MCU ("atmega8u2",            ARCH_AVR35, "__AVR_ATmega8U2__",        0, 0, 0x0100, "m8u2")
-AVR_MCU ("atmega16u2",           ARCH_AVR35, "__AVR_ATmega16U2__",       0, 0, 0x0100, "m16u2")
-AVR_MCU ("atmega32u2",           ARCH_AVR35, "__AVR_ATmega32U2__",       0, 0, 0x0100, "m32u2")
-AVR_MCU ("attiny167",            ARCH_AVR35, "__AVR_ATtiny167__",        0, 0, 0x0100, "tn167")
+AVR_MCU ("avr35",                ARCH_AVR35, NULL,                       0, 0, 0x0100, 1, "usb162")
+AVR_MCU ("at90usb82",            ARCH_AVR35, "__AVR_AT90USB82__",        0, 0, 0x0100, 1, "usb82")
+AVR_MCU ("at90usb162",           ARCH_AVR35, "__AVR_AT90USB162__",       0, 0, 0x0100, 1, "usb162")
+AVR_MCU ("atmega8u2",            ARCH_AVR35, "__AVR_ATmega8U2__",        0, 0, 0x0100, 1, "m8u2")
+AVR_MCU ("atmega16u2",           ARCH_AVR35, "__AVR_ATmega16U2__",       0, 0, 0x0100, 1, "m16u2")
+AVR_MCU ("atmega32u2",           ARCH_AVR35, "__AVR_ATmega32U2__",       0, 0, 0x0100, 1, "m32u2")
+AVR_MCU ("attiny167",            ARCH_AVR35, "__AVR_ATtiny167__",        0, 0, 0x0100, 1, "tn167")
 /* Enhanced, <= 8K.  */
-AVR_MCU ("avr4",                 ARCH_AVR4, NULL,                        0, 0, 0x0060, "m8")
-AVR_MCU ("atmega8",              ARCH_AVR4, "__AVR_ATmega8__",           0, 0, 0x0060, "m8")
-AVR_MCU ("atmega48",             ARCH_AVR4, "__AVR_ATmega48__",          0, 0, 0x0100, "m48")
-AVR_MCU ("atmega48a",            ARCH_AVR4, "__AVR_ATmega48A__",         0, 0, 0x0100, "m48a")
-AVR_MCU ("atmega48p",            ARCH_AVR4, "__AVR_ATmega48P__",         0, 0, 0x0100, "m48p")
-AVR_MCU ("atmega88",             ARCH_AVR4, "__AVR_ATmega88__",          0, 0, 0x0100, "m88")
-AVR_MCU ("atmega88a",            ARCH_AVR4, "__AVR_ATmega88A__",         0, 0, 0x0100, "m88a")
-AVR_MCU ("atmega88p",            ARCH_AVR4, "__AVR_ATmega88P__",         0, 0, 0x0100, "m88p")
-AVR_MCU ("atmega88pa",           ARCH_AVR4, "__AVR_ATmega88PA__",        0, 0, 0x0100, "m88pa")
-AVR_MCU ("atmega8515",           ARCH_AVR4, "__AVR_ATmega8515__",        0, 0, 0x0060, "m8515")
-AVR_MCU ("atmega8535",           ARCH_AVR4, "__AVR_ATmega8535__",        0, 0, 0x0060, "m8535")
-AVR_MCU ("atmega8hva",           ARCH_AVR4, "__AVR_ATmega8HVA__",        0, 0, 0x0100, "m8hva")
-AVR_MCU ("at90pwm1",             ARCH_AVR4, "__AVR_AT90PWM1__",          0, 0, 0x0100, "90pwm1")
-AVR_MCU ("at90pwm2",             ARCH_AVR4, "__AVR_AT90PWM2__",          0, 0, 0x0100, "90pwm2")
-AVR_MCU ("at90pwm2b",            ARCH_AVR4, "__AVR_AT90PWM2B__",         0, 0, 0x0100, "90pwm2b")
-AVR_MCU ("at90pwm3",             ARCH_AVR4, "__AVR_AT90PWM3__",          0, 0, 0x0100, "90pwm3")
-AVR_MCU ("at90pwm3b",            ARCH_AVR4, "__AVR_AT90PWM3B__",         0, 0, 0x0100, "90pwm3b")
-AVR_MCU ("at90pwm81",            ARCH_AVR4, "__AVR_AT90PWM81__",         0, 0, 0x0100, "90pwm81")
+AVR_MCU ("avr4",                 ARCH_AVR4, NULL,                        0, 0, 0x0060, 1, "m8")
+AVR_MCU ("atmega8",              ARCH_AVR4, "__AVR_ATmega8__",           0, 0, 0x0060, 1, "m8")
+AVR_MCU ("atmega48",             ARCH_AVR4, "__AVR_ATmega48__",          0, 0, 0x0100, 1, "m48")
+AVR_MCU ("atmega48a",            ARCH_AVR4, "__AVR_ATmega48A__",         0, 0, 0x0100, 1, "m48a")
+AVR_MCU ("atmega48p",            ARCH_AVR4, "__AVR_ATmega48P__",         0, 0, 0x0100, 1, "m48p")
+AVR_MCU ("atmega88",             ARCH_AVR4, "__AVR_ATmega88__",          0, 0, 0x0100, 1, "m88")
+AVR_MCU ("atmega88a",            ARCH_AVR4, "__AVR_ATmega88A__",         0, 0, 0x0100, 1, "m88a")
+AVR_MCU ("atmega88p",            ARCH_AVR4, "__AVR_ATmega88P__",         0, 0, 0x0100, 1, "m88p")
+AVR_MCU ("atmega88pa",           ARCH_AVR4, "__AVR_ATmega88PA__",        0, 0, 0x0100, 1, "m88pa")
+AVR_MCU ("atmega8515",           ARCH_AVR4, "__AVR_ATmega8515__",        0, 0, 0x0060, 1, "m8515")
+AVR_MCU ("atmega8535",           ARCH_AVR4, "__AVR_ATmega8535__",        0, 0, 0x0060, 1, "m8535")
+AVR_MCU ("atmega8hva",           ARCH_AVR4, "__AVR_ATmega8HVA__",        0, 0, 0x0100, 1, "m8hva")
+AVR_MCU ("at90pwm1",             ARCH_AVR4, "__AVR_AT90PWM1__",          0, 0, 0x0100, 1, "90pwm1")
+AVR_MCU ("at90pwm2",             ARCH_AVR4, "__AVR_AT90PWM2__",          0, 0, 0x0100, 1, "90pwm2")
+AVR_MCU ("at90pwm2b",            ARCH_AVR4, "__AVR_AT90PWM2B__",         0, 0, 0x0100, 1, "90pwm2b")
+AVR_MCU ("at90pwm3",             ARCH_AVR4, "__AVR_AT90PWM3__",          0, 0, 0x0100, 1, "90pwm3")
+AVR_MCU ("at90pwm3b",            ARCH_AVR4, "__AVR_AT90PWM3B__",         0, 0, 0x0100, 1, "90pwm3b")
+AVR_MCU ("at90pwm81",            ARCH_AVR4, "__AVR_AT90PWM81__",         0, 0, 0x0100, 1, "90pwm81")
 /* Enhanced, > 8K, <= 64K.  */
-AVR_MCU ("avr5",                 ARCH_AVR5, NULL,                        0, 0, 0x0060, "m16")
-AVR_MCU ("atmega16",             ARCH_AVR5, "__AVR_ATmega16__",          0, 0, 0x0060, "m16")
-AVR_MCU ("atmega16a",            ARCH_AVR5, "__AVR_ATmega16A__",         0, 0, 0x0060, "m16a")
-AVR_MCU ("atmega161",            ARCH_AVR5, "__AVR_ATmega161__",         0, 0, 0x0060, "m161")
-AVR_MCU ("atmega162",            ARCH_AVR5, "__AVR_ATmega162__",         0, 0, 0x0100, "m162")
-AVR_MCU ("atmega163",            ARCH_AVR5, "__AVR_ATmega163__",         0, 0, 0x0060, "m163")
-AVR_MCU ("atmega164a",           ARCH_AVR5, "__AVR_ATmega164A__",        0, 0, 0x0100, "m164a")
-AVR_MCU ("atmega164p",           ARCH_AVR5, "__AVR_ATmega164P__",        0, 0, 0x0100, "m164p")
-AVR_MCU ("atmega165",            ARCH_AVR5, "__AVR_ATmega165__",         0, 0, 0x0100, "m165")
-AVR_MCU ("atmega165a",           ARCH_AVR5, "__AVR_ATmega165A__",        0, 0, 0x0100, "m165a")
-AVR_MCU ("atmega165p",           ARCH_AVR5, "__AVR_ATmega165P__",        0, 0, 0x0100, "m165p")
-AVR_MCU ("atmega168",            ARCH_AVR5, "__AVR_ATmega168__",         0, 0, 0x0100, "m168")
-AVR_MCU ("atmega168a",           ARCH_AVR5, "__AVR_ATmega168A__",        0, 0, 0x0100, "m168a")
-AVR_MCU ("atmega168p",           ARCH_AVR5, "__AVR_ATmega168P__",        0, 0, 0x0100, "m168p")
-AVR_MCU ("atmega169",            ARCH_AVR5, "__AVR_ATmega169__",         0, 0, 0x0100, "m169")
-AVR_MCU ("atmega169a",           ARCH_AVR5, "__AVR_ATmega169A__",        0, 0, 0x0100, "m169a")
-AVR_MCU ("atmega169p",           ARCH_AVR5, "__AVR_ATmega169P__",        0, 0, 0x0100, "m169p")
-AVR_MCU ("atmega169pa",          ARCH_AVR5, "__AVR_ATmega169PA__",       0, 0, 0x0100, "m169pa")
-AVR_MCU ("atmega32",             ARCH_AVR5, "__AVR_ATmega32__",          0, 0, 0x0060, "m32")
-AVR_MCU ("atmega323",            ARCH_AVR5, "__AVR_ATmega323__",         0, 0, 0x0060, "m323")
-AVR_MCU ("atmega324a",           ARCH_AVR5, "__AVR_ATmega324A__",        0, 0, 0x0100, "m324a")
-AVR_MCU ("atmega324p",           ARCH_AVR5, "__AVR_ATmega324P__",        0, 0, 0x0100, "m324p")
-AVR_MCU ("atmega324pa",          ARCH_AVR5, "__AVR_ATmega324PA__",       0, 0, 0x0100, "m324pa")
-AVR_MCU ("atmega325",            ARCH_AVR5, "__AVR_ATmega325__",         0, 0, 0x0100, "m325")
-AVR_MCU ("atmega325a",           ARCH_AVR5, "__AVR_ATmega325A__",        0, 0, 0x0100, "m325a")
-AVR_MCU ("atmega325p",           ARCH_AVR5, "__AVR_ATmega325P__",        0, 0, 0x0100, "m325p")
-AVR_MCU ("atmega3250",           ARCH_AVR5, "__AVR_ATmega3250__",        0, 0, 0x0100, "m3250")
-AVR_MCU ("atmega3250a",          ARCH_AVR5, "__AVR_ATmega3250A__",       0, 0, 0x0100, "m3250a")
-AVR_MCU ("atmega3250p",          ARCH_AVR5, "__AVR_ATmega3250P__",       0, 0, 0x0100, "m3250p")
-AVR_MCU ("atmega328",            ARCH_AVR5, "__AVR_ATmega328__",         0, 0, 0x0100, "m328")
-AVR_MCU ("atmega328p",           ARCH_AVR5, "__AVR_ATmega328P__",        0, 0, 0x0100, "m328p")
-AVR_MCU ("atmega329",            ARCH_AVR5, "__AVR_ATmega329__",         0, 0, 0x0100, "m329")
-AVR_MCU ("atmega329a",           ARCH_AVR5, "__AVR_ATmega329A__",        0, 0, 0x0100, "m329a")
-AVR_MCU ("atmega329p",           ARCH_AVR5, "__AVR_ATmega329P__",        0, 0, 0x0100, "m329p")
-AVR_MCU ("atmega329pa",          ARCH_AVR5, "__AVR_ATmega329PA__",       0, 0, 0x0100, "m329pa")
-AVR_MCU ("atmega3290",           ARCH_AVR5, "__AVR_ATmega3290__",        0, 0, 0x0100, "m3290")
-AVR_MCU ("atmega3290a",          ARCH_AVR5, "__AVR_ATmega3290A__",       0, 0, 0x0100, "m3290a")
-AVR_MCU ("atmega3290p",          ARCH_AVR5, "__AVR_ATmega3290P__",       0, 0, 0x0100, "m3290p")
-AVR_MCU ("atmega406",            ARCH_AVR5, "__AVR_ATmega406__",         0, 0, 0x0100, "m406")
-AVR_MCU ("atmega64",             ARCH_AVR5, "__AVR_ATmega64__",          0, 0, 0x0100, "m64")
-AVR_MCU ("atmega640",            ARCH_AVR5, "__AVR_ATmega640__",         0, 0, 0x0200, "m640")
-AVR_MCU ("atmega644",            ARCH_AVR5, "__AVR_ATmega644__",         0, 0, 0x0100, "m644")
-AVR_MCU ("atmega644a",           ARCH_AVR5, "__AVR_ATmega644A__",        0, 0, 0x0100, "m644a")
-AVR_MCU ("atmega644p",           ARCH_AVR5, "__AVR_ATmega644P__",        0, 0, 0x0100, "m644p")
-AVR_MCU ("atmega644pa",          ARCH_AVR5, "__AVR_ATmega644PA__",       0, 0, 0x0100, "m644pa")
-AVR_MCU ("atmega645",            ARCH_AVR5, "__AVR_ATmega645__",         0, 0, 0x0100, "m645")
-AVR_MCU ("atmega645a",           ARCH_AVR5, "__AVR_ATmega645A__",        0, 0, 0x0100, "m645a")
-AVR_MCU ("atmega645p",           ARCH_AVR5, "__AVR_ATmega645P__",        0, 0, 0x0100, "m645p")
-AVR_MCU ("atmega6450",           ARCH_AVR5, "__AVR_ATmega6450__",        0, 0, 0x0100, "m6450")
-AVR_MCU ("atmega6450a",          ARCH_AVR5, "__AVR_ATmega6450A__",       0, 0, 0x0100, "m6450a")
-AVR_MCU ("atmega6450p",          ARCH_AVR5, "__AVR_ATmega6450P__",       0, 0, 0x0100, "m6450p")
-AVR_MCU ("atmega649",            ARCH_AVR5, "__AVR_ATmega649__",         0, 0, 0x0100, "m649")
-AVR_MCU ("atmega649a",           ARCH_AVR5, "__AVR_ATmega649A__",        0, 0, 0x0100, "m649a")
-AVR_MCU ("atmega649p",           ARCH_AVR5, "__AVR_ATmega649P__",        0, 0, 0x0100, "m649p")
-AVR_MCU ("atmega6490",           ARCH_AVR5, "__AVR_ATmega6490__",        0, 0, 0x0100, "m6490")
-AVR_MCU ("atmega16hva",          ARCH_AVR5, "__AVR_ATmega16HVA__",       0, 0, 0x0100, "m16hva")
-AVR_MCU ("atmega16hva2",         ARCH_AVR5, "__AVR_ATmega16HVA2__",      0, 0, 0x0100, "m16hva2")
-AVR_MCU ("atmega16hvb",          ARCH_AVR5, "__AVR_ATmega16HVB__",       0, 0, 0x0100, "m16hvb")
-AVR_MCU ("atmega32hvb",          ARCH_AVR5, "__AVR_ATmega32HVB__",       0, 0, 0x0100, "m32hvb")
-AVR_MCU ("atmega64hve",          ARCH_AVR5, "__AVR_ATmega64HVE__",       0, 0, 0x0100, "m64hve")
-AVR_MCU ("at90can32",            ARCH_AVR5, "__AVR_AT90CAN32__",         0, 0, 0x0100, "can32")
-AVR_MCU ("at90can64",            ARCH_AVR5, "__AVR_AT90CAN64__",         0, 0, 0x0100, "can64")
-AVR_MCU ("at90pwm216",           ARCH_AVR5, "__AVR_AT90PWM216__",        0, 0, 0x0100, "90pwm216")
-AVR_MCU ("at90pwm316",           ARCH_AVR5, "__AVR_AT90PWM316__",        0, 0, 0x0100, "90pwm316")
-AVR_MCU ("atmega32c1",           ARCH_AVR5, "__AVR_ATmega32C1__",        0, 0, 0x0100, "m32c1")
-AVR_MCU ("atmega64c1",           ARCH_AVR5, "__AVR_ATmega64C1__",        0, 0, 0x0100, "m64c1")
-AVR_MCU ("atmega16m1",           ARCH_AVR5, "__AVR_ATmega16M1__",        0, 0, 0x0100, "m16m1")
-AVR_MCU ("atmega32m1",           ARCH_AVR5, "__AVR_ATmega32M1__",        0, 0, 0x0100, "m32m1")
-AVR_MCU ("atmega64m1",           ARCH_AVR5, "__AVR_ATmega64M1__",        0, 0, 0x0100, "m64m1")
-AVR_MCU ("atmega16u4",           ARCH_AVR5, "__AVR_ATmega16U4__",        0, 0, 0x0100, "m16u4")
-AVR_MCU ("atmega32u4",           ARCH_AVR5, "__AVR_ATmega32U4__",        0, 0, 0x0100, "m32u4")
-AVR_MCU ("atmega32u6",           ARCH_AVR5, "__AVR_ATmega32U6__",        0, 0, 0x0100, "m32u6")
-AVR_MCU ("at90scr100",           ARCH_AVR5, "__AVR_AT90SCR100__",        0, 0, 0x0100, "90scr100")
-AVR_MCU ("at90usb646",           ARCH_AVR5, "__AVR_AT90USB646__",        0, 0, 0x0100, "usb646")
-AVR_MCU ("at90usb647",           ARCH_AVR5, "__AVR_AT90USB647__",        0, 0, 0x0100, "usb647")
-AVR_MCU ("at94k",                ARCH_AVR5, "__AVR_AT94K__",             0, 0, 0x0060, "at94k")
-AVR_MCU ("m3000",                ARCH_AVR5, "__AVR_M3000__",             0, 0, 0x1000, "m3000")
+AVR_MCU ("avr5",                 ARCH_AVR5, NULL,                        0, 0, 0x0060, 1, "m16")
+AVR_MCU ("atmega16",             ARCH_AVR5, "__AVR_ATmega16__",          0, 0, 0x0060, 1, "m16")
+AVR_MCU ("atmega16a",            ARCH_AVR5, "__AVR_ATmega16A__",         0, 0, 0x0060, 1, "m16a")
+AVR_MCU ("atmega161",            ARCH_AVR5, "__AVR_ATmega161__",         0, 0, 0x0060, 1, "m161")
+AVR_MCU ("atmega162",            ARCH_AVR5, "__AVR_ATmega162__",         0, 0, 0x0100, 1, "m162")
+AVR_MCU ("atmega163",            ARCH_AVR5, "__AVR_ATmega163__",         0, 0, 0x0060, 1, "m163")
+AVR_MCU ("atmega164a",           ARCH_AVR5, "__AVR_ATmega164A__",        0, 0, 0x0100, 1, "m164a")
+AVR_MCU ("atmega164p",           ARCH_AVR5, "__AVR_ATmega164P__",        0, 0, 0x0100, 1, "m164p")
+AVR_MCU ("atmega165",            ARCH_AVR5, "__AVR_ATmega165__",         0, 0, 0x0100, 1, "m165")
+AVR_MCU ("atmega165a",           ARCH_AVR5, "__AVR_ATmega165A__",        0, 0, 0x0100, 1, "m165a")
+AVR_MCU ("atmega165p",           ARCH_AVR5, "__AVR_ATmega165P__",        0, 0, 0x0100, 1, "m165p")
+AVR_MCU ("atmega168",            ARCH_AVR5, "__AVR_ATmega168__",         0, 0, 0x0100, 1, "m168")
+AVR_MCU ("atmega168a",           ARCH_AVR5, "__AVR_ATmega168A__",        0, 0, 0x0100, 1, "m168a")
+AVR_MCU ("atmega168p",           ARCH_AVR5, "__AVR_ATmega168P__",        0, 0, 0x0100, 1, "m168p")
+AVR_MCU ("atmega169",            ARCH_AVR5, "__AVR_ATmega169__",         0, 0, 0x0100, 1, "m169")
+AVR_MCU ("atmega169a",           ARCH_AVR5, "__AVR_ATmega169A__",        0, 0, 0x0100, 1, "m169a")
+AVR_MCU ("atmega169p",           ARCH_AVR5, "__AVR_ATmega169P__",        0, 0, 0x0100, 1, "m169p")
+AVR_MCU ("atmega169pa",          ARCH_AVR5, "__AVR_ATmega169PA__",       0, 0, 0x0100, 1, "m169pa")
+AVR_MCU ("atmega32",             ARCH_AVR5, "__AVR_ATmega32__",          0, 0, 0x0060, 1, "m32")
+AVR_MCU ("atmega323",            ARCH_AVR5, "__AVR_ATmega323__",         0, 0, 0x0060, 1, "m323")
+AVR_MCU ("atmega324a",           ARCH_AVR5, "__AVR_ATmega324A__",        0, 0, 0x0100, 1, "m324a")
+AVR_MCU ("atmega324p",           ARCH_AVR5, "__AVR_ATmega324P__",        0, 0, 0x0100, 1, "m324p")
+AVR_MCU ("atmega324pa",          ARCH_AVR5, "__AVR_ATmega324PA__",       0, 0, 0x0100, 1, "m324pa")
+AVR_MCU ("atmega325",            ARCH_AVR5, "__AVR_ATmega325__",         0, 0, 0x0100, 1, "m325")
+AVR_MCU ("atmega325a",           ARCH_AVR5, "__AVR_ATmega325A__",        0, 0, 0x0100, 1, "m325a")
+AVR_MCU ("atmega325p",           ARCH_AVR5, "__AVR_ATmega325P__",        0, 0, 0x0100, 1, "m325p")
+AVR_MCU ("atmega3250",           ARCH_AVR5, "__AVR_ATmega3250__",        0, 0, 0x0100, 1, "m3250")
+AVR_MCU ("atmega3250a",          ARCH_AVR5, "__AVR_ATmega3250A__",       0, 0, 0x0100, 1, "m3250a")
+AVR_MCU ("atmega3250p",          ARCH_AVR5, "__AVR_ATmega3250P__",       0, 0, 0x0100, 1, "m3250p")
+AVR_MCU ("atmega328",            ARCH_AVR5, "__AVR_ATmega328__",         0, 0, 0x0100, 1, "m328")
+AVR_MCU ("atmega328p",           ARCH_AVR5, "__AVR_ATmega328P__",        0, 0, 0x0100, 1, "m328p")
+AVR_MCU ("atmega329",            ARCH_AVR5, "__AVR_ATmega329__",         0, 0, 0x0100, 1, "m329")
+AVR_MCU ("atmega329a",           ARCH_AVR5, "__AVR_ATmega329A__",        0, 0, 0x0100, 1, "m329a")
+AVR_MCU ("atmega329p",           ARCH_AVR5, "__AVR_ATmega329P__",        0, 0, 0x0100, 1, "m329p")
+AVR_MCU ("atmega329pa",          ARCH_AVR5, "__AVR_ATmega329PA__",       0, 0, 0x0100, 1, "m329pa")
+AVR_MCU ("atmega3290",           ARCH_AVR5, "__AVR_ATmega3290__",        0, 0, 0x0100, 1, "m3290")
+AVR_MCU ("atmega3290a",          ARCH_AVR5, "__AVR_ATmega3290A__",       0, 0, 0x0100, 1, "m3290a")
+AVR_MCU ("atmega3290p",          ARCH_AVR5, "__AVR_ATmega3290P__",       0, 0, 0x0100, 1, "m3290p")
+AVR_MCU ("atmega406",            ARCH_AVR5, "__AVR_ATmega406__",         0, 0, 0x0100, 1, "m406")
+AVR_MCU ("atmega64",             ARCH_AVR5, "__AVR_ATmega64__",          0, 0, 0x0100, 1, "m64")
+AVR_MCU ("atmega640",            ARCH_AVR5, "__AVR_ATmega640__",         0, 0, 0x0200, 1, "m640")
+AVR_MCU ("atmega644",            ARCH_AVR5, "__AVR_ATmega644__",         0, 0, 0x0100, 1, "m644")
+AVR_MCU ("atmega644a",           ARCH_AVR5, "__AVR_ATmega644A__",        0, 0, 0x0100, 1, "m644a")
+AVR_MCU ("atmega644p",           ARCH_AVR5, "__AVR_ATmega644P__",        0, 0, 0x0100, 1, "m644p")
+AVR_MCU ("atmega644pa",          ARCH_AVR5, "__AVR_ATmega644PA__",       0, 0, 0x0100, 1, "m644pa")
+AVR_MCU ("atmega645",            ARCH_AVR5, "__AVR_ATmega645__",         0, 0, 0x0100, 1, "m645")
+AVR_MCU ("atmega645a",           ARCH_AVR5, "__AVR_ATmega645A__",        0, 0, 0x0100, 1, "m645a")
+AVR_MCU ("atmega645p",           ARCH_AVR5, "__AVR_ATmega645P__",        0, 0, 0x0100, 1, "m645p")
+AVR_MCU ("atmega6450",           ARCH_AVR5, "__AVR_ATmega6450__",        0, 0, 0x0100, 1, "m6450")
+AVR_MCU ("atmega6450a",          ARCH_AVR5, "__AVR_ATmega6450A__",       0, 0, 0x0100, 1, "m6450a")
+AVR_MCU ("atmega6450p",          ARCH_AVR5, "__AVR_ATmega6450P__",       0, 0, 0x0100, 1, "m6450p")
+AVR_MCU ("atmega649",            ARCH_AVR5, "__AVR_ATmega649__",         0, 0, 0x0100, 1, "m649")
+AVR_MCU ("atmega649a",           ARCH_AVR5, "__AVR_ATmega649A__",        0, 0, 0x0100, 1, "m649a")
+AVR_MCU ("atmega649p",           ARCH_AVR5, "__AVR_ATmega649P__",        0, 0, 0x0100, 1, "m649p")
+AVR_MCU ("atmega6490",           ARCH_AVR5, "__AVR_ATmega6490__",        0, 0, 0x0100, 1, "m6490")
+AVR_MCU ("atmega16hva",          ARCH_AVR5, "__AVR_ATmega16HVA__",       0, 0, 0x0100, 1, "m16hva")
+AVR_MCU ("atmega16hva2",         ARCH_AVR5, "__AVR_ATmega16HVA2__",      0, 0, 0x0100, 1, "m16hva2")
+AVR_MCU ("atmega16hvb",          ARCH_AVR5, "__AVR_ATmega16HVB__",       0, 0, 0x0100, 1, "m16hvb")
+AVR_MCU ("atmega32hvb",          ARCH_AVR5, "__AVR_ATmega32HVB__",       0, 0, 0x0100, 1, "m32hvb")
+AVR_MCU ("atmega64hve",          ARCH_AVR5, "__AVR_ATmega64HVE__",       0, 0, 0x0100, 1, "m64hve")
+AVR_MCU ("at90can32",            ARCH_AVR5, "__AVR_AT90CAN32__",         0, 0, 0x0100, 1, "can32")
+AVR_MCU ("at90can64",            ARCH_AVR5, "__AVR_AT90CAN64__",         0, 0, 0x0100, 1, "can64")
+AVR_MCU ("at90pwm216",           ARCH_AVR5, "__AVR_AT90PWM216__",        0, 0, 0x0100, 1, "90pwm216")
+AVR_MCU ("at90pwm316",           ARCH_AVR5, "__AVR_AT90PWM316__",        0, 0, 0x0100, 1, "90pwm316")
+AVR_MCU ("atmega32c1",           ARCH_AVR5, "__AVR_ATmega32C1__",        0, 0, 0x0100, 1, "m32c1")
+AVR_MCU ("atmega64c1",           ARCH_AVR5, "__AVR_ATmega64C1__",        0, 0, 0x0100, 1, "m64c1")
+AVR_MCU ("atmega16m1",           ARCH_AVR5, "__AVR_ATmega16M1__",        0, 0, 0x0100, 1, "m16m1")
+AVR_MCU ("atmega32m1",           ARCH_AVR5, "__AVR_ATmega32M1__",        0, 0, 0x0100, 1, "m32m1")
+AVR_MCU ("atmega64m1",           ARCH_AVR5, "__AVR_ATmega64M1__",        0, 0, 0x0100, 1, "m64m1")
+AVR_MCU ("atmega16u4",           ARCH_AVR5, "__AVR_ATmega16U4__",        0, 0, 0x0100, 1, "m16u4")
+AVR_MCU ("atmega32u4",           ARCH_AVR5, "__AVR_ATmega32U4__",        0, 0, 0x0100, 1, "m32u4")
+AVR_MCU ("atmega32u6",           ARCH_AVR5, "__AVR_ATmega32U6__",        0, 0, 0x0100, 1, "m32u6")
+AVR_MCU ("at90scr100",           ARCH_AVR5, "__AVR_AT90SCR100__",        0, 0, 0x0100, 1, "90scr100")
+AVR_MCU ("at90usb646",           ARCH_AVR5, "__AVR_AT90USB646__",        0, 0, 0x0100, 1, "usb646")
+AVR_MCU ("at90usb647",           ARCH_AVR5, "__AVR_AT90USB647__",        0, 0, 0x0100, 1, "usb647")
+AVR_MCU ("at94k",                ARCH_AVR5, "__AVR_AT94K__",             0, 0, 0x0060, 1, "at94k")
+AVR_MCU ("m3000",                ARCH_AVR5, "__AVR_M3000__",             0, 0, 0x1000, 1, "m3000")
 /* Enhanced, == 128K.  */
-AVR_MCU ("avr51",                ARCH_AVR51, NULL,                       0, 0, 0x0100, "m128")
-AVR_MCU ("atmega128",            ARCH_AVR51, "__AVR_ATmega128__",        0, 0, 0x0100, "m128")
-AVR_MCU ("atmega1280",           ARCH_AVR51, "__AVR_ATmega1280__",       0, 0, 0x0200, "m1280")
-AVR_MCU ("atmega1281",           ARCH_AVR51, "__AVR_ATmega1281__",       0, 0, 0x0200, "m1281")
-AVR_MCU ("atmega1284p",          ARCH_AVR51, "__AVR_ATmega1284P__",      0, 0, 0x0100, "m1284p")
-AVR_MCU ("atmega128rfa1",        ARCH_AVR51, "__AVR_ATmega128RFA1__",    0, 0, 0x0200, "m128rfa1")
-AVR_MCU ("at90can128",           ARCH_AVR51, "__AVR_AT90CAN128__",       0, 0, 0x0100, "can128")
-AVR_MCU ("at90usb1286",          ARCH_AVR51, "__AVR_AT90USB1286__",      0, 0, 0x0100, "usb1286")
-AVR_MCU ("at90usb1287",          ARCH_AVR51, "__AVR_AT90USB1287__",      0, 0, 0x0100, "usb1286")
+AVR_MCU ("avr51",                ARCH_AVR51, NULL,                       0, 0, 0x0100, 2, "m128")
+AVR_MCU ("atmega128",            ARCH_AVR51, "__AVR_ATmega128__",        0, 0, 0x0100, 2, "m128")
+AVR_MCU ("atmega1280",           ARCH_AVR51, "__AVR_ATmega1280__",       0, 0, 0x0200, 2, "m1280")
+AVR_MCU ("atmega1281",           ARCH_AVR51, "__AVR_ATmega1281__",       0, 0, 0x0200, 2, "m1281")
+AVR_MCU ("atmega1284p",          ARCH_AVR51, "__AVR_ATmega1284P__",      0, 0, 0x0100, 2, "m1284p")
+AVR_MCU ("atmega128rfa1",        ARCH_AVR51, "__AVR_ATmega128RFA1__",    0, 0, 0x0200, 2, "m128rfa1")
+AVR_MCU ("at90can128",           ARCH_AVR51, "__AVR_AT90CAN128__",       0, 0, 0x0100, 2, "can128")
+AVR_MCU ("at90usb1286",          ARCH_AVR51, "__AVR_AT90USB1286__",      0, 0, 0x0100, 2, "usb1286")
+AVR_MCU ("at90usb1287",          ARCH_AVR51, "__AVR_AT90USB1287__",      0, 0, 0x0100, 2, "usb1286")
 /* 3-Byte PC.  */
-AVR_MCU ("avr6",                 ARCH_AVR6, NULL,                        0, 0, 0x0200, "m2561")
-AVR_MCU ("atmega2560",           ARCH_AVR6, "__AVR_ATmega2560__",        0, 0, 0x0200, "m2560")
-AVR_MCU ("atmega2561",           ARCH_AVR6, "__AVR_ATmega2561__",        0, 0, 0x0200, "m2561")
+AVR_MCU ("avr6",                 ARCH_AVR6, NULL,                        0, 0, 0x0200, 4, "m2561")
+AVR_MCU ("atmega2560",           ARCH_AVR6, "__AVR_ATmega2560__",        0, 0, 0x0200, 4, "m2560")
+AVR_MCU ("atmega2561",           ARCH_AVR6, "__AVR_ATmega2561__",        0, 0, 0x0200, 4, "m2561")
 /* Xmega, 16K <= Flash < 64K, RAM <= 64K */
-AVR_MCU ("avrxmega2",        ARCH_AVRXMEGA2, NULL,                       0, 0, 0x2000, "x32a4")
-AVR_MCU ("atxmega16a4",      ARCH_AVRXMEGA2, "__AVR_ATxmega16A4__",      0, 0, 0x2000, "x16a4")
-AVR_MCU ("atxmega16d4",      ARCH_AVRXMEGA2, "__AVR_ATxmega16D4__",      0, 0, 0x2000, "x16d4")
-AVR_MCU ("atxmega16x1",      ARCH_AVRXMEGA2, "__AVR_ATxmega16X1__",      0, 0, 0x2000, "x16x1")
-AVR_MCU ("atxmega32a4",      ARCH_AVRXMEGA2, "__AVR_ATxmega32A4__",      0, 0, 0x2000, "x32a4")
-AVR_MCU ("atxmega32d4",      ARCH_AVRXMEGA2, "__AVR_ATxmega32D4__",      0, 0, 0x2000, "x32d4")
-AVR_MCU ("atxmega32x1",      ARCH_AVRXMEGA2, "__AVR_ATxmega32X1__",      0, 0, 0x2000, "x32x1")
-/* Xmega, Flash == 64K, RAM <= 64K */
-AVR_MCU ("avrxmega4",        ARCH_AVRXMEGA4, NULL,                       0, 0, 0x2000, "x64a4")
-AVR_MCU ("atxmega64a3",      ARCH_AVRXMEGA4, "__AVR_ATxmega64A3__",      0, 0, 0x2000, "x64a3")
-AVR_MCU ("atxmega64d3",      ARCH_AVRXMEGA4, "__AVR_ATxmega64D3__",      0, 0, 0x2000, "x64d3")
-/* Xmega, Flash == 64K, RAM > 64K */
-AVR_MCU ("avrxmega5",        ARCH_AVRXMEGA5, NULL,                       0, 0, 0x2000, "x64a1")
-AVR_MCU ("atxmega64a1",      ARCH_AVRXMEGA5, "__AVR_ATxmega64A1__",      0, 0, 0x2000, "x64a1")
-AVR_MCU ("atxmega64a1u",     ARCH_AVRXMEGA5, "__AVR_ATxmega64A1U__",     0, 0, 0x2000, "x64a1u")
-/* Xmega, 128K <= Flash <= 256K, RAM <= 64K */
-AVR_MCU ("avrxmega6",        ARCH_AVRXMEGA6, NULL,                       0, 0, 0x2000, "x128a3")
-AVR_MCU ("atxmega128a3",     ARCH_AVRXMEGA6, "__AVR_ATxmega128A3__",     0, 0, 0x2000, "x128a3")
-AVR_MCU ("atxmega128d3",     ARCH_AVRXMEGA6, "__AVR_ATxmega128D3__",     0, 0, 0x2000, "x128d3")
-AVR_MCU ("atxmega192a3",     ARCH_AVRXMEGA6, "__AVR_ATxmega192A3__",     0, 0, 0x2000, "x192a3")
-AVR_MCU ("atxmega192d3",     ARCH_AVRXMEGA6, "__AVR_ATxmega192D3__",     0, 0, 0x2000, "x192d3")
-AVR_MCU ("atxmega256a3",     ARCH_AVRXMEGA6, "__AVR_ATxmega256A3__",     0, 0, 0x2000, "x256a3")
-AVR_MCU ("atxmega256a3b",    ARCH_AVRXMEGA6, "__AVR_ATxmega256A3B__",    0, 0, 0x2000, "x256a3b")
-AVR_MCU ("atxmega256a3bu",   ARCH_AVRXMEGA6, "__AVR_ATxmega256A3BU__",   0, 0, 0x2000, "x256a3bu")
-AVR_MCU ("atxmega256d3",     ARCH_AVRXMEGA6, "__AVR_ATxmega256D3__",     0, 0, 0x2000, "x256d3")
-/* Xmega, 128K <= Flash <= 256K, RAM > 64K RAM.  */
-AVR_MCU ("avrxmega7",        ARCH_AVRXMEGA7, NULL,                       0, 0, 0x2000, "x128a1")
-AVR_MCU ("atxmega128a1",     ARCH_AVRXMEGA7, "__AVR_ATxmega128A1__",     0, 0, 0x2000, "x128a1")
-AVR_MCU ("atxmega128a1u",    ARCH_AVRXMEGA7, "__AVR_ATxmega128A1U__",    0, 0, 0x2000, "x128a1u")
+AVR_MCU ("avrxmega2",        ARCH_AVRXMEGA2, NULL,                       0, 0, 0x2000, 1, "x32a4")
+AVR_MCU ("atxmega16a4",      ARCH_AVRXMEGA2, "__AVR_ATxmega16A4__",      0, 0, 0x2000, 1, "x16a4")
+AVR_MCU ("atxmega16d4",      ARCH_AVRXMEGA2, "__AVR_ATxmega16D4__",      0, 0, 0x2000, 1, "x16d4")
+AVR_MCU ("atxmega16x1",      ARCH_AVRXMEGA2, "__AVR_ATxmega16X1__",      0, 0, 0x2000, 1, "x16x1")
+AVR_MCU ("atxmega32a4",      ARCH_AVRXMEGA2, "__AVR_ATxmega32A4__",      0, 0, 0x2000, 1, "x32a4")
+AVR_MCU ("atxmega32d4",      ARCH_AVRXMEGA2, "__AVR_ATxmega32D4__",      0, 0, 0x2000, 1, "x32d4")
+AVR_MCU ("atxmega32x1",      ARCH_AVRXMEGA2, "__AVR_ATxmega32X1__",      0, 0, 0x2000, 1, "x32x1")
+/* Xmega, 64K < Flash <= 128K, RAM <= 64K */
+AVR_MCU ("avrxmega4",        ARCH_AVRXMEGA4, NULL,                       0, 0, 0x2000, 2, "x64a4")
+AVR_MCU ("atxmega64a3",      ARCH_AVRXMEGA4, "__AVR_ATxmega64A3__",      0, 0, 0x2000, 2, "x64a3")
+AVR_MCU ("atxmega64d3",      ARCH_AVRXMEGA4, "__AVR_ATxmega64D3__",      0, 0, 0x2000, 2, "x64d3")
+/* Xmega, 64K < Flash <= 128K, RAM > 64K */
+AVR_MCU ("avrxmega5",        ARCH_AVRXMEGA5, NULL,                       0, 0, 0x2000, 2, "x64a1")
+AVR_MCU ("atxmega64a1",      ARCH_AVRXMEGA5, "__AVR_ATxmega64A1__",      0, 0, 0x2000, 2, "x64a1")
+AVR_MCU ("atxmega64a1u",     ARCH_AVRXMEGA5, "__AVR_ATxmega64A1U__",     0, 0, 0x2000, 2, "x64a1u")
+/* Xmega, 128K < Flash, RAM <= 64K */
+AVR_MCU ("avrxmega6",        ARCH_AVRXMEGA6, NULL,                       0, 0, 0x2000, 5, "x128a3")
+AVR_MCU ("atxmega128a3",     ARCH_AVRXMEGA6, "__AVR_ATxmega128A3__",     0, 0, 0x2000, 3, "x128a3")
+AVR_MCU ("atxmega128d3",     ARCH_AVRXMEGA6, "__AVR_ATxmega128D3__",     0, 0, 0x2000, 3, "x128d3")
+AVR_MCU ("atxmega192a3",     ARCH_AVRXMEGA6, "__AVR_ATxmega192A3__",     0, 0, 0x2000, 4, "x192a3")
+AVR_MCU ("atxmega192d3",     ARCH_AVRXMEGA6, "__AVR_ATxmega192D3__",     0, 0, 0x2000, 4, "x192d3")
+AVR_MCU ("atxmega256a3",     ARCH_AVRXMEGA6, "__AVR_ATxmega256A3__",     0, 0, 0x2000, 5, "x256a3")
+AVR_MCU ("atxmega256a3b",    ARCH_AVRXMEGA6, "__AVR_ATxmega256A3B__",    0, 0, 0x2000, 5, "x256a3b")
+AVR_MCU ("atxmega256a3bu",   ARCH_AVRXMEGA6, "__AVR_ATxmega256A3BU__",   0, 0, 0x2000, 5, "x256a3bu")
+AVR_MCU ("atxmega256d3",     ARCH_AVRXMEGA6, "__AVR_ATxmega256D3__",     0, 0, 0x2000, 5, "x256d3")
+/* Xmega, 128K < Flash, RAM > 64K RAM.  */
+AVR_MCU ("avrxmega7",        ARCH_AVRXMEGA7, NULL,                       0, 0, 0x2000, 3, "x128a1")
+AVR_MCU ("atxmega128a1",     ARCH_AVRXMEGA7, "__AVR_ATxmega128A1__",     0, 0, 0x2000, 3, "x128a1")
+AVR_MCU ("atxmega128a1u",    ARCH_AVRXMEGA7, "__AVR_ATxmega128A1U__",    0, 0, 0x2000, 3, "x128a1u")
 /* Assembler only.  */
-AVR_MCU ("avr1",                 ARCH_AVR1, NULL,                        0, 0, 0x0060, "s1200")
-AVR_MCU ("at90s1200",            ARCH_AVR1, "__AVR_AT90S1200__",         0, 0, 0x0060, "s1200")
-AVR_MCU ("attiny11",             ARCH_AVR1, "__AVR_ATtiny11__",          0, 0, 0x0060, "tn11")
-AVR_MCU ("attiny12",             ARCH_AVR1, "__AVR_ATtiny12__",          0, 0, 0x0060, "tn12")
-AVR_MCU ("attiny15",             ARCH_AVR1, "__AVR_ATtiny15__",          0, 0, 0x0060, "tn15")
-AVR_MCU ("attiny28",             ARCH_AVR1, "__AVR_ATtiny28__",          0, 0, 0x0060, "tn28")
+AVR_MCU ("avr1",                 ARCH_AVR1, NULL,                        0, 0, 0x0060, 1, "s1200")
+AVR_MCU ("at90s1200",            ARCH_AVR1, "__AVR_AT90S1200__",         0, 0, 0x0060, 1, "s1200")
+AVR_MCU ("attiny11",             ARCH_AVR1, "__AVR_ATtiny11__",          0, 0, 0x0060, 1, "tn11")
+AVR_MCU ("attiny12",             ARCH_AVR1, "__AVR_ATtiny12__",          0, 0, 0x0060, 1, "tn12")
+AVR_MCU ("attiny15",             ARCH_AVR1, "__AVR_ATtiny15__",          0, 0, 0x0060, 1, "tn15")
+AVR_MCU ("attiny28",             ARCH_AVR1, "__AVR_ATtiny28__",          0, 0, 0x0060, 1, "tn28")
index 8959553..3fe26d4 100644 (file)
@@ -2577,7 +2577,7 @@ avr_xload_libgcc_p (enum machine_mode mode)
   int n_bytes = GET_MODE_SIZE (mode);
   
   return (n_bytes > 1
-          || avr_current_arch->n_segments > 1);
+          || avr_current_device->n_flash > 1);
 }
 
 
@@ -2773,10 +2773,7 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
 
   regno_dest = REGNO (dest);
 
-  /* Cut down segment number to a number the device actually supports.
-     We do this late to preserve the address space's name for diagnostics.  */
-
-  segment = avr_addrspace[as].segment % avr_current_arch->n_segments;
+  segment = avr_addrspace[as].segment;
 
   /* Set RAMPZ as needed.  */
 
@@ -7101,6 +7098,7 @@ avr_nonconst_pointer_addrspace (tree typ)
 
   if (POINTER_TYPE_P (typ))
     {
+      addr_space_t as;
       tree target = TREE_TYPE (typ);
 
       /* Pointer to function: Test the function's return type.  */
@@ -7113,12 +7111,16 @@ avr_nonconst_pointer_addrspace (tree typ)
       while (TREE_CODE (target) == ARRAY_TYPE)
         target = TREE_TYPE (target);
 
-      if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (target))
-          && !TYPE_READONLY (target))
-        {
-          /* Pointers to non-generic address space must be const.  */
+      /* Pointers to non-generic address space must be const.
+         Refuse address spaces outside the device's flash.  */
           
-          return TYPE_ADDR_SPACE (target);
+      as = TYPE_ADDR_SPACE (target);
+        
+      if (!ADDR_SPACE_GENERIC_P (as)
+          && (!TYPE_READONLY (target)
+              || avr_addrspace[as].segment >= avr_current_device->n_flash))
+        {
+          return as;
         }
 
       /* Scan pointer's target type.  */
@@ -7180,12 +7182,29 @@ avr_pgm_check_var_decl (tree node)
 
   if (reason)
     {
-      if (TYPE_P (node))
-        error ("pointer targeting address space %qs must be const in %qT",
-               avr_addrspace[as].name, node);
+      avr_edump ("%?: %s, %d, %d\n",
+                 avr_addrspace[as].name,
+                 avr_addrspace[as].segment, avr_current_device->n_flash);
+      if (avr_addrspace[as].segment >= avr_current_device->n_flash)
+        {
+          if (TYPE_P (node))
+            error ("%qT uses address space %qs beyond flash of %qs",
+                   node, avr_addrspace[as].name, avr_current_device->name);
+          else
+            error ("%s %q+D uses address space %qs beyond flash of %qs",
+                   reason, node, avr_addrspace[as].name,
+                   avr_current_device->name);
+        }
       else
-        error ("pointer targeting address space %qs must be const in %s %q+D",
-               avr_addrspace[as].name, reason, node);
+        {
+          if (TYPE_P (node))
+            error ("pointer targeting address space %qs must be const in %qT",
+                   avr_addrspace[as].name, node);
+          else
+            error ("pointer targeting address space %qs must be const"
+                   " in %s %q+D",
+                   avr_addrspace[as].name, reason, node);
+        }
     }
 
   return reason == NULL;
@@ -7203,6 +7222,7 @@ avr_insert_attributes (tree node, tree *attributes)
       && (TREE_STATIC (node) || DECL_EXTERNAL (node))
       && avr_progmem_p (node, *attributes))
     {
+      addr_space_t as;
       tree node0 = node;
 
       /* For C++, we have to peel arrays in order to get correct
@@ -7214,11 +7234,19 @@ avr_insert_attributes (tree node, tree *attributes)
 
       if (error_mark_node == node0)
         return;
+
+      as = TYPE_ADDR_SPACE (TREE_TYPE (node));
+
+      if (avr_addrspace[as].segment >= avr_current_device->n_flash)
+        {
+          error ("variable %q+D located in address space %qs"
+                 " beyond flash of %qs",
+                 node, avr_addrspace[as].name, avr_current_device->name);
+        }
       
       if (!TYPE_READONLY (node0)
           && !TREE_READONLY (node))
         {
-          addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (node));
           const char *reason = "__attribute__((progmem))";
 
           if (!ADDR_SPACE_GENERIC_P (as))
@@ -7403,7 +7431,7 @@ avr_asm_named_section (const char *name, unsigned int flags, tree decl)
   if (flags & AVR_SECTION_PROGMEM)
     {
       addr_space_t as = (flags & AVR_SECTION_PROGMEM) / SECTION_MACH_DEP;
-      int segment = avr_addrspace[as].segment % avr_current_arch->n_segments;
+      int segment = avr_addrspace[as].segment;
       const char *old_prefix = ".rodata";
       const char *new_prefix = progmem_section_prefix[segment];
       
@@ -7518,7 +7546,7 @@ avr_asm_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
       && avr_progmem_p (decl, DECL_ATTRIBUTES (decl)))
     {
       addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (decl));
-      int segment = avr_addrspace[as].segment % avr_current_arch->n_segments;
+      int segment = avr_addrspace[as].segment;
       
       if (sect->common.flags & SECTION_NAMED)
         {
@@ -9852,7 +9880,7 @@ avr_addr_space_convert (rtx src, tree type_from, tree type_to)
              
       msb = ADDR_SPACE_GENERIC_P (as_from)
         ? 0x80
-        : avr_addrspace[as_from].segment % avr_current_arch->n_segments;
+        : avr_addrspace[as_from].segment;
 
       src = force_reg (Pmode, src);
       
@@ -9936,10 +9964,10 @@ avr_emit_movmemhi (rtx *xop)
     }
   else
     {
-      int segment = avr_addrspace[as].segment % avr_current_arch->n_segments;
+      int segment = avr_addrspace[as].segment;
       
       if (segment
-          && avr_current_arch->n_segments > 1)
+          && avr_current_device->n_flash > 1)
         {
           a_hi8 = GEN_INT (segment);
           emit_move_insn (rampz_rtx, a_hi8 = copy_to_mode_reg (QImode, a_hi8));
index ccc3b6d..b051c4b 100644 (file)
@@ -60,9 +60,6 @@ struct base_arch_s
      SFR-address = RAM-address - sfr_offset  */
   int sfr_offset;
 
-  /* Number of 64k segments in the flash.  */
-  int n_segments;
-
   /* Architecture id to built-in define __AVR_ARCH__ (NULL -> no macro) */
   const char *const macro;
   
@@ -129,6 +126,9 @@ struct mcu_type_s {
   /* Start of data section.  */
   int data_section_start;
   
+  /* Number of 64k segments in the flash.  */
+  int n_flash;
+
   /* Name of device library.  */
   const char *const library_name; 
 };
index e4d17cf..990192c 100644 (file)
@@ -1266,14 +1266,6 @@ address space @code{__flash@var{N}}.
 The compiler will set the @code{RAMPZ} segment register approptiately 
 before reading data by means of the @code{ELPM} instruction.
 
-On devices with less 64@tie{}kiB flash segments as indicated by the address
-space, the compiler will cut down the segment number to a number the
-device actually supports. Counting starts at@tie{}@code{0}
-for space @code{__flash}. For example, if you access address space
-@code{__flash3} on an ATmega128 device with two 64@tie{}kiB flash segments,
-the compiler will generate a read from @code{__flash1}, i.e.@: it
-will load @code{RAMPZ} with@tie{}@code{1} before reading.
-
 @item __memx
 @cindex @code{__memx} AVR Named Address Spaces
 This is a 24-bit address space that linearizes flash and RAM: