diff --git a/ChangeLog b/ChangeLog
index 3aad89b6..b82bbdaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-03-29  Joerg Wunsch <j.gnu@uriah.heep.sax.de>
+
+	bug #30451: Accessing some Xmega memory sections gives not
+	supported error
+	* stk500v2.c: Handle all Xmega memory sections (except
+	"prodsig" which is not documented in AVR079)
+	* fileio.c: Treat the "boot", "application", and "apptable"
+	regions (which are actually subregions of "flash") all as
+	being flash, i.e. suppress trailing 0xFF bytes when reading
+	them
+	* avr.c: (Dito.)
+
 2012-03-20  Joerg Wunsch <j.gnu@uriah.heep.sax.de>
 
 	* jtagmkII.c (jtagmkII_close): The GO command before signing off
diff --git a/NEWS b/NEWS
index 5e215ae7..053c094b 100644
--- a/NEWS
+++ b/NEWS
@@ -55,6 +55,8 @@ Current:
       - bug #34518: loading intel hex files > 64k using record-type 4
         (Extended Linear Address Record)
       - bug #34027: avrdude AT90S1200 Problem
+      - bug #30451: Accessing some Xmega memory sections gives not
+        supported error
 
   * Keep track of input file contents
 
diff --git a/avr.c b/avr.c
index a7a74769..cd2eb49b 100644
--- a/avr.c
+++ b/avr.c
@@ -302,7 +302,10 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
       report_progress(pageaddr, mem->size, NULL);
     }
     if (!failure) {
-      if (strcasecmp(mem->desc, "flash") == 0)
+      if (strcasecmp(mem->desc, "flash") == 0 ||
+          strcasecmp(mem->desc, "application") == 0 ||
+          strcasecmp(mem->desc, "apptable") == 0 ||
+          strcasecmp(mem->desc, "boot") == 0)
         return avr_mem_hiaddr(mem);
       else
         return mem->size;
@@ -333,7 +336,10 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
     report_progress(i, mem->size, NULL);
   }
 
-  if (strcasecmp(mem->desc, "flash") == 0)
+  if (strcasecmp(mem->desc, "flash") == 0 ||
+      strcasecmp(mem->desc, "application") == 0 ||
+      strcasecmp(mem->desc, "apptable") == 0 ||
+      strcasecmp(mem->desc, "boot") == 0)
     return avr_mem_hiaddr(mem);
   else
     return i;
diff --git a/fileio.c b/fileio.c
index 7eaca337..3c5dc59e 100644
--- a/fileio.c
+++ b/fileio.c
@@ -1539,7 +1539,10 @@ int fileio(int op, char * filename, FILEFMT format,
   }
 
   if (rc > 0) {
-    if ((op == FIO_READ) && (strcasecmp(mem->desc, "flash") == 0)) {
+    if ((op == FIO_READ) && (strcasecmp(mem->desc, "flash") == 0 ||
+                             strcasecmp(mem->desc, "application") == 0 ||
+                             strcasecmp(mem->desc, "apptable") == 0 ||
+                             strcasecmp(mem->desc, "boot") == 0)) {
       /*
        * if we are reading flash, just mark the size as being the
        * highest non-0xff byte
diff --git a/stk500v2.c b/stk500v2.c
index 42ef1236..d70b219f 100644
--- a/stk500v2.c
+++ b/stk500v2.c
@@ -3166,13 +3166,15 @@ static int stk600_xprog_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
 
     memset(b, 0, sizeof(b));
 
-    if (strcmp(mem->desc, "flash") == 0) {
+    if (strcmp(mem->desc, "flash") == 0 ||
+        strcmp(mem->desc, "application") == 0 ||
+        strcmp(mem->desc, "apptable") == 0) {
         memcode = XPRG_MEM_TYPE_APPL;
     } else if (strcmp(mem->desc, "boot") == 0) {
         memcode = XPRG_MEM_TYPE_BOOT;
     } else if (strcmp(mem->desc, "eeprom") == 0) {
         memcode = XPRG_MEM_TYPE_EEPROM;
-    } else if (strcmp(mem->desc, "lockbits") == 0) {
+    } else if (strncmp(mem->desc, "lock", strlen("lock")) == 0) {
         memcode = XPRG_MEM_TYPE_LOCKBITS;
     } else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
         memcode = XPRG_MEM_TYPE_FUSE;
@@ -3242,7 +3244,9 @@ static int stk600_xprog_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
 {
     unsigned char b[8];
 
-    if (strcmp(mem->desc, "flash") == 0) {
+    if (strcmp(mem->desc, "flash") == 0 ||
+        strcmp(mem->desc, "application") == 0 ||
+        strcmp(mem->desc, "apptable") == 0) {
         b[1] = XPRG_MEM_TYPE_APPL;
     } else if (strcmp(mem->desc, "boot") == 0) {
         b[1] = XPRG_MEM_TYPE_BOOT;
@@ -3252,7 +3256,7 @@ static int stk600_xprog_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
         b[1] = XPRG_MEM_TYPE_APPL;
     } else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
         b[1] = XPRG_MEM_TYPE_FUSE;
-    } else if (strcmp(mem->desc, "lockbits") == 0) {
+    } else if (strncmp(mem->desc, "lock", strlen("lock")) == 0) {
         b[1] = XPRG_MEM_TYPE_LOCKBITS;
     } else if (strcmp(mem->desc, "calibration") == 0) {
         b[1] = XPRG_MEM_TYPE_FACTORY_CALIBRATION;
@@ -3306,7 +3310,9 @@ static int stk600_xprog_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
      * This is probably what AVR079 means when writing about the
      * "TIF address space".
      */
-    if (strcmp(mem->desc, "flash") == 0) {
+    if (strcmp(mem->desc, "flash") == 0 ||
+        strcmp(mem->desc, "application") == 0 ||
+        strcmp(mem->desc, "apptable") == 0) {
         memtype = XPRG_MEM_TYPE_APPL;
         if (mem->size > 64 * 1024)
             use_ext_addr = (1UL << 31);
@@ -3322,7 +3328,7 @@ static int stk600_xprog_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
         memtype = XPRG_MEM_TYPE_APPL;
     } else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
         memtype = XPRG_MEM_TYPE_FUSE;
-    } else if (strcmp(mem->desc, "lockbits") == 0) {
+    } else if (strncmp(mem->desc, "lock", strlen("lock")) == 0) {
         memtype = XPRG_MEM_TYPE_LOCKBITS;
     } else if (strcmp(mem->desc, "calibration") == 0) {
         memtype = XPRG_MEM_TYPE_FACTORY_CALIBRATION;
@@ -3406,7 +3412,9 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
      * This is probably what AVR079 means when writing about the
      * "TIF address space".
      */
-    if (strcmp(mem->desc, "flash") == 0) {
+    if (strcmp(mem->desc, "flash") == 0 ||
+        strcmp(mem->desc, "application") == 0 ||
+        strcmp(mem->desc, "apptable") == 0) {
         memtype = XPRG_MEM_TYPE_APPL;
         writemode = (1 << XPRG_MEM_WRITE_WRITE);
         if (mem->size > 64 * 1024)
@@ -3427,7 +3435,7 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
     } else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
         memtype = XPRG_MEM_TYPE_FUSE;
         writemode = (1 << XPRG_MEM_WRITE_WRITE);
-    } else if (strcmp(mem->desc, "lockbits") == 0) {
+    } else if (strncmp(mem->desc, "lock", strlen("lock")) == 0) {
         memtype = XPRG_MEM_TYPE_LOCKBITS;
         writemode = (1 << XPRG_MEM_WRITE_WRITE);
     } else if (strcmp(mem->desc, "calibration") == 0) {