diff --git a/AstroEQ-ConfigUtility/AstroEQ.exe b/AstroEQ-ConfigUtility/AstroEQ.exe
index 100c2de3ec8fe318ab15755f655b32cba1d481d9..fe70320f881d1fc2f9ad47a83554871f0e0b9ca1 100644
Binary files a/AstroEQ-ConfigUtility/AstroEQ.exe and b/AstroEQ-ConfigUtility/AstroEQ.exe differ
diff --git a/AstroEQ-ConfigUtility/README b/AstroEQ-ConfigUtility/README
new file mode 100644
index 0000000000000000000000000000000000000000..e4adf337dfb7bc7c82b73a5977ad0c013a4f1ce0
--- /dev/null
+++ b/AstroEQ-ConfigUtility/README
@@ -0,0 +1 @@
+Please use the Zip version in the downloads folder. This version is used as a source for retrieving new firmware versions from within the configuration utility!
\ No newline at end of file
diff --git a/AstroEQ-ConfigUtility/bin/avrdude.exe b/AstroEQ-ConfigUtility/bin/avrdude.exe
index 28972539ee7dc599db47e6d4f4afe57ccd7c8dbe..d10b9a012eaf8ab660a83c9de4599e9beb95824b 100644
Binary files a/AstroEQ-ConfigUtility/bin/avrdude.exe and b/AstroEQ-ConfigUtility/bin/avrdude.exe differ
diff --git a/AstroEQ-ConfigUtility/etc/avrdude.conf b/AstroEQ-ConfigUtility/etc/avrdude.conf
index 2e77d8ce01bc4deba504405ecca20a0d57dcb6bd..2dd1a04660116a3dcc68bb83a9c8e4ad40a250d6 100644
--- a/AstroEQ-ConfigUtility/etc/avrdude.conf
+++ b/AstroEQ-ConfigUtility/etc/avrdude.conf
@@ -1,4 +1,4 @@
-# $Id: avrdude.conf.in 991 2011-08-26 20:50:32Z joerg_wunsch $ -*- text -*-
+# $Id: avrdude.conf.in 1236 2013-09-16 19:40:15Z joerg_wunsch $ -*- text -*-
 #
 # AVRDUDE Configuration File
 #
@@ -13,17 +13,15 @@
 # Possible entry formats are:
 #
 #   programmer
+#       parent <id>                                 # optional parent
 #       id       = <id1> [, <id2> [, <id3>] ...] ;  # <idN> are quoted strings
 #       desc     = <description> ;                  # quoted string
-#       type     = par | stk500 | stk500v2 | stk500pp | stk500hvsp | stk500generic |
-#                  stk600 | stk600pp | stk600hvsp |
-#                  avr910 | butterfly | usbasp |
-#                  jtagmki | jtagmkii | jtagmkii_isp | jtagmkii_dw |
-#                  jtagmkII_avr32 | jtagmkii_pdi |
-#                  dragon_dw | dragon_jtag | dragon_isp | dragon_pp |
-#                  dragon_hvsp | dragon_pdi | arduino | wiring; # programmer type
+#       type     = <type>;                          # programmer type, quoted string
+#                          # supported programmer types can be listed by "-c ?type"
+#       connection_type = parallel | serial | usb
 #       baudrate = <num> ;                          # baudrate for avr910-programmer
 #       vcc      = <num1> [, <num2> ... ] ;         # pin number(s)
+#       buff     = <num1> [, <num2> ... ] ;         # pin number(s)
 #       reset    = <num> ;                          # pin number
 #       sck      = <num> ;                          # pin number
 #       mosi     = <num> ;                          # pin number
@@ -32,14 +30,17 @@
 #       rdyled   = <num> ;                          # pin number
 #       pgmled   = <num> ;                          # pin number
 #       vfyled   = <num> ;                          # pin number
-#  			usbvid   = <hexnum>;												# USB VID (Vendor ID)
-#       usbpid   = <hexnum>;												#	USB PID (Product ID)
-#       usbdev   = <interface>;											# USB interface or other device info 
-#       usbvendor = <vendorname>;										#	USB Vendor Name
-#       usbproduct = <productname>;									# USB Product Name
+#       usbvid   = <hexnum>;                        # USB VID (Vendor ID)
+#       usbpid   = <hexnum>;                        # USB PID (Product ID)
+#       usbdev   = <interface>;                     # USB interface or other device info 
+#       usbvendor = <vendorname>;                   # USB Vendor Name
+#       usbproduct = <productname>;                 # USB Product Name
 #       usbsn    = <serialno>;                      # USB Serial Number
 #
 #        To invert a bit, use = ~ <num>, the spaces are important.
+#        For a pin list all pins must be inverted.
+#        A single pin can be specified as usual = ~ <num>, for lists
+#        specify it as follows = ~ ( <num> [, <num2> ... ] ) .
 #     ;
 #
 #   part
@@ -108,6 +109,7 @@
 #       spmcr            = <num> ;                # mem addr of SPMC[S]R reg.
 #       eecr             = <num> ;                # mem addr of EECR reg.
 #                                                 # (only when != 0x3c)
+#       is_at90s1200     = <yes/no> ;             # AT90S1200 part
 #       is_avr32         = <yes/no> ;             # AVR32 part
 #
 #       memory <memtype>
@@ -137,6 +139,17 @@
 # values.  If a required parameter is left empty, AVRDUDE will
 # complain.
 #
+# Parts can also inherit parameters from previously defined parts
+# using the following syntax. In this case specified integer and 
+# string values override parameter values from the parent part. New 
+# memory definitions are added to the definitions inherited from the 
+# parent.
+#
+#   part parent <id>                              # quoted string
+#       id               = <id> ;                 # quoted string
+#       <any set of other parameters from the list above>
+#     ;
+#
 # NOTES:
 #   * 'devicecode' is the device code used by the STK500 (see codes 
 #       listed below)
@@ -155,7 +168,7 @@
 #     This flag was added to work around a problem with the
 #     at90s4433/2333's; see the at90s4433 errata at:
 #
-#         http://www.atmel.com/atmel/acrobat/doc1280.pdf
+#         http://www.atmel.com/dyn/resources/prod_documents/doc1280.pdf
 #
 # INSTRUCTION FORMATS
 #
@@ -192,7 +205,7 @@
 # section avr061.zip which accompanies the application note
 # AVR061 available from:
 #
-#      http://www.atmel.com/atmel/acrobat/doc2525.pdf
+#      http://www.atmel.com/dyn/resources/prod_documents/doc2525.pdf
 #
 
 #define ATTINY10    0x10  /* the _old_ one that never existed! */
@@ -312,11 +325,14 @@
 # ATmega169	0x78
 
 #
-# Overall avrdude defaults
+# Overall avrdude defaults; suitable for ~/.avrduderc
 #
 default_parallel   = "lpt1";
 default_serial     = "com1";
-# default_bitclock = 2.5
+# default_bitclock = 2.5;
+
+# Turn off safemode by default
+#default_safemode  = no;
 
 
 #
@@ -329,13 +345,15 @@ default_serial     = "com1";
 programmer
   id    = "wiring";
   desc  = "Wiring";
-  type  = wiring;
+  type  = "wiring";
+  connection_type = serial;
 ;
 
 programmer
   id    = "arduino";
   desc  = "Arduino";
-  type  = arduino;
+  type  = "arduino";
+  connection_type = serial;
 ;
 # this will interface with the chips on these programmers:
 #
@@ -351,111 +369,202 @@ programmer
 # The drivers will look for a specific device and use the first one found.
 # If you have mulitple devices, then look for unique information (like SN)
 # And fill that in here.
+#
+# Note that the pin numbers for the main ISP signals (reset, sck,
+# mosi, miso) are fixed and cannot be changed, since they must match
+# the way the Multi-Protocol Synchronous Serial Engine (MPSSE) of
+# these FTDI ICs has been designed.
 
 programmer
-  id	= "avrftdi";
-  desc	= "FT2232D based generic programmer";
-  type	= avrftdi;
+  id         = "avrftdi";
+  desc       = "FT2232D based generic programmer";
+  type       = "avrftdi";
+  connection_type = usb;
   usbvid     = 0x0403;
   usbpid     = 0x6010;
   usbvendor  = "";
   usbproduct = "";
   usbdev     = "A";
   usbsn      = "";
-#ISP-signals - lower ACBUS-Nibble (default)
-  reset  = 4;
-  sck    = 1;
-  mosi   = 2;
-  miso   = 3;
-#LED SIGNALs - higher ACBUS-Nibble
-#  errled = 5;
-#  rdyled = 6;
-#  pgmled = 7;
-#  vfyled = 8;
-#Buffer Signal - ADBUS - Nibble
-#  buff   = 9;
+#ISP-signals - lower ADBUS-Nibble (default)
+  reset  = 3;
+  sck    = 0;
+  mosi   = 1;
+  miso   = 2;
+#LED SIGNALs - higher ADBUS-Nibble
+#  errled = 4;
+#  rdyled = 5;
+#  pgmled = 6;
+#  vfyled = 7;
+#Buffer Signal - ACBUS - Nibble
+#  buff   = 8;
 ;
 # This is an implementation of the above with a buffer IC (74AC244) and
-# 4 LEDs directly attached, active low. The buff and reset pins are
-# understood (by avrdude) to be active low, so there's no
-# need to invert the bits.
+# 4 LEDs directly attached, all active low.
 programmer
-  id	= "2232HIO";
-  desc	= "FT2232H based generic programmer";
-  type	= avrftdi;
+  id         = "2232HIO";
+  desc       = "FT2232H based generic programmer";
+  type       = "avrftdi";
+  connection_type = usb;
   usbvid     = 0x0403;
 # Note: This PID is reserved for generic H devices and 
 # should be programmed into the EEPROM
 #  usbpid     = 0x8A48;
-   usbpid    = 0x6010;
-  usbdev = "A";
+  usbpid     = 0x6010;
+  usbdev     = "A";
   usbvendor  = "";
   usbproduct = "";
   usbsn      = "";
 #ISP-signals 
-  reset  = 4;
-  sck    = 1;
-  mosi   = 2;
-  miso   = 3;
-  buff   = 5;
+  reset  = 3;
+  sck    = 0;
+  mosi   = 1;
+  miso   = 2;
+  buff   = ~4;
 #LED SIGNALs 
-  errled = ~ 12;
-  rdyled = ~ 15;
-  pgmled = ~ 14;
-  vfyled = ~ 13;
+  errled = ~ 11;
+  rdyled = ~ 14;
+  pgmled = ~ 13;
+  vfyled = ~ 12;
+;
+
+#The FT4232H can be treated as FT2232H, but it has a different USB
+#device ID of 0x6011.
+programmer parent "avrftdi"
+  id         = "4232h";
+  desc       = "FT4232H based generic programmer";
+  usbpid     = 0x6011;
 ;
 
 programmer
-  id    = "jtagkey";
-  desc  = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2";
-  type  = avrftdi;
+  id         = "jtagkey";
+  desc       = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2";
+  type       = "avrftdi";
+  connection_type = usb;
   usbvid     = 0x0403;
 # Note: This PID is used in all JTAGKey variants
-  usbpid    = 0xCFF8;
-  usbdev = "A";
+  usbpid     = 0xCFF8;
+  usbdev     = "A";
   usbvendor  = "";
   usbproduct = "";
   usbsn      = "";
 #ISP-signals => 20 - Pin connector on JTAGKey
-  reset  = 4; # TMS 7 violet
-  sck    = 1; # TCK 9 white
-  mosi   = 2; # TDI 5 green
-  miso   = 3; # TDO 13 orange
-  buff   = 5;
+  reset  = 3; # TMS 7 violet
+  sck    = 0; # TCK 9 white
+  mosi   = 1; # TDI 5 green
+  miso   = 2; # TDO 13 orange
+  buff   = ~4;
 # VTG           VREF 1 brown with red tip
 # GND           GND 20 black
 # The colors are on the 20 pin breakout cable
 # from Amontec
 ;
 
+# On the adapter you can read "O-Link". On the PCB is printed "OpenJTAG v3.1"
+# You can find it as "OpenJTAG ARM JTAG USB" in the internet. 
+# (But there are also several projects called Open JTAG, eg. 
+# http://www.openjtag.org, which are completely different.)
+#   http://www.100ask.net/shop/english.html (website seems to be outdated)
+#   http://item.taobao.com/item.htm?id=1559277013
+#   http://www.micro4you.com/store/openjtag-arm-jtag-usb.html (schematics!)
+# some other sources which call it O-Link
+#   http://www.andahammer.com/olink/
+#   http://www.developmentboard.net/31-o-link-debugger.html
+#   http://armwerks.com/catalog/o-link-debugger-copy/
+# or just have a look at ebay ...
+# It is basically the same entry as jtagkey with different usb ids.
+programmer parent "jtagkey"
+  id         = "o-link";
+  desc       = "O-Link, OpenJTAG from www.100ask.net";
+  usbvid     = 0x1457;
+  usbpid     = 0x5118;
+  usbvendor  = "www.100ask.net";
+  usbproduct = "USB<=>JTAG&RS232";
+;
+
+# http://wiki.openmoko.org/wiki/Debug_Board_v3
+programmer
+  id    = "openmoko";
+  desc  = "Openmoko debug board (v3)";
+  type  = "avrftdi";
+  usbvid     = 0x1457;
+  usbpid    = 0x5118;
+  usbdev = "A";
+  usbvendor  = "";
+  usbproduct = "";
+  usbsn      = "";
+  reset  = 3; # TMS 7
+  sck    = 0; # TCK 9
+  mosi   = 1; # TDI 5
+  miso   = 2; # TDO 13
+;
+
+# Only Rev. A boards.
+# Schematic and user manual: http://www.cs.put.poznan.pl/wswitala/download/pdf/811EVBK.pdf
+programmer
+  id         = "lm3s811";
+  desc       = "Luminary Micro LM3S811 Eval Board (Rev. A)";
+  type       = "avrftdi";
+  connection_type = usb;
+  usbvid     = 0x0403;
+  usbpid     = 0xbcd9;
+  usbvendor  = "LMI";
+  usbproduct = "LM3S811 Evaluation Board";
+  usbdev     = "A";
+  usbsn      = "";
+#ISP-signals - lower ACBUS-Nibble (default)
+  reset  = 3;
+  sck    = 0;
+  mosi   = 1;
+  miso   = 2;
+# Enable correct buffers
+  buff   = 7;
+;
+
 programmer
   id    = "avrisp";
   desc  = "Atmel AVR ISP";
-  type  = stk500;
+  type  = "stk500";
+  connection_type = serial;
 ;
 
 programmer
   id    = "avrispv2";
   desc  = "Atmel AVR ISP V2";
-  type  =  stk500v2;
+  type  =  "stk500v2";
+  connection_type = serial;
 ;
 
 programmer
   id    = "avrispmkII";
   desc  = "Atmel AVR ISP mkII";
-  type  =  stk500v2;
+  type  =  "stk500v2";
+  connection_type = usb;
 ;
 
-programmer
+programmer parent "avrispmkII"
   id    = "avrisp2";
-  desc  = "Atmel AVR ISP mkII";
-  type  =  stk500v2;
 ;
 
 programmer
   id    = "buspirate";
   desc  = "The Bus Pirate";
-  type  = buspirate;
+  type  = "buspirate";
+  connection_type = serial;
+;
+
+programmer
+  id    = "buspirate_bb";
+  desc  = "The Bus Pirate (bitbang interface, supports TPI)";
+  type  = "buspirate_bb";
+  connection_type = serial;
+  # pins are bits in bitbang byte (numbers are 87654321)
+  # 1|POWER|PULLUP|AUX|MOSI|CLK|MISO|CS
+  reset  = 1;
+  sck    = 3;
+  mosi   = 4;
+  miso   = 2;
+  #vcc    = 7; This is internally set independent of this setting.
 ;
 
 # This is supposed to be the "default" STK500 entry.
@@ -465,158 +574,261 @@ programmer
 programmer
   id    = "stk500";
   desc  = "Atmel STK500";
-  type  = stk500generic;
+  type  = "stk500generic";
+  connection_type = serial;
 ;
 
 programmer
   id    = "stk500v1";
   desc  = "Atmel STK500 Version 1.x firmware";
-  type  = stk500;
+  type  = "stk500";
+  connection_type = serial;
 ;
 
 programmer
   id    = "mib510";
   desc  = "Crossbow MIB510 programming board";
-  type  = stk500;
+  type  = "stk500";
+  connection_type = serial;
 ;
 
 programmer
   id    = "stk500v2";
   desc  = "Atmel STK500 Version 2.x firmware";
-  type  = stk500v2;
+  type  = "stk500v2";
+  connection_type = serial;
 ;
 
 programmer
   id    = "stk500pp";
   desc  = "Atmel STK500 V2 in parallel programming mode";
-  type  = stk500pp;
+  type  = "stk500pp";
+  connection_type = serial;
 ;
 
 programmer
   id    = "stk500hvsp";
   desc  = "Atmel STK500 V2 in high-voltage serial programming mode";
-  type  = stk500hvsp;
+  type  = "stk500hvsp";
+  connection_type = serial;
 ;
 
 programmer
   id    = "stk600";
   desc  = "Atmel STK600";
-  type  = stk600;
+  type  = "stk600";
+  connection_type = usb;
 ;
 
 programmer
   id    = "stk600pp";
   desc  = "Atmel STK600 in parallel programming mode";
-  type  = stk600pp;
+  type  = "stk600pp";
+  connection_type = usb;
 ;
 
 programmer
   id    = "stk600hvsp";
   desc  = "Atmel STK600 in high-voltage serial programming mode";
-  type  = stk600hvsp;
+  type  = "stk600hvsp";
+  connection_type = usb;
 ;
 
 programmer
   id    = "avr910";
   desc  = "Atmel Low Cost Serial Programmer";
-  type  = avr910;
+  type  = "avr910";
+  connection_type = serial;
+;
+
+programmer
+  id    = "ft245r";
+  desc  = "FT245R Synchronous BitBang";
+  type  = "ftdi_syncbb";
+  connection_type = usb;
+  miso  = 1; # D1
+  sck   = 0; # D0
+  mosi  = 2; # D2
+  reset = 4; # D4
+;
+
+programmer
+  id    = "ft232r";
+  desc  = "FT232R Synchronous BitBang";
+  type  = "ftdi_syncbb";
+  connection_type = usb;
+  miso  = 1;  # RxD
+  sck   = 0;  # RTS
+  mosi  = 2;  # TxD
+  reset = 4;  # DTR
+;
+
+# see http://www.bitwizard.nl/wiki/index.php/FTDI_ATmega
+programmer
+  id    = "bwmega";
+  desc  = "BitWizard ftdi_atmega builtin programmer";
+  type  = "ftdi_syncbb";
+  connection_type = usb;
+  miso  = 5;  # DSR
+  sck   = 6;  # DCD
+  mosi  = 3;  # CTS
+  reset = 7;  # RI
+;
+
+# see http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html
+# Note: pins are numbered from 1!
+programmer
+  id    = "arduino-ft232r";
+  desc  = "Arduino: FT232R connected to ISP";
+  type  = "ftdi_syncbb";
+  connection_type = usb;
+  miso  = 3;  # CTS X3(1)
+  sck   = 5;  # DSR X3(2)
+  mosi  = 6;  # DCD X3(3)
+  reset = 7;  # RI  X3(4)
+;
+
+# website mentioned above uses this id
+programmer parent "arduino-ft232r"
+  id    = "diecimila";
+  desc  = "alias for arduino-ft232r";
 ;
 
 programmer
   id    = "usbasp";
   desc  = "USBasp, http://www.fischl.de/usbasp/";
-  type  = usbasp;
+  type  = "usbasp";
+  connection_type = usb;
+  usbvid     = 0x16C0; # VOTI
+  usbpid     = 0x05DC; # Obdev's free shared PID
+  usbvendor  = "www.fischl.de";
+  usbproduct = "USBasp";
+
+  # following variants are autodetected for id "usbasp"
+
+  # original usbasp from fischl.de
+  # see above "usbasp"
+
+  # old usbasp from fischl.de
+  #usbvid     = 0x03EB; # ATMEL
+  #usbpid     = 0xC7B4; # (unoffical) USBasp
+  #usbvendor  = "www.fischl.de";
+  #usbproduct = "USBasp";
+
+  # NIBObee (only if -P nibobee is given on command line)
+  # see below "nibobee"
+;
+
+programmer
+  id    = "nibobee";
+  desc  = "NIBObee";
+  type  = "usbasp";
+  connection_type = usb;
+  usbvid     = 0x16C0; # VOTI
+  usbpid     = 0x092F; # NIBObee PID
+  usbvendor  = "www.nicai-systems.com";
+  usbproduct = "NIBObee";
+;
+
+programmer
+  id    = "usbasp-clone";
+  desc  = "Any usbasp clone with correct VID/PID";
+  type  = "usbasp";
+  connection_type = usb;
+  usbvid    = 0x16C0; # VOTI
+  usbpid    = 0x05DC; # Obdev's free shared PID
+  #usbvendor  = "";
+  #usbproduct = "";
 ;
 
 programmer
   id    = "usbtiny";
   desc  = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
-  type  = usbtiny;
+  type  = "usbtiny";
+  connection_type = usb;
+  usbvid     = 0x1781;
+  usbpid     = 0x0c9f;
 ;
 
 programmer
   id    = "butterfly";
   desc  = "Atmel Butterfly Development Board";
-  type  = butterfly;
+  type  = "butterfly";
+  connection_type = serial;
 ;
 
 programmer
   id    = "avr109";
   desc  = "Atmel AppNote AVR109 Boot Loader";
-  type  = butterfly;
+  type  = "butterfly";
+  connection_type = serial;
 ;
 
 programmer
   id    = "avr911";
   desc  = "Atmel AppNote AVR911 AVROSP";
-  type  = butterfly;
+  type  = "butterfly";
+  connection_type = serial;
 ;
  
 # suggested in http://forum.mikrokopter.de/topic-post48317.html
 programmer
   id    = "mkbutterfly";
   desc  = "Mikrokopter.de Butterfly";
-  type  = butterfly_mk;
+  type  = "butterfly_mk";
+  connection_type = serial;
 ;
 
-programmer
+programmer parent "mkbutterfly"
   id    = "butterfly_mk";
-  desc  = "Mikrokopter.de Butterfly";
-  type  = butterfly_mk;
 ;
 
 programmer
   id    = "jtagmkI";
   desc  = "Atmel JTAG ICE (mkI)";
   baudrate = 115200;    # default is 115200
-  type  = jtagmki;
+  type  = "jtagmki";
+  connection_type = serial;
 ;
 
 # easier to type
-programmer
+programmer parent "jtagmkI"
   id    = "jtag1";
-  desc  = "Atmel JTAG ICE (mkI)";
-  baudrate = 115200;    # default is 115200
-  type  = jtagmki;
 ;
 
 # easier to type
-programmer
+programmer parent "jtag1"
   id    = "jtag1slow";
-  desc  = "Atmel JTAG ICE (mkI)";
   baudrate = 19200;
-  type  = jtagmki;
 ;
 
+# The JTAG ICE mkII has both, serial and USB connectivity.  As it is
+# mostly used through USB these days (AVR Studio 5 only supporting it
+# that way), we make connection_type = usb the default.  Users are
+# still free to use a serial port with the -P option.
+
 programmer
   id    = "jtagmkII";
   desc  = "Atmel JTAG ICE mkII";
   baudrate = 19200;    # default is 19200
-  type  = jtagmkii;
+  type  = "jtagmkii";
+  connection_type = usb;
 ;
 
 # easier to type
-programmer
+programmer parent "jtagmkII"
   id    = "jtag2slow";
-  desc  = "Atmel JTAG ICE mkII";
-  baudrate = 19200;    # default is 19200
-  type  = jtagmkii;
 ;
 
 # JTAG ICE mkII @ 115200 Bd
-programmer
+programmer parent "jtag2slow"
   id    = "jtag2fast";
-  desc  = "Atmel JTAG ICE mkII";
   baudrate = 115200;
-  type  = jtagmkii;
 ;
 
 # make the fast one the default, people will love that
-programmer
+programmer parent "jtag2fast"
   id    = "jtag2";
-  desc  = "Atmel JTAG ICE mkII";
-  baudrate = 115200;
-  type  = jtagmkii;
 ;
 
 # JTAG ICE mkII in ISP mode
@@ -624,7 +836,8 @@ programmer
   id    = "jtag2isp";
   desc  = "Atmel JTAG ICE mkII in ISP mode";
   baudrate = 115200;
-  type  = jtagmkii_isp;
+  type  = "jtagmkii_isp";
+  connection_type = usb;
 ;
 
 # JTAG ICE mkII in debugWire mode
@@ -632,7 +845,8 @@ programmer
   id    = "jtag2dw";
   desc  = "Atmel JTAG ICE mkII in debugWire mode";
   baudrate = 115200;
-  type  = jtagmkii_dw;
+  type  = "jtagmkii_dw";
+  connection_type = usb;
 ;
 
 # JTAG ICE mkII in AVR32 mode
@@ -640,7 +854,8 @@ programmer
   id    = "jtagmkII_avr32";
   desc  = "Atmel JTAG ICE mkII im AVR32 mode";
   baudrate = 115200;
-  type  = jtagmkii_avr32;
+  type  = "jtagmkii_avr32";
+  connection_type = usb;
 ;
 
 # JTAG ICE mkII in AVR32 mode
@@ -648,7 +863,8 @@ programmer
   id    = "jtag2avr32";
   desc  = "Atmel JTAG ICE mkII im AVR32 mode";
   baudrate = 115200;
-  type  = jtagmkii_avr32;
+  type  = "jtagmkii_avr32";
+  connection_type = usb;
 ;
 
 # JTAG ICE mkII in PDI mode
@@ -656,7 +872,8 @@ programmer
   id    = "jtag2pdi";
   desc  = "Atmel JTAG ICE mkII PDI mode";
   baudrate = 115200;
-  type  = jtagmkii_pdi;
+  type  = "jtagmkii_pdi";
+  connection_type = usb;
 ;
 
 # AVR Dragon in JTAG mode
@@ -664,7 +881,8 @@ programmer
   id    = "dragon_jtag";
   desc  = "Atmel AVR Dragon in JTAG mode";
   baudrate = 115200;
-  type  = dragon_jtag;
+  type  = "dragon_jtag";
+  connection_type = usb;
 ;
 
 # AVR Dragon in ISP mode
@@ -672,7 +890,8 @@ programmer
   id    = "dragon_isp";
   desc  = "Atmel AVR Dragon in ISP mode";
   baudrate = 115200;
-  type  = dragon_isp;
+  type  = "dragon_isp";
+  connection_type = usb;
 ;
 
 # AVR Dragon in PP mode
@@ -680,7 +899,8 @@ programmer
   id    = "dragon_pp";
   desc  = "Atmel AVR Dragon in PP mode";
   baudrate = 115200;
-  type  = dragon_pp;
+  type  = "dragon_pp";
+  connection_type = usb;
 ;
 
 # AVR Dragon in HVSP mode
@@ -688,7 +908,8 @@ programmer
   id    = "dragon_hvsp";
   desc  = "Atmel AVR Dragon in HVSP mode";
   baudrate = 115200;
-  type  = dragon_hvsp;
+  type  = "dragon_hvsp";
+  connection_type = usb;
 ;
 
 # AVR Dragon in debugWire mode
@@ -696,7 +917,8 @@ programmer
   id    = "dragon_dw";
   desc  = "Atmel AVR Dragon in debugWire mode";
   baudrate = 115200;
-  type  = dragon_dw;
+  type  = "dragon_dw";
+  connection_type = usb;
 ;
 
 # AVR Dragon in PDI mode
@@ -704,13 +926,51 @@ programmer
   id    = "dragon_pdi";
   desc  = "Atmel AVR Dragon in PDI mode";
   baudrate = 115200;
-  type  = dragon_pdi;
+  type  = "dragon_pdi";
+  connection_type = usb;
+;
+
+programmer
+  id    = "jtag3";
+  desc  = "Atmel AVR JTAGICE3 in JTAG mode";
+  type  = "jtagice3";
+  connection_type = usb;
+;
+
+programmer
+  id    = "jtag3pdi";
+  desc  = "Atmel AVR JTAGICE3 in PDI mode";
+  type  = "jtagice3_pdi";
+  connection_type = usb;
+;
+
+programmer
+  id    = "jtag3dw";
+  desc  = "Atmel AVR JTAGICE3 in debugWIRE mode";
+  type  = "jtagice3_dw";
+  connection_type = usb;
+;
+
+programmer
+  id    = "jtag3isp";
+  desc  = "Atmel AVR JTAGICE3 in ISP mode";
+  type  = "jtagice3_isp";
+  connection_type = usb;
 ;
 
+
 programmer
   id    = "pavr";
   desc  = "Jason Kyle's pAVR Serial Programmer";
-  type  = avr910;
+  type  = "avr910";
+  connection_type = serial;
+;
+
+programmer
+  id    = "pickit2";
+  desc  = "MicroChip's PICkit2 Programmer";
+  type  = "pickit2";
+  connection_type = usb;
 ;
 
 # Parallel port programmers.
@@ -718,7 +978,8 @@ programmer
 programmer
   id    = "bsd";
   desc  = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   vcc   = 2, 3, 4, 5;
   reset = 7;
   sck   = 8;
@@ -729,7 +990,8 @@ programmer
 programmer
   id    = "stk200";
   desc  = "STK200";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   buff  = 4, 5;
   sck   = 6;
   mosi  = 7;
@@ -742,42 +1004,33 @@ programmer
 # except that there is a LED indicating that the
 # programming is currently in progress.
 
-programmer
+programmer parent "stk200"
   id    = "pony-stk200";
   desc  = "Pony Prog STK200";
-  type  = par;
-  buff  = 4, 5;
-  sck   = 6;
-  mosi  = 7;
-  reset = 9;
-  miso  = 10;
   pgmled = 8; 
 ;
 
 programmer
   id    = "dt006";
   desc  = "Dontronics DT006";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   reset = 4;
   sck   = 5;
   mosi  = 2;
   miso  = 11;
 ;
 
-programmer
+programmer parent "dt006"
   id    = "bascom";
   desc  = "Bascom SAMPLE programming cable";
-  type  = par;
-  reset = 4;
-  sck   = 5;
-  mosi  = 2;
-  miso  = 11;
 ;
 
 programmer
   id     = "alf";
   desc   = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/";
-  type   = par;
+  type   = "par";
+  connection_type = parallel;
   vcc    = 2, 3, 4, 5;
   buff   = 6;
   reset  = 7;
@@ -793,7 +1046,8 @@ programmer
 programmer
   id    = "sp12";
   desc  = "Steve Bolt's Programmer";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   vcc   = 4,5,6,7,8;
   reset = 3;
   sck   = 2;
@@ -804,7 +1058,8 @@ programmer
 programmer
   id     = "picoweb";
   desc   = "Picoweb Programming Cable, http://www.picoweb.net/";
-  type   = par;
+  type   = "par";
+  connection_type = parallel;
   reset  = 2;
   sck    = 3;
   mosi   = 4;
@@ -814,7 +1069,8 @@ programmer
 programmer
   id    = "abcmini";
   desc  = "ABCmini Board, aka Dick Smith HOTCHIP";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   reset = 4;
   sck   = 3;
   mosi  = 2;
@@ -824,7 +1080,8 @@ programmer
 programmer
   id    = "futurlec";
   desc  = "Futurlec.com programming cable.";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   reset = 3;
   sck   = 2;
   mosi  = 1;
@@ -842,7 +1099,8 @@ programmer
 programmer
   id    = "xil";
   desc  = "Xilinx JTAG cable";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   mosi  = 2;
   sck   = 3;
   reset = 4;
@@ -855,7 +1113,8 @@ programmer
 programmer
   id = "dapa";
   desc = "Direct AVR Parallel Access cable";
-  type = par;
+  type = "par";
+  connection_type = parallel;
   vcc   = 3;
   reset = 16;
   sck = 1;
@@ -866,7 +1125,8 @@ programmer
 programmer
   id    = "atisp";
   desc  = "AT-ISP V1.1 programming cable for AVR-SDK1 from <http://micro-research.co.th/> micro-research.co.th";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   reset = ~6;
   sck   = ~8;
   mosi  = ~7;
@@ -876,7 +1136,8 @@ programmer
 programmer
   id    = "ere-isp-avr";
   desc  = "ERE ISP-AVR <http://www.ere.co.th/download/sch050713.pdf>";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   reset = ~4;
   sck   = 3;
   mosi  = 2;
@@ -886,7 +1147,8 @@ programmer
 programmer
   id    = "blaster";
   desc  = "Altera ByteBlaster";
-  type  = par;
+  type  = "par";
+  connection_type = parallel;
   sck   = 2;
   miso  = 11;
   reset = 3;
@@ -895,33 +1157,50 @@ programmer
 ;
 
 # It is almost same as pony-stk200, except vcc on pin 5 to auto
-# disconnect port (download on http://electropol.free.fr)
-programmer
+# disconnect port (download on http://electropol.free.fr/spip/spip.php?article27)
+programmer parent "pony-stk200"
   id    = "frank-stk200";
   desc  = "Frank STK200";
-  type  = par;
+  buff  = ; # delete buff pin assignment
   vcc   = 5;
-  sck   = 6;
-  mosi  = 7;
-  reset = 9;
-  miso  = 10;
-  pgmled = 8;
 ;
 
 # The AT98ISP Cable is a simple parallel dongle for AT89 family.
 # http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2877
 programmer
-id = "89isp";
-desc = "Atmel at89isp cable";
-type = par;
-reset = 17;
-sck = 1;
-mosi = 2;
-miso = 10;
+  id = "89isp";
+  desc = "Atmel at89isp cable";
+  type = "par";
+  connection_type = parallel;
+  reset = 17;
+  sck = 1;
+  mosi = 2;
+  miso = 10;
 ;
 
 
+#This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface
+#
+#To enable it set the configuration below to match the GPIO lines connected to the
+#relevant ISP header pins and uncomment the entry definition. In case you don't
+#have the required permissions to edit this system wide config file put the
+#entry in a separate <your name>.conf file and use it with -C+<your name>.conf
+#on the command line.
 #
+#To check if your avrdude build has support for the linuxgpio programmer compiled in,
+#use -c?type on the command line and look for linuxgpio in the list. If it's not available
+#you need pass the --enable-linuxgpio=yes option to configure and recompile avrdude.
+#
+#programmer
+#  id    = "linuxgpio";
+#  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
+#  type  = "linuxgpio";
+#  reset = ?;
+#  sck   = ?;
+#  mosi  = ?;
+#  miso  = ?;
+#;
+
 # some ultra cheap programmers use bitbanging on the 
 # serialport.
 #
@@ -946,7 +1225,8 @@ miso = 10;
 programmer
   id    = "ponyser";
   desc  = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts";
-  type  = serbb;
+  type  = "serbb";
+  connection_type = serial;
   reset = ~3;
   sck   = 7;
   mosi  = 4;
@@ -956,14 +1236,9 @@ programmer
 # Same as above, different name
 # reset=!txd sck=rts mosi=dtr miso=cts
 
-programmer
+programmer parent "ponyser"
   id    = "siprog";
   desc  = "Lancos SI-Prog <http://www.lancos.com/siprogsch.html>";
-  type  = serbb;
-  reset = ~3;
-  sck   = 7;
-  mosi  = 4;
-  miso  = 8;
 ;
 
 # unknown (dasa in uisp)
@@ -972,7 +1247,8 @@ programmer
 programmer
   id    = "dasa";
   desc  = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts";
-  type  = serbb;
+  type  = "serbb";
+  connection_type = serial;
   reset = 7;
   sck   = 4;
   mosi  = 3;
@@ -985,7 +1261,8 @@ programmer
 programmer
   id    = "dasa3";
   desc  = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts";
-  type  = serbb;
+  type  = "serbb";
+  connection_type = serial;
   reset = ~4;
   sck   = 7;
   mosi  = 3;
@@ -998,7 +1275,8 @@ programmer
 programmer
   id    = "c2n232i";
   desc  = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts";
-  type  = serbb;
+  type  = "serbb";
+  connection_type = serial;
   reset = 4;
   sck   = ~7;
   mosi  = ~3;
@@ -1261,6 +1539,8 @@ part
     programfusepolltimeout = 25;
     programlockpolltimeout = 25;
 
+    ocdrev              = 0;
+
     memory "eeprom"
         size            = 64;
         page_size       = 4;
@@ -1521,6 +1801,7 @@ part
 part
     id               = "1200";
     desc             = "AT90S1200";
+    is_at90s1200     = yes;
     stk500_devcode   = 0x33;
     avr910_devcode   = 0x13;
     signature        = 0x1e 0x90 0x01;
@@ -2555,7 +2836,7 @@ part
 
 part
     id               = "m103";
-    desc             = "ATMEGA103";
+    desc             = "ATmega103";
     stk500_devcode   = 0xB1;
     avr910_devcode   = 0x41;
     signature        = 0x1e 0x97 0x01;
@@ -2695,7 +2976,7 @@ part
 
 part
     id               = "m64";
-    desc             = "ATMEGA64";
+    desc             = "ATmega64";
     has_jtag         = yes;
     stk500_devcode   = 0xA0;
     avr910_devcode   = 0x45;
@@ -2745,6 +3026,8 @@ part
     spmcr               = 0x68;
     allowfullpagebitstream = yes;
 
+    ocdrev              = 2;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -2876,7 +3159,7 @@ part
 
 part
     id               = "m128";
-    desc             = "ATMEGA128";
+    desc             = "ATmega128";
     has_jtag         = yes;
     stk500_devcode   = 0xB2;
     avr910_devcode   = 0x43;
@@ -2927,6 +3210,8 @@ part
     rampz               = 0x3b;
     allowfullpagebitstream = yes;
 
+    ocdrev              = 1;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -3106,6 +3391,8 @@ part
     eecr                = 0x3f;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -3296,6 +3583,8 @@ part
     eecr                = 0x3f;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -3486,6 +3775,8 @@ part
     eecr                = 0x3f;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -3625,7 +3916,7 @@ part
 
 part
     id               = "m16";
-    desc             = "ATMEGA16";
+    desc             = "ATmega16";
     has_jtag         = yes;
     stk500_devcode   = 0x82;
     avr910_devcode   = 0x74;
@@ -3675,6 +3966,8 @@ part
     spmcr               = 0x57;
     allowfullpagebitstream = yes;
 
+    ocdrev              = 2;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
@@ -3801,16 +4094,39 @@ part
 
 # close to ATmega16
 
-part
+part parent "m16"
     id               = "m164p";
-    desc             = "ATMEGA164P";
+    desc             = "ATmega164P";
+    signature        = 0x1e 0x94 0x0a;
+
+    progmodedelay       = 0;
+    latchcycles         = 5;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 1;
+    allowfullpagebitstream = no;
+    chip_erase_delay = 55000;
+
+    ocdrev              = 3;
+  ;
+
+
+#------------------------------------------------------------
+# ATmega324P
+#------------------------------------------------------------
+
+# similar to ATmega164P
+
+part
+    id               = "m324p";
+    desc             = "ATmega324P";
     has_jtag         = yes;
     stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
     avr910_devcode   = 0x74;
-    signature        = 0x1e 0x94 0x0a;
+    signature        = 0x1e 0x95 0x08;
     pagel            = 0xd7;
     bs2              = 0xa0;
-    chip_erase_delay = 9000;
+    chip_erase_delay = 55000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
@@ -3852,21 +4168,23 @@ part
     spmcr               = 0x57;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
-        size            = 512;
+        size            = 1024;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x   x  a9  a8",
+                          "  0   0   x   x      x a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x  a9  a8",
+                          "  0   0   x   x      x a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
@@ -3876,7 +4194,7 @@ part
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x  a9  a8",
+			  "  0   0   x   x      x a10  a9  a8",
 			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
@@ -3888,20 +4206,20 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 16384;
+        size            = 32768;
         page_size       = 128;
-        num_pages       = 128;
+        num_pages       = 256;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
@@ -3916,13 +4234,13 @@ part
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x21;
 	delay		= 6;
-	blocksize	= 128;
+	blocksize	= 256;
 	readsize	= 256;
       ;
 
@@ -3987,21 +4305,36 @@ part
 
 
 #------------------------------------------------------------
-# ATmega324P
+# ATmega324PA
 #------------------------------------------------------------
 
-# similar to ATmega164P
+# similar to ATmega324P
+
+part parent "m324p"
+    id               = "m324pa";
+    desc             = "ATmega324PA";
+    signature        = 0x1e 0x95 0x11;
+
+    ocdrev              = 3;
+  ;
+
+
+#------------------------------------------------------------
+# ATmega644
+#------------------------------------------------------------
+
+# similar to ATmega164
 
 part
-    id               = "m324p";
-    desc             = "ATMEGA324P";
+    id               = "m644";
+    desc             = "ATmega644";
     has_jtag         = yes;
     stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
     avr910_devcode   = 0x74;
-    signature        = 0x1e 0x95 0x08;
+    signature        = 0x1e 0x96 0x09;
     pagel            = 0xd7;
     bs2              = 0xa0;
-    chip_erase_delay = 9000;
+    chip_erase_delay = 55000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
@@ -4023,13 +4356,13 @@ part
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
         0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
+    latchcycles         = 6;
+    togglevtg           = 0;
+    poweroffdelay       = 0;
+    resetdelayms        = 0;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -4043,32 +4376,34 @@ part
     spmcr               = 0x57;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 1024;
+        page_size       = 8;  /* for parallel programming */
+        size            = 2048;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x a10  a9  a8",
+                          "  0   0   x   x    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x a10  a9  a8",
+                          "  0   0   x   x    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
+			  "  0   0   0   0      0  a2  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  0   0   x   x    a11 a10  a9  a8",
+			  " a7  a6  a5  a4     a3   0   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
@@ -4079,36 +4414,36 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 32768;
-        page_size       = 128;
+        size            = 65536;
+        page_size       = 256;
         num_pages       = 256;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
                           "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
                           "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x21;
@@ -4176,23 +4511,38 @@ part
         ;
   ;
 
+#------------------------------------------------------------
+# ATmega644P
+#------------------------------------------------------------
+
+# similar to ATmega164p
+
+part parent "m644"
+    id               = "m644p";
+    desc             = "ATmega644P";
+    signature        = 0x1e 0x96 0x0a;
+
+    ocdrev              = 3;
+  ;
+
+
 
 #------------------------------------------------------------
-# ATmega324PA
+# ATmega1284P
 #------------------------------------------------------------
 
-# similar to ATmega324P
+# similar to ATmega164p
 
 part
-    id               = "m324pa";
-    desc             = "ATmega324PA";
+    id               = "m1284p";
+    desc             = "ATmega1284P";
     has_jtag         = yes;
     stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
     avr910_devcode   = 0x74;
-    signature        = 0x1e 0x95 0x11;
+    signature        = 0x1e 0x97 0x05;
     pagel            = 0xd7;
     bs2              = 0xa0;
-    chip_erase_delay = 9000;
+    chip_erase_delay = 55000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
@@ -4208,16 +4558,16 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 0;
+    pollmethod		= 1;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
         0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 5;
+    latchcycles         = 6;
     togglevtg           = 1;
     poweroffdelay       = 15;
     resetdelayms        = 1;
@@ -4234,32 +4584,34 @@ part
     spmcr               = 0x57;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 1024;
+        page_size       = 8;  /* for parallel programming */
+        size            = 4096;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x a10  a9  a8",
+                          "  0   0   x   x    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x a10  a9  a8",
+                          "  0   0   x   x    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
+			  "  0   0   0   0      0  a2  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  0   0   x   x    a11 a10  a9  a8",
+			  " a7  a6  a5  a4     a3   0   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
@@ -4270,40 +4622,40 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 32768;
-        page_size       = 128;
-        num_pages       = 256;
+        size            = 131072;
+        page_size       = 256;
+        num_pages       = 512;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
                           "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
                           "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x21;
-	delay		= 6;
+	mode		= 0x41;
+	delay		= 10;
 	blocksize	= 256;
 	readsize	= 256;
       ;
@@ -4368,28 +4720,75 @@ part
   ;
 
 
+
 #------------------------------------------------------------
-# ATmega644
+# ATmega162
 #------------------------------------------------------------
 
-# similar to ATmega164
-
 part
-    id               = "m644";
-    desc             = "ATMEGA644";
+    id               = "m162";
+    desc             = "ATmega162";
     has_jtag         = yes;
-    stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
-    avr910_devcode   = 0x74;
-    signature        = 0x1e 0x96 0x09;
+    stk500_devcode   = 0x83;
+    avr910_devcode   = 0x63;
+    signature        = 0x1e 0x94 0x04;
+    chip_erase_delay = 9000;
     pagel            = 0xd7;
     bs2              = 0xa0;
-    chip_erase_delay = 9000;
+
+    idr              = 0x04;
+    spmcr            = 0x57;
+    allowfullpagebitstream = yes;
+
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                        "x x x x  x x x x    x x x x  x x x x";
 
+    ocdrev              = 2;
+
+    memory "flash"
+        paged           = yes;
+        size            = 16384;
+        page_size       = 128;
+        num_pages       = 128;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        readback_p1     = 0xff;
+        readback_p2     = 0xff;
+
+        read_lo         = "  0   0   1   0      0   0   0   0",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
+
+        read_hi         = "  0   0   1   0      1   0   0   0",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
+
+        loadpage_lo     = "  0   1   0   0      0   0   0   0",
+                          "  0   0   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
+
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  0   0   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
+
+        writepage       = "  0   1   0   0      1   1   0   0",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
+                          "  x   x   x   x      x   x   x   x";
+       mode        = 0x41;
+    delay       = 10;
+    blocksize   = 128;
+    readsize    = 256;  
+
+        ;
+
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -4405,7 +4804,7 @@ part
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
         0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 6;
@@ -4421,317 +4820,248 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    allowfullpagebitstream = no;
-
     memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 2048;
+        page_size       = 4;  /* for parallel programming */
+        size            = 512;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x    a11 a10  a9  a8",
+
+                read            = "  1   0   1   0      0   0   0   0",
+                          "  0   0   x   x      x   x  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
+                write           = "  1   1   0   0      0   0   0   0",
+                          "  0   0   x   x      x   x  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
+			  "  0   0   0   0      0   0  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x    a11 a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  0   0   x   x      x   x  a9  a8",
+			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 128;
-	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x21;
-	delay		= 6;
-	blocksize	= 256;
+	delay		= 20;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
+        ;
 
     memory "lfuse"
         size            = 1;
+        min_write_delay = 16000;
+        max_write_delay = 16000;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
                           "x x x x  x x x x   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
+        ;
 
     memory "hfuse"
         size            = 1;
+        min_write_delay = 16000;
+        max_write_delay = 16000;
+
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
                           "x x x x  x x x x   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
+        ;
 
     memory "efuse"
         size            = 1;
+        min_write_delay = 16000;
+        max_write_delay = 16000;
 
         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
                           "x x x x  x x x x  o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
                           "x x x x  x x x x  1 1 1 1  1 i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
       ;
 
+    memory "lock"
+        size            = 1;
+        min_write_delay = 16000;
+        max_write_delay = 16000;
+
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x   x x o o  o o o o";
+
+        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
+                          "x x x x  x x x x   1 1 i i  i i i i";
+        ;
+
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
+
+        read            = "0  0  1  1   0  0  0  0   0  0  x  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
+        ;
 
     memory "calibration"
         size            = 1;
 
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
+        read            = "0 0 1 1  1 0 0 0   0 0 x x  x x x x",
                           "0 0 0 0  0 0 0 0   o o o o  o o o o";
         ;
-  ;
+;
+
+
 
 #------------------------------------------------------------
-# ATmega644P
+# ATmega163
 #------------------------------------------------------------
 
-# similar to ATmega164p
-
 part
-    id               = "m644p";
-    desc             = "ATMEGA644P";
-    has_jtag         = yes;
-    stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
-    avr910_devcode   = 0x74;
-    signature        = 0x1e 0x96 0x0a;
+    id               = "m163";
+    desc             = "ATmega163";
+    stk500_devcode   = 0x81;
+    avr910_devcode   = 0x64;
+    signature        = 0x1e 0x94 0x02;
+    chip_erase_delay = 32000;
     pagel            = 0xd7;
     bs2              = 0xa0;
-    chip_erase_delay = 9000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
                        "x x x x  x x x x    x x x x  x x x x";
 
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 0;
+    timeout             = 200;
+    stabdelay           = 100;
+    cmdexedelay         = 25;
+    synchloops          = 32;
+    bytedelay           = 0;
+    pollindex           = 3;
+    pollvalue           = 0x53;
+    predelay            = 1;
+    postdelay           = 1;
+    pollmethod          = 0;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
         0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 6;
+    latchcycles         = 0;
     togglevtg           = 0;
     poweroffdelay       = 0;
     resetdelayms        = 0;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
+    chiperasepolltimeout = 30;
     programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
+    programfusepolltimeout = 2;
     programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
+    programlockpolltimeout = 2;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    allowfullpagebitstream = no;
 
-    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 2048;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+   memory "eeprom"
+        size            = 512;
+        min_write_delay = 4000;
+        max_write_delay = 4000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x    a11 a10  a9  a8",
+                          "  x   x   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
+                          "  x   x   x   x      x   x   x  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x    a11 a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 128;
-	readsize	= 256;
+        mode            = 0x41;
+        delay           = 20;
+        blocksize       = 4;
+        readsize        = 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        size            = 16384;
+        page_size       = 128;
+        num_pages       = 128;
+        min_write_delay = 16000;
+        max_write_delay = 16000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  x   x   x a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  x   x   x a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
+                          "  x   x   x a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x21;
-	delay		= 6;
-	blocksize	= 256;
+	mode		= 0x11;
+	delay		= 20;
+	blocksize	= 128;
 	readsize	= 256;
       ;
 
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
     memory "lfuse"
         size            = 1;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+                          "x x x x  x x x x   o o x x  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+                          "x x x x  x x x x   i i 1 1  i i i i";
       ;
 
     memory "hfuse"
         size            = 1;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+                          "x x x x  x x x x   x x x x  1 o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+                          "x x x x  x x x x   1 1 1 1  1 i i i";
       ;
 
-    memory "efuse"
+    memory "lock"
         size            = 1;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  0 x x x   x x o o  o o o o";
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  1 1 1 1  1 i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
+                          "x x x x  x x x x   1 1 i i  i i i i";
       ;
 
     memory "signature"
@@ -4742,36 +5072,28 @@ part
 
     memory "calibration"
         size            = 1;
-
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
+        read            = "0 0 1 1  1 0 0 0   x x x x  x x x x",
                           "0 0 0 0  0 0 0 0   o o o o  o o o o";
-        ;
+      ;
   ;
 
-
-
 #------------------------------------------------------------
-# ATmega1284P
+# ATmega169
 #------------------------------------------------------------
 
-# similar to ATmega164p
-
 part
-    id               = "m1284p";
-    desc             = "ATMEGA1284P";
+    id               = "m169";
+    desc             = "ATmega169";
     has_jtag         = yes;
-    stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
-    avr910_devcode   = 0x74;
-    signature        = 0x1e 0x97 0x05;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
+    stk500_devcode   = 0x85;
+    avr910_devcode   = 0x78;
+    signature        = 0x1e 0x94 0x05;
     chip_erase_delay = 9000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
                        "x x x x  x x x x    x x x x  x x x x";
-
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -4787,10 +5109,10 @@ part
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
         0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 6;
+    latchcycles         = 5;
     togglevtg           = 1;
     poweroffdelay       = 15;
     resetdelayms        = 1;
@@ -4805,209 +5127,156 @@ part
 
     idr                 = 0x31;
     spmcr               = 0x57;
-    allowfullpagebitstream = no;
 
-    memory "eeprom"
+    ocdrev              = 2;
+
+   memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 4096;
+        page_size       = 4;  /* for parallel programming */
+        size            = 512;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x    a11 a10  a9  a8",
+                          "  x   x   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x    a11 a10  a9  a8",
+                          "  x   x   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
+			  "  0   0   0   0      0   0  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x    a11 a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  0   0   x   x      x   x   x  a8",
+			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 128;
+	delay		= 20;
+	blocksize	= 4;
 	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 131072;
-        page_size       = 256;
-        num_pages       = 512;
+        size            = 16384;
+        page_size       = 128;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  x   x   x a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  x   x   x a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
+                          "  x   x   x a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 256;
+	delay		= 6;
+	blocksize	= 128;
 	readsize	= 256;
       ;
 
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
     memory "lfuse"
         size            = 1;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
                           "x x x x  x x x x   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
       ;
 
     memory "hfuse"
         size            = 1;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
                           "x x x x  x x x x   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
       ;
 
     memory "efuse"
         size            = 1;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x  x x x x  i i i i";
 
         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
                           "x x x x  x x x x  o o o o  o o o o";
+      ;
 
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  1 1 1 1  1 i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+    memory "lock"
+        size            = 1;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x   x x o o  o o o o";
+
+        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
+                          "x x x x  x x x x   1 1 i i  i i i i";
       ;
 
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
 
     memory "calibration"
         size            = 1;
-
         read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
                           "0 0 0 0  0 0 0 0   o o o o  o o o o";
-        ;
+      ;
   ;
 
-
-
 #------------------------------------------------------------
-# ATmega162
+# ATmega329
 #------------------------------------------------------------
 
 part
-    id               = "m162";
-    desc             = "ATMEGA162";
+    id               = "m329";
+    desc             = "ATmega329";
     has_jtag         = yes;
-    stk500_devcode   = 0x83;
-    avr910_devcode   = 0x63;
-    signature        = 0x1e 0x94 0x04;
+#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
+#    avr910_devcode   = 0x?;  # try the ATmega169 one:
+    avr910_devcode   = 0x75;
+    signature        = 0x1e 0x95 0x03;
     chip_erase_delay = 9000;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
-
-    idr              = 0x04;
-    spmcr            = 0x57;
-    allowfullpagebitstream = yes;
-
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
                        "x x x x  x x x x    x x x x  x x x x";
-
-    memory "flash"
-        paged           = yes;
-        size            = 16384;
-        page_size       = 128;
-        num_pages       = 128;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-       mode        = 0x41;
-    delay       = 10;
-    blocksize   = 128;
-    readsize    = 256;  
-
-        ;
-
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -5017,7 +5286,7 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 0;
+    pollmethod		= 1;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -5026,10 +5295,10 @@ part
         0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 6;
-    togglevtg           = 0;
-    poweroffdelay       = 0;
-    resetdelayms        = 0;
+    latchcycles         = 5;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 1;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -5039,22 +5308,26 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    memory "eeprom"
+    idr                 = 0x31;
+    spmcr               = 0x57;
+
+    ocdrev              = 3;
+
+   memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
-        size            = 512;
+        size            = 1024;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-
-                read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x   x  a9  a8",
+	read            = "  1   0   1   0      0   0   0   0",
+                          "  x   x   x   x      x   x  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
-                write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x  a9  a8",
+	write           = "  1   1   0   0      0   0   0   0",
+                          "  x   x   x   x      x   x  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
@@ -5070,103 +5343,176 @@ part
 
 	mode		= 0x41;
 	delay		= 20;
-	blocksize	= 4;
+	blocksize	= 8;
 	readsize	= 256;
-        ;
+      ;
+
+    memory "flash"
+        paged           = yes;
+        size            = 32768;
+        page_size       = 128;
+        num_pages       = 256;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        readback_p1     = 0xff;
+        readback_p2     = 0xff;
+        read_lo         = "  0   0   1   0      0   0   0   0",
+                          "  x a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
+
+        read_hi         = "  0   0   1   0      1   0   0   0",
+                          "  x a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
+
+        loadpage_lo     = "  0   1   0   0      0   0   0   0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
+
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
+
+        writepage       = "  0   1   0   0      1   1   0   0",
+                          "  x   x   x a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
+                          "  x   x   x   x      x   x   x   x";
+
+	mode		= 0x41;
+	delay		= 6;
+	blocksize	= 256;
+	readsize	= 256;
+      ;
 
     memory "lfuse"
         size            = 1;
-        min_write_delay = 16000;
-        max_write_delay = 16000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
                           "x x x x  x x x x   i i i i  i i i i";
-        ;
+      ;
 
     memory "hfuse"
         size            = 1;
-        min_write_delay = 16000;
-        max_write_delay = 16000;
-
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
                           "x x x x  x x x x   i i i i  i i i i";
-        ;
+      ;
 
     memory "efuse"
         size            = 1;
-        min_write_delay = 16000;
-        max_write_delay = 16000;
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   o o o o  o o o o";
 
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  1 1 1 1  1 i i i";
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x   x x x x  x i i i";
       ;
 
     memory "lock"
         size            = 1;
-        min_write_delay = 16000;
-        max_write_delay = 16000;
-
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   x x o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
                           "x x x x  x x x x   1 1 i i  i i i i";
-        ;
+      ;
 
     memory "signature"
         size            = 3;
-
-        read            = "0  0  1  1   0  0  0  0   0  0  x  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-        ;
+      ;
 
     memory "calibration"
         size            = 1;
-
-        read            = "0 0 1 1  1 0 0 0   0 0 x x  x x x x",
+        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
                           "0 0 0 0  0 0 0 0   o o o o  o o o o";
-        ;
-;
+      ;
+  ;
+
+#------------------------------------------------------------
+# ATmega329P
+#------------------------------------------------------------
+# Identical to ATmega329 except of the signature
 
+part parent "m329"
+    id               = "m329p";
+    desc             = "ATmega329P";
+    signature        = 0x1e 0x95 0x0b;
 
+    ocdrev              = 3;
+  ;
 
 #------------------------------------------------------------
-# ATmega163
+# ATmega3290
+#------------------------------------------------------------
+
+# identical to ATmega329
+
+part parent "m329"
+    id               = "m3290";
+    desc             = "ATmega3290";
+    signature        = 0x1e 0x95 0x04;
+
+    ocdrev              = 3;
+  ;
+
+#------------------------------------------------------------
+# ATmega3290P
+#------------------------------------------------------------
+
+# identical to ATmega3290 except of the signature
+
+part parent "m3290"
+    id               = "m3290p";
+    desc             = "ATmega3290P";
+    signature        = 0x1e 0x95 0x0c;
+
+    ocdrev              = 3;
+  ;
+
+#------------------------------------------------------------
+# ATmega649
 #------------------------------------------------------------
 
 part
-    id               = "m163";
-    desc             = "ATMEGA163";
-    stk500_devcode   = 0x81;
-    avr910_devcode   = 0x64;
-    signature        = 0x1e 0x94 0x02;
-    chip_erase_delay = 32000;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
+    id               = "m649";
+    desc             = "ATmega649";
+    has_jtag         = yes;
+#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
+#    avr910_devcode   = 0x?;  # try the ATmega169 one:
+    avr910_devcode   = 0x75;
+    signature        = 0x1e 0x96 0x03;
+    chip_erase_delay = 9000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
                        "x x x x  x x x x    x x x x  x x x x";
-
-    timeout             = 200;
-    stabdelay           = 100;
-    cmdexedelay         = 25;
-    synchloops          = 32;
-    bytedelay           = 0;
-    pollindex           = 3;
-    pollvalue           = 0x53;
-    predelay            = 1;
-    postdelay           = 1;
-    pollmethod          = 0;
+    timeout		= 200;
+    stabdelay		= 100;
+    cmdexedelay		= 25;
+    synchloops		= 32;
+    bytedelay		= 0;
+    pollindex		= 3;
+    pollvalue		= 0x53;
+    predelay		= 1;
+    postdelay		= 1;
+    pollmethod		= 1;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -5175,109 +5521,137 @@ part
         0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 0;
-    togglevtg           = 0;
-    poweroffdelay       = 0;
-    resetdelayms        = 0;
+    latchcycles         = 5;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 1;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
-    chiperasepolltimeout = 30;
+    chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
-    programfusepolltimeout = 2;
+    programfusepolltimeout = 5;
     programlockpulsewidth = 0;
-    programlockpolltimeout = 2;
+    programlockpolltimeout = 5;
+
+    idr                 = 0x31;
+    spmcr               = 0x57;
 
+    ocdrev              = 3;
 
    memory "eeprom"
-        size            = 512;
-        min_write_delay = 4000;
-        max_write_delay = 4000;
+        paged           = no; /* leave this "no" */
+        page_size       = 8;  /* for parallel programming */
+        size            = 2048;
+        min_write_delay = 9000;
+        max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x  a8",
+                          "  x   x   x   x      x a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x  a8",
+                          "  x   x   x   x      x a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
-        mode            = 0x41;
-        delay           = 20;
-        blocksize       = 4;
-        readsize        = 256;
+
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0  a2  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
+
+	writepage	= "  1   1   0   0      0   0   1   0",
+			  "  0   0   x   x      x a10  a9  a8",
+			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  x   x   x   x      x   x   x   x";
+
+	mode		= 0x41;
+	delay		= 20;
+	blocksize	= 8;
+	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 16384;
-        page_size       = 128;
-        num_pages       = 128;
-        min_write_delay = 16000;
-        max_write_delay = 16000;
+        size            = 65536;
+        page_size       = 256;
+        num_pages       = 256;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
                           "  x   x   x a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x11;
-	delay		= 20;
-	blocksize	= 128;
+	mode		= 0x41;
+	delay		= 6;
+	blocksize	= 256;
 	readsize	= 256;
       ;
 
     memory "lfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o x x  o o o o";
+                          "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i 1 1  i i i i";
+                          "x x x x  x x x x   i i i i  i i i i";
       ;
 
     memory "hfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  1 o o o";
+                          "x x x x  x x x x   o o o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   1 1 1 1  1 i i i";
+                          "x x x x  x x x x   i i i i  i i i i";
+      ;
+
+    memory "efuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   o o o o  o o o o";
+
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x   x x x x  x i i i";
       ;
 
     memory "lock"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  0 x x x   x x o o  o o o o";
+                          "x x x x  x x x x   x x o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
                           "x x x x  x x x x   1 1 i i  i i i i";
@@ -5285,29 +5659,46 @@ part
 
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
 
     memory "calibration"
         size            = 1;
-        read            = "0 0 1 1  1 0 0 0   x x x x  x x x x",
+        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
                           "0 0 0 0  0 0 0 0   o o o o  o o o o";
       ;
   ;
 
 #------------------------------------------------------------
-# ATmega169
+# ATmega6490
+#------------------------------------------------------------
+
+# identical to ATmega649
+
+part parent "m649"
+    id               = "m6490";
+    desc             = "ATmega6490";
+    signature        = 0x1e 0x96 0x04;
+
+    ocdrev              = 3;
+  ;
+
+#------------------------------------------------------------
+# ATmega32
 #------------------------------------------------------------
 
 part
-    id               = "m169";
-    desc             = "ATMEGA169";
+    id               = "m32";
+    desc             = "ATmega32";
     has_jtag         = yes;
-    stk500_devcode   = 0x85;
-    avr910_devcode   = 0x78;
-    signature        = 0x1e 0x94 0x05;
+    stk500_devcode   = 0x91;
+    avr910_devcode   = 0x72;
+    signature        = 0x1e 0x95 0x02;
     chip_erase_delay = 9000;
+    pagel            = 0xd7;
+    bs2              = 0xa0;
+    reset            = dedicated;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
@@ -5322,7 +5713,7 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
+    pollmethod		= 0;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -5331,10 +5722,10 @@ part
         0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
+    latchcycles         = 6;
+    togglevtg           = 0;
+    poweroffdelay       = 0;
+    resetdelayms        = 0;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -5346,23 +5737,26 @@ part
 
     idr                 = 0x31;
     spmcr               = 0x57;
+    allowfullpagebitstream = yes;
+
+    ocdrev              = 2;
 
    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 512;
+        paged           = no;   /* leave this "no" */
+        page_size       = 4;    /* for parallel programming */
+        size            = 1024;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x  a8",
+        read            = "  1   0   1   0      0   0   0   0",
+                          "  0   0   x   x      x   x  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
+        write           = "  1   1   0   0      0   0   0   0",
+                          "  0   0   x   x      x   x  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
@@ -5371,53 +5765,53 @@ part
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x  a8",
+			  "  0   0   x   x      x   x  a9  a8",
 			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
+	mode		= 0x04;
+	delay		= 10;
+	blocksize	= 64;
 	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 16384;
+        size            = 32768;
         page_size       = 128;
-        num_pages       = 128;
+        num_pages       = 256;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
+                          "  0   0   x   x      x   x   x   x",
                           "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
+                          "  0   0   x   x      x   x   x   x",
                           "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
                           " a7  a6   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x41;
+	mode		= 0x21;
 	delay		= 6;
-	blocksize	= 128;
+	blocksize	= 64;
 	readsize	= 256;
       ;
 
@@ -5443,15 +5837,6 @@ part
                           "x x x x  x x x x   i i i i  i i i i";
       ;
 
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-      ;
-
     memory "lock"
         size            = 1;
         min_write_delay = 2000;
@@ -5465,30 +5850,30 @@ part
 
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x x",
+                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o o";
       ;
 
     memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
+        size            = 4;
+        read            = "0 0 1 1  1 0 0 0    0 0 x x  x x x x",
+                          "0 0 0 0  0 0 a1 a0  o o o o  o o o o";
       ;
   ;
 
 #------------------------------------------------------------
-# ATmega329
+# ATmega161
 #------------------------------------------------------------
 
 part
-    id               = "m329";
-    desc             = "ATMEGA329";
-    has_jtag         = yes;
-#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
-#    avr910_devcode   = 0x?;  # try the ATmega169 one:
-    avr910_devcode   = 0x75;
-    signature        = 0x1e 0x95 0x03;
-    chip_erase_delay = 9000;
+    id               = "m161";
+    desc             = "ATmega161";
+    stk500_devcode   = 0x80;
+    avr910_devcode   = 0x60;
+    signature        = 0x1e 0x94 0x01;
+    chip_erase_delay = 28000;
+    pagel            = 0xd7;
+    bs2              = 0xa0;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
@@ -5503,7 +5888,7 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
+    pollmethod		= 0;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -5512,72 +5897,57 @@ part
         0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
+    latchcycles         = 0;
+    togglevtg           = 0;
+    poweroffdelay       = 0;
+    resetdelayms        = 0;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
+    chiperasepolltimeout = 30;
     programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
+    programfusepolltimeout = 2;
     programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    idr                 = 0x31;
-    spmcr               = 0x57;
+    programlockpolltimeout = 2;
 
    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 1024;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        size            = 512;
+        min_write_delay = 3400;
+        max_write_delay = 3400;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
+                          "  x   x   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
+                          "  x   x   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x  a9  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 8;
+	mode		= 0x04;
+	delay		= 5;
+	blocksize	= 128;
 	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 32768;
+        size            = 16384;
         page_size       = 128;
-        num_pages       = 256;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        num_pages       = 128;
+        min_write_delay = 14000;
+        max_write_delay = 14000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
+                          "  x   x   x a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
+                          "  x   x   x a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
@@ -5596,88 +5966,60 @@ part
                           " a7  a6   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 256;
+	mode		= 0x21;
+	delay		= 16;
+	blocksize	= 128;
 	readsize	= 256;
       ;
 
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "efuse"
+    memory "fuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+        min_write_delay = 2000;
+        max_write_delay = 2000;
+        read            = "0 1 0 1  0 0 0 0   x x x x  x x x x",
+                          "x x x x  x x x x   x o x o  o o o o";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
+        write           = "1 0 1 0  1 1 0 0   1 0 1 x  x x x x",
+                          "x x x x  x x x x   1 i 1 i  i i i i";
       ;
 
     memory "lock"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   x x o o  o o o o";
 
         write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
                           "x x x x  x x x x   1 1 i i  i i i i";
       ;
-
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-      ;
   ;
 
+
 #------------------------------------------------------------
-# ATmega329P
+# ATmega8
 #------------------------------------------------------------
-# Identical to ATmega329 except of the signature
 
 part
-    id               = "m329p";
-    desc             = "ATMEGA329P";
-    has_jtag         = yes;
-#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
-#    avr910_devcode   = 0x?;  # try the ATmega169 one:
-    avr910_devcode   = 0x75;
-    signature        = 0x1e 0x95 0x0b;
-    chip_erase_delay = 9000;
+    id               = "m8";
+    desc             = "ATmega8";
+    stk500_devcode   = 0x70;
+    avr910_devcode   = 0x76;
+    signature        = 0x1e 0x93 0x07;
+    pagel            = 0xd7;
+    bs2              = 0xc2;
+    chip_erase_delay = 10000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                        "x x x x  x x x x    x x x x  x x x x";
+
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -5687,21 +6029,22 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
+    pollmethod		= 0;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 5;
     togglevtg           = 1;
     poweroffdelay       = 15;
-    resetdelayms        = 1;
+    resetdelayms        = 2;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
+    resetdelay          = 15;
     chiperasepulsewidth = 0;
     chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
@@ -5709,87 +6052,72 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-
-   memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 1024;
+    memory "eeprom"
+        size            = 512;
+        page_size       = 4;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
+                          "  0   0   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  0   0   x   x      x   x   x  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x  a9  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
+	mode		= 0x04;
 	delay		= 20;
-	blocksize	= 8;
+	blocksize	= 128;
 	readsize	= 256;
       ;
-
     memory "flash"
         paged           = yes;
-        size            = 32768;
-        page_size       = 128;
-        num_pages       = 256;
+        size            = 8192;
+        page_size       = 64;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        readback_p2     = 0x00;
+        read_lo         = "  0   0   1   0    0   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_hi         = "  0   0   1   0    1   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  0   0   0   0      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  0   0   0   0      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          "  0   0   0   0    a11 a10  a9  a8",
+                          " a7  a6  a5   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 256;
+	mode		= 0x21;
+	delay		= 10;
+	blocksize	= 64;
 	readsize	= 256;
       ;
 
     memory "lfuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
@@ -5799,8 +6127,8 @@ part
 
     memory "hfuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
@@ -5808,21 +6136,10 @@ part
                           "x x x x  x x x x   i i i i  i i i i";
       ;
 
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
-      ;
-
     memory "lock"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   x x o o  o o o o";
 
@@ -5830,39 +6147,38 @@ part
                           "x x x x  x x x x   1 1 i i  i i i i";
       ;
 
+    memory "calibration"
+        size            = 4;
+        read            = "0  0  1  1   1  0  0  0   0  0  x  x   x  x  x  x",
+                          "0  0  0  0   0  0 a1 a0   o  o  o  o   o  o  o  o";
+      ;
+
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-      ;
   ;
 
+
+
 #------------------------------------------------------------
-# ATmega3290
+# ATmega8515
 #------------------------------------------------------------
 
-# identical to ATmega329
-
 part
-    id               = "m3290";
-    desc             = "ATMEGA3290";
-    has_jtag         = yes;
-#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
-#    avr910_devcode   = 0x?;  # try the ATmega169 one:
-    avr910_devcode   = 0x75;
-    signature        = 0x1e 0x95 0x04;
+    id               = "m8515";
+    desc             = "ATmega8515";
+    stk500_devcode   = 0x63;
+    avr910_devcode   = 0x3A;
+    signature        = 0x1e 0x93 0x06;
     chip_erase_delay = 9000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                        "x x x x  x x x x    x x x x  x x x x";
+
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -5872,7 +6188,7 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
+    pollmethod		= 0;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -5881,10 +6197,10 @@ part
         0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
+    latchcycles         = 6;
+    togglevtg           = 0;
+    poweroffdelay       = 0;
+    resetdelayms        = 0;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -5894,80 +6210,64 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-
-   memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 1024;
+    memory "eeprom"
+        size            = 512;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
+ read            = "  1   0   1   0      0   0   0   0",
+                          "  0   0   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
+ write           = "  1   1   0   0      0   0   0   0",
+                          "  0   0   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x  a9  a8",
-			  " a7  a6  a5  a4     a3  a3   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
+	mode		= 0x04;
 	delay		= 20;
-	blocksize	= 8;
+	blocksize	= 128;
 	readsize	= 256;
       ;
-
     memory "flash"
         paged           = yes;
-        size            = 32768;
-        page_size       = 128;
-        num_pages       = 256;
+        size            = 8192;
+        page_size       = 64;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_lo         = "  0   0   1   0    0   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_hi         = "  0   0   1   0    1   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  0   0   0   0      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  0   0   0   0      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          "  0   0   0   0    a11 a10  a9  a8",
+                          " a7  a6  a5   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x41;
+	mode		= 0x21;
 	delay		= 6;
-	blocksize	= 256;
+	blocksize	= 64;
 	readsize	= 256;
       ;
 
@@ -5993,17 +6293,6 @@ part
                           "x x x x  x x x x   i i i i  i i i i";
       ;
 
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
-      ;
-
     memory "lock"
         size            = 1;
         min_write_delay = 4500;
@@ -6015,39 +6304,41 @@ part
                           "x x x x  x x x x   1 1 i i  i i i i";
       ;
 
+    memory "calibration"
+        size            = 4;
+        read            = "0 0 1 1  1 0 0 0     0 0 x x  x x x x",
+                          "0 0 0 0  0 0 a1 a0   o o o o  o o o o";
+      ;
+
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-      ;
   ;
 
+
+
+
 #------------------------------------------------------------
-# ATmega3290P
+# ATmega8535
 #------------------------------------------------------------
 
-# identical to ATmega3290 except of the signature
-
 part
-    id               = "m3290p";
-    desc             = "ATMEGA3290P";
-    has_jtag         = yes;
-#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
-#    avr910_devcode   = 0x?;  # try the ATmega169 one:
-    avr910_devcode   = 0x75;
-    signature        = 0x1e 0x95 0x0c;
+    id               = "m8535";
+    desc             = "ATmega8535";
+    stk500_devcode   = 0x64;
+    avr910_devcode   = 0x69;
+    signature        = 0x1e 0x93 0x08;
+    pagel            = 0xd7;
+    bs2              = 0xa0;
     chip_erase_delay = 9000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                        "x x x x  x x x x    x x x x  x x x x";
+
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -6057,7 +6348,7 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
+    pollmethod		= 0;
 
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -6066,10 +6357,10 @@ part
         0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
+    latchcycles         = 6;
+    togglevtg           = 0;
+    poweroffdelay       = 0;
+    resetdelayms        = 0;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -6079,87 +6370,71 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-
-   memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 1024;
+    memory "eeprom"
+        size            = 512;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
+                          "  0   0   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x  a9  a8",
+                          "  0   0   x   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x  a9  a8",
-			  " a7  a6  a5  a4     a3  a3   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
+	mode		= 0x04;
 	delay		= 20;
-	blocksize	= 8;
+	blocksize	= 128;
 	readsize	= 256;
       ;
-
     memory "flash"
         paged           = yes;
-        size            = 32768;
-        page_size       = 128;
-        num_pages       = 256;
+        size            = 8192;
+        page_size       = 64;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_lo         = "  0   0   1   0    0   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  x a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_hi         = "  0   0   1   0    1   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  0   0   0   0      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  0   0   0   0      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          "  0   0   0   0    a11 a10  a9  a8",
+                          " a7  a6  a5   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x41;
+	mode		= 0x21;
 	delay		= 6;
-	blocksize	= 256;
+	blocksize	= 64;
 	readsize	= 256;
       ;
 
     memory "lfuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
@@ -6169,8 +6444,8 @@ part
 
     memory "hfuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
@@ -6178,21 +6453,10 @@ part
                           "x x x x  x x x x   i i i i  i i i i";
       ;
 
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
-      ;
-
     memory "lock"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
+        min_write_delay = 2000;
+        max_write_delay = 2000;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   x x o o  o o o o";
 
@@ -6200,37 +6464,39 @@ part
                           "x x x x  x x x x   1 1 i i  i i i i";
       ;
 
+    memory "calibration"
+        size            = 4;
+        read            = "0 0 1 1  1 0 0 0   0 0 x x  x x x x",
+                          "0 0 0 0  0 0 a1 a0 o o o o  o o o o";
+      ;
+
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-      ;
   ;
 
+
 #------------------------------------------------------------
-# ATmega649
+# ATtiny26
 #------------------------------------------------------------
 
 part
-    id               = "m649";
-    desc             = "ATMEGA649";
-    has_jtag         = yes;
-#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
-#    avr910_devcode   = 0x?;  # try the ATmega169 one:
-    avr910_devcode   = 0x75;
-    signature        = 0x1e 0x96 0x03;
-    chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+    id                  = "t26";
+    desc                = "ATtiny26";
+    stk500_devcode      = 0x21;
+    avr910_devcode      = 0x5e;
+    signature           = 0x1e 0x91 0x09;
+    pagel               = 0xb3;
+    bs2                 = 0xb2;
+    chip_erase_delay    = 9000;
+    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
+                          "x x x x  x x x x   x x x x  x x x x";
+
+    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
+                          "x x x x  x x x x   x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -6240,19 +6506,19 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
+    pollmethod		= 0;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
+        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
+        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
+        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 5;
     togglevtg           = 1;
     poweroffdelay       = 15;
-    resetdelayms        = 1;
+    resetdelayms        = 2;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -6262,160 +6528,138 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-
-   memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 2048;
-        min_write_delay = 9000;
+    memory "eeprom"
+        size            = 128;
+        min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
+        read            = "1  0  1  0   0  0  0  0    x x x x  x x x x",
+                          "x a6 a5 a4  a3 a2 a1 a0    o o o o  o o o o";
 
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
-			  "  x   x   x   x      x   x   x   x";
+        write           = "1  1  0  0   0  0  0  0    x x x x  x x x x",
+                          "x a6 a5 a4  a3 a2 a1 a0    i i i i  i i i i";
 
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 8;
+	mode		= 0x04;
+	delay		= 10;
+	blocksize	= 64;
 	readsize	= 256;
-      ;
+    ;
 
     memory "flash"
         paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
+        size            = 2048;
+        page_size       = 32;
+        num_pages       = 64;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_lo         = "  0  0  1  0   0  0  0  0",
+                          "  x  x  x  x   x  x a9 a8",
+                          " a7 a6 a5 a4  a3 a2 a1 a0",
+                          "  o  o  o  o   o  o  o  o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_hi         = "  0  0  1  0   1  0  0  0",
+                          "  x  x  x  x   x  x a9 a8",
+                          " a7 a6 a5 a4  a3 a2 a1 a0",
+                          "  o  o  o  o   o  o  o  o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        loadpage_lo     = "  0  1  0  0   0  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x  x  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        loadpage_hi     = "  0  1  0  0   1  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x  x  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+        writepage       = "  0  1  0  0   1  1  0  0",
+                          "  x  x  x  x   x  x a9 a8",
+                          " a7 a6 a5 a4   x  x  x  x",
+                          "  x  x  x  x   x  x  x  x";
 
-	mode		= 0x41;
+	mode		= 0x21;
 	delay		= 6;
-	blocksize	= 256;
+	blocksize	= 16;
 	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+    ;
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
+    ;
 
-    memory "hfuse"
+    memory "lock"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
+                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
+        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
+                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
+    ;
 
-    memory "efuse"
+    memory "lfuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
       ;
 
-    memory "lock"
+    memory "hfuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                          "x x x x  x x x x  x x x i  i i i i";
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x  x x x o  o o o o";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
       ;
 
     memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-      ;
-  ;
+        size            = 4;
+        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
+    ;
+
+;
+
 
 #------------------------------------------------------------
-# ATmega6490
+# ATtiny261
 #------------------------------------------------------------
-
-# identical to ATmega649
+# Close to ATtiny26
 
 part
-    id               = "m6490";
-    desc             = "ATMEGA6490";
-    has_jtag         = yes;
-#    stk500_devcode   = 0x85; # no STK500 support, only STK500v2
-#    avr910_devcode   = 0x?;  # try the ATmega169 one:
-    avr910_devcode   = 0x75;
-    signature        = 0x1e 0x96 0x04;
-    chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+    id                  = "t261";
+    desc                = "ATtiny261";
+     has_debugwire = yes;
+     flash_instr   = 0xB4, 0x00, 0x10;
+     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC,
+	             0x99, 0xE1, 0xBB, 0xAC;
+#    stk500_devcode      = 0x21;
+#    avr910_devcode      = 0x5e;
+    signature           = 0x1e 0x91 0x0c;
+    pagel               = 0xb3;
+    bs2                 = 0xb2;
+    chip_erase_delay    = 4000;
+
+    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
+                          "x x x x  x x x x   x x x x  x x x x";
+
+    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
+                          "x x x x  x x x x   x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -6425,19 +6669,19 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
+    pollmethod		= 0;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
+        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
+        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
+        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 5;
     togglevtg           = 1;
     poweroffdelay       = 15;
-    resetdelayms        = 1;
+    resetdelayms        = 2;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -6447,170 +6691,166 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
+    ocdrev              = 1;
 
-   memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 2048;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+    memory "eeprom"
+        paged           = no;
+        size            = 128;
+        page_size       = 4;
+        num_pages       = 32;
+        min_write_delay = 4000;
+        max_write_delay = 4000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
+        read            = "1  0  1  0   0  0  0  0    x x x x  x x x x",
+                          "x a6 a5 a4  a3 a2 a1 a0    o o o o  o o o o";
 
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
-			  "  x   x   x   x      x   x   x   x";
+        write           = "1  1  0  0   0  0  0  0    x x x x  x x x x",
+                          "x a6 a5 a4  a3 a2 a1 a0    i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
+			  "  0   0   0   0      0   0  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  0   0   x   x      x   x   x   x",
+			  "  x  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 8;
+	delay		= 10;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
+    ;
 
     memory "flash"
         paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
+        size            = 2048;
+        page_size       = 32;
+        num_pages       = 64;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_lo         = "  0  0  1  0   0  0  0  0",
+                          "  x  x  x  x   x  x a9 a8",
+                          " a7 a6 a5 a4  a3 a2 a1 a0",
+                          "  o  o  o  o   o  o  o  o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        read_hi         = "  0  0  1  0   1  0  0  0",
+                          "  x  x  x  x   x  x a9 a8",
+                          " a7 a6 a5 a4  a3 a2 a1 a0",
+                          "  o  o  o  o   o  o  o  o";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        loadpage_lo     = "  0  1  0  0   0  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x  x  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+        loadpage_hi     = "  0  1  0  0   1  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x  x  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
+
+        writepage       = "  0  1  0  0   1  1  0  0",
+                          "  x  x  x  x   x  x a9 a8",
+                          " a7 a6 a5 a4   x  x  x  x",
+                          "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 256;
+	blocksize	= 32;
 	readsize	= 256;
-      ;
+    ;
 
-    memory "lfuse"
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
+    ;
+
+    memory "lock"
         size            = 1;
+        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
+                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
+
+        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
+                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
         min_write_delay = 4500;
         max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+    ;
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
+    memory "lfuse"
+        size            = 1;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
+
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
       ;
 
     memory "hfuse"
         size            = 1;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
+
+        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 4500;
         max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
       ;
 
     memory "efuse"
         size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
         write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
-      ;
+                          "x x x x  x x x x   x x x x  x x x i";
 
-    memory "lock"
-        size            = 1;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   x x x x  x x x o";
         min_write_delay = 4500;
         max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
 
     memory "calibration"
         size            = 1;
-        read            = "0 0 1 1  1 0 0 0   0 0 0 x  x x x x",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-      ;
-  ;
+        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0  0  0    o o o o  o o o o";
+    ;
+
+;
+
 
 #------------------------------------------------------------
-# ATmega32
+# ATtiny461
 #------------------------------------------------------------
+# Close to ATtiny261
 
 part
-    id               = "m32";
-    desc             = "ATMEGA32";
-    has_jtag         = yes;
-    stk500_devcode   = 0x91;
-    avr910_devcode   = 0x72;
-    signature        = 0x1e 0x95 0x02;
-    chip_erase_delay = 9000;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+    id                  = "t461";
+    desc                = "ATtiny461";
+     has_debugwire = yes;
+     flash_instr   = 0xB4, 0x00, 0x10;
+     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC,
+	             0x99, 0xE1, 0xBB, 0xAC;
+#    stk500_devcode      = 0x21;
+#    avr910_devcode      = 0x5e;
+    signature           = 0x1e 0x92 0x08;
+    pagel               = 0xb3;
+    bs2                 = 0xb2;
+    chip_erase_delay    = 4000;
+
+    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
+                          "x x x x  x x x x   x x x x  x x x x";
+
+    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
+                          "x x x x  x x x x   x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -6623,16 +6863,16 @@ part
     pollmethod		= 0;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
+        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
+        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
+        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 6;
-    togglevtg           = 0;
-    poweroffdelay       = 0;
-    resetdelayms        = 0;
+    latchcycles         = 5;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 2;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
@@ -6642,27 +6882,23 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    allowfullpagebitstream = yes;
+    ocdrev              = 1;
 
-   memory "eeprom"
-        paged           = no;   /* leave this "no" */
-        page_size       = 4;    /* for parallel programming */
-        size            = 1024;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+    memory "eeprom"
+        paged           = no;
+        size            = 256;
+        page_size       = 4;
+        num_pages       = 64;
+        min_write_delay = 4000;
+        max_write_delay = 4000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x   x  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
 
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        read            = " 1  0  1  0   0  0  0  0    x x x x  x x x x",
+                          "a7 a6 a5 a4  a3 a2 a1 a0    o o o o  o o o o";
+
+        write           = " 1  1  0  0   0  0  0  0    x x x x  x x x x",
+                          "a7 a6 a5 a4  a3 a2 a1 a0    i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
@@ -6670,120 +6906,142 @@ part
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x  a9  a8",
+			  "  0   0   x   x      x   x   x   x",
 			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x04;
+	mode		= 0x41;
 	delay		= 10;
-	blocksize	= 64;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
+    ;
 
     memory "flash"
         paged           = yes;
-        size            = 32768;
-        page_size       = 128;
-        num_pages       = 256;
+        size            = 4096;
+        page_size       = 64;
+        num_pages       = 64;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        read_lo         = "  0  0  1  0   0   0  0  0",
+                          "  x  x  x  x   x a10 a9 a8",
+                          " a7 a6 a5 a4  a3  a2 a1 a0",
+                          "  o  o  o  o   o   o  o  o";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        read_hi         = "  0  0  1  0   1   0  0  0",
+                          "  x  x  x  x   x a10 a9 a8",
+                          " a7 a6 a5 a4  a3  a2 a1 a0",
+                          "  o  o  o  o   o   o  o  o";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0 a13 a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+        loadpage_lo     = "  0  1  0  0   0  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x a4  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
 
-	mode		= 0x21;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-      ;
+        loadpage_hi     = "  0  1  0  0   1  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x a4  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
+
+        writepage       = "  0  1  0  0   1   1  0  0",
+                          "  x  x  x  x   x a10 a9 a8",
+                          " a7 a6 a5  x   x   x  x  x",
+                          "  x  x  x  x   x   x  x  x";
+
+	mode		= 0x41;
+	delay		= 6;
+	blocksize	= 64;
+	readsize	= 256;
+    ;
+
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
+    ;
+
+    memory "lock"
+        size            = 1;
+        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
+                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
+
+        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
+                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+    ;
 
     memory "lfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
       ;
 
     memory "hfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
+        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
       ;
 
-    memory "lock"
+    memory "efuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x   x x x x  x x x i";
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o o";
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   x x x x  x x x o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
       ;
 
     memory "calibration"
-        size            = 4;
-        read            = "0 0 1 1  1 0 0 0    0 0 x x  x x x x",
-                          "0 0 0 0  0 0 a1 a0  o o o o  o o o o";
-      ;
-  ;
+        size            = 1;
+        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0  0  0    o o o o  o o o o";
+    ;
+
+;
+
 
 #------------------------------------------------------------
-# ATmega161
+# ATtiny861
 #------------------------------------------------------------
+# Close to ATtiny461
 
 part
-    id               = "m161";
-    desc             = "ATMEGA161";
-    stk500_devcode   = 0x80;
-    avr910_devcode   = 0x60;
-    signature        = 0x1e 0x94 0x01;
-    chip_erase_delay = 28000;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+    id                  = "t861";
+    desc                = "ATtiny861";
+     has_debugwire = yes;
+     flash_instr   = 0xB4, 0x00, 0x10;
+     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC,
+	             0x99, 0xE1, 0xBB, 0xAC;
+#    stk500_devcode      = 0x21;
+#    avr910_devcode      = 0x5e;
+    signature           = 0x1e 0x93 0x0d;
+    pagel               = 0xb3;
+    bs2                 = 0xb2;
+    chip_erase_delay    = 4000;
+
+    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
+                          "x x x x  x x x x   x x x x  x x x x";
+
+    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
+                          "x x x x  x x x x   x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
     timeout		= 200;
     stabdelay		= 100;
     cmdexedelay		= 25;
@@ -6796,129 +7054,177 @@ part
     pollmethod		= 0;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
+        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
+        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
+        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 0;
-    togglevtg           = 0;
-    poweroffdelay       = 0;
-    resetdelayms        = 0;
+    latchcycles         = 5;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 2;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     chiperasepulsewidth = 0;
-    chiperasepolltimeout = 30;
+    chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
-    programfusepolltimeout = 2;
+    programfusepolltimeout = 5;
     programlockpulsewidth = 0;
-    programlockpolltimeout = 2;
+    programlockpolltimeout = 5;
 
-   memory "eeprom"
+    ocdrev              = 1;
+
+    memory "eeprom"
+        paged           = no;
         size            = 512;
-        min_write_delay = 3400;
-        max_write_delay = 3400;
+        num_pages       = 128;
+        page_size       = 4;
+        min_write_delay = 4000;
+        max_write_delay = 4000;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
 
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        read            = " 1  0  1  0   0  0  0  0    x x x x  x x x a8",
+                          "a7 a6 a5 a4  a3 a2 a1 a0    o o o o  o o o  o";
 
-	mode		= 0x04;
-	delay		= 5;
-	blocksize	= 128;
+        write           = " 1  1  0  0   0  0  0  0    x x x x  x x x a8",
+                          "a7 a6 a5 a4  a3 a2 a1 a0    i i i i  i i i  i";
+
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0   0  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
+
+	writepage	= "  1   1   0   0      0   0   1   0",
+			  "  0   0   x   x      x   x   x  a8",
+			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  x   x   x   x      x   x   x   x";
+
+	mode		= 0x41;
+	delay		= 10;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
+    ;
 
     memory "flash"
         paged           = yes;
-        size            = 16384;
-        page_size       = 128;
+        size            = 8192;
+        page_size       = 64;
         num_pages       = 128;
-        min_write_delay = 14000;
-        max_write_delay = 14000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_lo         = "  0  0  1  0   0   0  0  0",
+                          "  x  x  x  x a11 a10 a9 a8",
+                          " a7 a6 a5 a4  a3  a2 a1 a0",
+                          "  o  o  o  o   o   o  o  o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        read_hi         = "  0  0  1  0   1   0  0  0",
+                          "  x  x  x  x a11 a10 a9 a8",
+                          " a7 a6 a5 a4  a3  a2 a1 a0",
+                          "  o  o  o  o   o   o  o  o";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        loadpage_lo     = "  0  1  0  0   0  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x a4  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  x   x   x a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+        loadpage_hi     = "  0  1  0  0   1  0  0  0",
+                          "  x  x  x  x   x  x  x  x",
+                          "  x  x  x a4  a3 a2 a1 a0",
+                          "  i  i  i  i   i  i  i  i";
 
-	mode		= 0x21;
-	delay		= 16;
-	blocksize	= 128;
-	readsize	= 256;
-      ;
+        writepage       = "  0  1  0  0   1   1  0  0",
+                          "  x  x  x  x a11 a10 a9 a8",
+                          " a7 a6 a5  x   x   x  x  x",
+                          "  x  x  x  x   x   x  x  x";
 
-    memory "fuse"
-        size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  0 0 0 0   x x x x  x x x x",
-                          "x x x x  x x x x   x o x o  o o o o";
+	mode		= 0x41;
+	delay		= 6;
+	blocksize	= 64;
+	readsize	= 256;
+    ;
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 x  x x x x",
-                          "x x x x  x x x x   1 i 1 i  i i i i";
-      ;
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
+    ;
 
     memory "lock"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
+        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
+                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
+
+        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
+                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+    ;
+
+    memory "lfuse"
+        size            = 1;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
+
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
       ;
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+
+    memory "hfuse"
+        size            = 1;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
+
+        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
       ;
-  ;
+
+    memory "efuse"
+        size            = 1;
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x   x x x x  x x x i";
+
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   x x x x  x x x o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+      ;
+
+    memory "calibration"
+        size            = 1;
+        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
+                          "0  0  0  0   0  0  0  0    o o o o  o o o o";
+    ;
+
+;
 
 
 #------------------------------------------------------------
-# ATmega8
+# ATmega48
 #------------------------------------------------------------
 
 part
-    id               = "m8";
-    desc             = "ATMEGA8";
-    stk500_devcode   = 0x70;
-    avr910_devcode   = 0x76;
-    signature        = 0x1e 0x93 0x07;
+    id               = "m48";
+    desc             = "ATmega48";
+     has_debugwire = yes;
+     flash_instr   = 0xB6, 0x01, 0x11;
+     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+	             0x99, 0xF9, 0xBB, 0xAF;
+    stk500_devcode   = 0x59;
+#    avr910_devcode   = 0x;
+    signature        = 0x1e 0x92 0x05;
     pagel            = 0xd7;
     bs2              = 0xc2;
-    chip_erase_delay = 10000;
+    chip_erase_delay = 45000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
 
@@ -6934,7 +7240,7 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 0;
+    pollmethod		= 1;
 
     pp_controlstack     =
 	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -6946,7 +7252,7 @@ part
     latchcycles         = 5;
     togglevtg           = 1;
     poweroffdelay       = 15;
-    resetdelayms        = 2;
+    resetdelayms        = 1;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
     resetdelay          = 15;
@@ -6957,72 +7263,85 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 1;
+
     memory "eeprom"
-        size            = 512;
+        paged           = no;
         page_size       = 4;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        size            = 256;
+        min_write_delay = 3600;
+        max_write_delay = 3600;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
 	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x  a8",
+                          "  0   0   0   x      x   x   x   x",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
 	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x  a8",
+                          "  0   0   0   x      x   x   x   x",
                           " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
-	mode		= 0x04;
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0   0  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
+
+	writepage	= "  1   1   0   0      0   0   1   0",
+			  "  0   0   x   x      x   x   x   x",
+			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  x   x   x   x      x   x   x   x";
+
+	mode		= 0x41;
 	delay		= 20;
-	blocksize	= 128;
+	blocksize	= 4;
 	readsize	= 256;
       ;
     memory "flash"
         paged           = yes;
-        size            = 8192;
+        size            = 4096;
         page_size       = 64;
-        num_pages       = 128;
+        num_pages       = 64;
         min_write_delay = 4500;
         max_write_delay = 4500;
-        readback_p1     = 0xff;
+        readback_p1     = 0x00;
         readback_p2     = 0x00;
         read_lo         = "  0   0   1   0    0   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
+                          "  0   0   0   0    0 a10  a9  a8",
                           " a7  a6  a5  a4   a3  a2  a1  a0",
                           "  o   o   o   o    o   o   o   o";
 
         read_hi         = "  0   0   1   0    1   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
+                          "  0   0   0   0    0 a10  a9  a8",
                           " a7  a6  a5  a4   a3  a2  a1  a0",
                           "  o   o   o   o    o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   0      x   x   x   x",
+                          "  0   0   0   x      x   x   x   x",
                           "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   0      x   x   x   x",
+                          "  0   0   0   x      x   x   x   x",
                           "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
+                          "  0   0   0   0      0 a10  a9  a8",
                           " a7  a6  a5   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x21;
-	delay		= 10;
+	mode		= 0x41;
+	delay		= 6;
 	blocksize	= 64;
 	readsize	= 256;
       ;
 
     memory "lfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
@@ -7032,8 +7351,8 @@ part
 
     memory "hfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                           "x x x x  x x x x   o o o o  o o o o";
 
@@ -7041,10 +7360,21 @@ part
                           "x x x x  x x x x   i i i i  i i i i";
       ;
 
+    memory "efuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   x x x x  x x x o";
+
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x   x x x x  x x x i";
+      ;
+
     memory "lock"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                           "x x x x  x x x x   x x o o  o o o o";
 
@@ -7053,30 +7383,47 @@ part
       ;
 
     memory "calibration"
-        size            = 4;
-        read            = "0  0  1  1   1  0  0  0   0  0  x  x   x  x  x  x",
-                          "0  0  0  0   0  0 a1 a0   o  o  o  o   o  o  o  o";
+        size            = 1;
+        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
+                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
       ;
 
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
   ;
 
+#------------------------------------------------------------
+# ATmega48P
+#------------------------------------------------------------
 
+part parent "m48"
+    id               = "m48p";
+    desc             = "ATmega48P";
+    signature        = 0x1e 0x92 0x0a;
+
+    ocdrev              = 1;
+  ;
 
 #------------------------------------------------------------
-# ATmega8515
+# ATmega88
 #------------------------------------------------------------
 
 part
-    id               = "m8515";
-    desc             = "ATMEGA8515";
-    stk500_devcode   = 0x63;
-    avr910_devcode   = 0x3A;
-    signature        = 0x1e 0x93 0x06;
+    id               = "m88";
+    desc             = "ATmega88";
+     has_debugwire = yes;
+     flash_instr   = 0xB6, 0x01, 0x11;
+     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+	             0x99, 0xF9, 0xBB, 0xAF;
+    stk500_devcode   = 0x73;
+#    avr910_devcode   = 0x;
+    signature        = 0x1e 0x93 0x0a;
+    pagel            = 0xd7;
+    bs2              = 0xc2;
     chip_erase_delay = 9000;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
@@ -7093,21 +7440,22 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 0;
+    pollmethod		= 1;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 6;
-    togglevtg           = 0;
-    poweroffdelay       = 0;
-    resetdelayms        = 0;
+    latchcycles         = 5;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 1;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
+    resetdelay          = 15;
     chiperasepulsewidth = 0;
     chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
@@ -7115,25 +7463,39 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 1;
+
     memory "eeprom"
+        paged           = no;
+        page_size       = 4;
         size            = 512;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        min_write_delay = 3600;
+        max_write_delay = 3600;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
- read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x  a8",
+	read            = "  1   0   1   0      0   0   0   0",
+                          "  0   0   0   x      x   x   x  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
- write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
+	write           = "  1   1   0   0      0   0   0   0",
+                          "  0   0   0   x      x   x   x  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
-	mode		= 0x04;
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0   0  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
+
+	writepage	= "  1   1   0   0      0   0   1   0",
+			  "  0   0   x   x      x   x   x  a8",
+			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  x   x   x   x      x   x   x   x";
+
+	mode		= 0x41;
 	delay		= 20;
-	blocksize	= 128;
+	blocksize	= 4;
 	readsize	= 256;
       ;
     memory "flash"
@@ -7156,12 +7518,12 @@ part
                           "  o   o   o   o    o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   0      x   x   x   x",
+                          "  0   0   0   x      x   x   x   x",
                           "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   0      x   x   x   x",
+                          "  0   0   0   x      x   x   x   x",
                           "  x   x   x  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
@@ -7170,7 +7532,7 @@ part
                           " a7  a6  a5   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x21;
+	mode		= 0x41;
 	delay		= 6;
 	blocksize	= 64;
 	readsize	= 256;
@@ -7198,6 +7560,17 @@ part
                           "x x x x  x x x x   i i i i  i i i i";
       ;
 
+    memory "efuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   x x x x  x o o o";
+
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x   x x x x  x i i i";
+      ;
+
     memory "lock"
         size            = 1;
         min_write_delay = 4500;
@@ -7210,64 +7583,79 @@ part
       ;
 
     memory "calibration"
-        size            = 4;
-        read            = "0 0 1 1  1 0 0 0     0 0 x x  x x x x",
-                          "0 0 0 0  0 0 a1 a0   o o o o  o o o o";
+        size            = 1;
+        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
+                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
       ;
 
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
   ;
 
+#------------------------------------------------------------
+# ATmega88P
+#------------------------------------------------------------
 
+part parent "m88"
+    id               = "m88p";
+    desc             = "ATmega88P";
+    signature        = 0x1e 0x93 0x0f;
 
+    ocdrev              = 1;
+  ;
 
 #------------------------------------------------------------
-# ATmega8535
+# ATmega168
 #------------------------------------------------------------
 
 part
-    id               = "m8535";
-    desc             = "ATMEGA8535";
-    stk500_devcode   = 0x64;
-    avr910_devcode   = 0x69;
-    signature        = 0x1e 0x93 0x08;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
+    id              = "m168";
+    desc            = "ATmega168";
+     has_debugwire = yes;
+     flash_instr   = 0xB6, 0x01, 0x11;
+     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+	             0x99, 0xF9, 0xBB, 0xAF;
+    stk500_devcode  = 0x86;
+    # avr910_devcode = 0x;
+    signature       = 0x1e 0x94 0x06;
+    pagel           = 0xd7;
+    bs2             = 0xc2;
     chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+    pgm_enable       = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
+                       "x x x x x x x x x x x x x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                       "x x x x  x x x x    x x x x  x x x x";
+    chip_erase       = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
+                       "x x x x x x x x x x x x x x x x";
 
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 0;
+    timeout         = 200;
+    stabdelay       = 100;
+    cmdexedelay     = 25;
+    synchloops      = 32;
+    bytedelay       = 0;
+    pollindex       = 3;
+    pollvalue       = 0x53;
+    predelay        = 1;
+    postdelay       = 1;
+    pollmethod      = 1;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 6;
-    togglevtg           = 0;
-    poweroffdelay       = 0;
-    resetdelayms        = 0;
+    latchcycles         = 5;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 1;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
+    resetdelay          = 15;
     chiperasepulsewidth = 0;
     chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
@@ -7275,132 +7663,175 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 1;
+
     memory "eeprom"
+        paged           = no;
+        page_size       = 4;
         size            = 512;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        min_write_delay = 3600;
+        max_write_delay = 3600;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read            = " 1 0 1 0 0 0 0 0",
+                          " 0 0 0 x x x x a8",
+                          " a7 a6 a5 a4 a3 a2 a1 a0",
+                          " o o o o o o o o";
+    
+        write           = " 1 1 0 0 0 0 0 0",
+                          " 0 0 0 x x x x a8",
+                          " a7 a6 a5 a4 a3 a2 a1 a0",
+                          " i i i i i i i i";
 
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   x   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0   0  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
 
-	mode		= 0x04;
+	writepage	= "  1   1   0   0      0   0   1   0",
+			  "  0   0   x   x      x   x   x  a8",
+			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  x   x   x   x      x   x   x   x";
+
+	mode		= 0x41;
 	delay		= 20;
-	blocksize	= 128;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
+        ;
+
     memory "flash"
         paged           = yes;
-        size            = 8192;
-        page_size       = 64;
+        size            = 16384;
+        page_size       = 128;
         num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0    0   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        read_hi         = "  0   0   1   0    1   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   0      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   0      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+        read_lo         = " 0 0 1 0 0 0 0 0",
+                          " 0 0 0 a12 a11 a10 a9 a8",
+                          " a7 a6 a5 a4 a3 a2 a1 a0",
+                          " o o o o o o o o";
+        
+        read_hi          = " 0 0 1 0 1 0 0 0",
+                           " 0 0 0 a12 a11 a10 a9 a8",
+                           " a7 a6 a5 a4 a3 a2 a1 a0",
+                           " o o o o o o o o";
+        
+        loadpage_lo     = " 0 1 0 0 0 0 0 0",
+                          " 0 0 0 x x x x x",
+                          " x x a5 a4 a3 a2 a1 a0",
+                          " i i i i i i i i";
+        
+        loadpage_hi     = " 0 1 0 0 1 0 0 0",
+                          " 0 0 0 x x x x x",
+                          " x x a5 a4 a3 a2 a1 a0",
+                          " i i i i i i i i";
+        
+        writepage       = " 0 1 0 0 1 1 0 0",
+                          " 0 0 0 a12 a11 a10 a9 a8",
+                          " a7 a6 x x x x x x",
+                          " x x x x x x x x";
 
-	mode		= 0x21;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-      ;
+        mode        = 0x41;
+        delay       = 6;
+        blocksize   = 128;
+        readsize    = 256;
 
+        ;
+        
     memory "lfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
+                          "x x x x x x x x o o o o o o o o";
+        
+        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
+                          "x x x x x x x x i i i i i i i i";
+        ;
+    
     memory "hfuse"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
+                          "x x x x x x x x o o o o o o o o";
+        
+        write           = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
+                          "x x x x x x x x i i i i i i i i";
+        ;
+    
+    memory "efuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
+                          "x x x x x x x x x x x x x o o o";
+        
+        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
+                          "x x x x x x x x x x x x x i i i";
+        ;
+    
     memory "lock"
         size            = 1;
-        min_write_delay = 2000;
-        max_write_delay = 2000;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
-
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+                          "x x x x x x x x x x o o o o o o";
+        
+        write           = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
+                          "x x x x x x x x 1 1 i i i i i i";
+        ;
+    
     memory "calibration"
-        size            = 4;
-        read            = "0 0 1 1  1 0 0 0   0 0 x x  x x x x",
-                          "0 0 0 0  0 0 a1 a0 o o o o  o o o o";
-      ;
-
+        size            = 1;
+        read            = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
+                          "0 0 0 0 0 0 0 0 o o o o o o o o";
+        ;
+    
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
-
+        read            = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
+                          "x x x x x x a1 a0 o o o o o o o o";
+        ;
+;
 
 #------------------------------------------------------------
-# ATtiny26
+# ATmega168P
 #------------------------------------------------------------
 
-part
-    id                  = "t26";
-    desc                = "ATTINY26";
-    stk500_devcode      = 0x21;
-    avr910_devcode      = 0x5e;
-    signature           = 0x1e 0x91 0x09;
-    pagel               = 0xb3;
-    bs2                 = 0xb2;
-    chip_erase_delay    = 9000;
-    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
-                          "x x x x  x x x x   x x x x  x x x x";
+part parent "m168"
+    id              = "m168p";
+    desc            = "ATmega168P";
+    signature       = 0x1e 0x94 0x0b;
 
-    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
-                          "x x x x  x x x x   x x x x  x x x x";
+    ocdrev              = 1;
+;
+
+#------------------------------------------------------------
+# ATtiny88
+#------------------------------------------------------------
+
+part
+    id               = "t88";
+    desc             = "ATtiny88";
+     has_debugwire = yes;
+     flash_instr   = 0xB6, 0x01, 0x11;
+     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+	             0x99, 0xF9, 0xBB, 0xAF;
+    stk500_devcode   = 0x73;
+#    avr910_devcode   = 0x;
+    signature        = 0x1e 0x93 0x11;
+    pagel            = 0xd7;
+    bs2              = 0xc2;
+    chip_erase_delay = 9000;
+    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
+                       "x x x x  x x x x    x x x x  x x x x";
+
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                       "x x x x  x x x x    x x x x  x x x x";
 
     timeout		= 200;
     stabdelay		= 100;
@@ -7411,21 +7842,22 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 0;
+    pollmethod		= 1;
 
     pp_controlstack     =
-        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
-        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
-        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
-        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
+	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 5;
     togglevtg           = 1;
     poweroffdelay       = 15;
-    resetdelayms        = 2;
+    resetdelayms        = 1;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
+    resetdelay          = 15;
     chiperasepulsewidth = 0;
     chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
@@ -7433,3113 +7865,354 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 1;
+
     memory "eeprom"
-        size            = 128;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        paged           = no;
+        page_size       = 4;
+        size            = 64;
+        min_write_delay = 3600;
+        max_write_delay = 3600;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read            = "1  0  1  0   0  0  0  0    x x x x  x x x x",
-                          "x a6 a5 a4  a3 a2 a1 a0    o o o o  o o o o";
+	read            = "  1   0   1   0      0   0   0   0",
+                          "  0   0   0   x      x   x   x   x",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
 
-        write           = "1  1  0  0   0  0  0  0    x x x x  x x x x",
-                          "x a6 a5 a4  a3 a2 a1 a0    i i i i  i i i i";
+	write           = "  1   1   0   0      0   0   0   0",
+                          "  0   0   0   x      x   x   x   x",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-	mode		= 0x04;
-	delay		= 10;
-	blocksize	= 64;
-	readsize	= 256;
-    ;
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0   0  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
+
+	writepage	= "  1   1   0   0      0   0   1   0",
+			  "  0   0   x   x      x   x   x   x",
+			  "  x  a6  a5  a4     a3  a2   0   0",
+			  "  x   x   x   x      x   x   x   x";
 
+	mode		= 0x41;
+	delay		= 20;
+	blocksize	= 4;
+	readsize	= 64;
+      ;
     memory "flash"
         paged           = yes;
-        size            = 2048;
-        page_size       = 32;
-        num_pages       = 64;
+        size            = 8192;
+        page_size       = 64;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0xff;
         readback_p2     = 0xff;
-        read_lo         = "  0  0  1  0   0  0  0  0",
-                          "  x  x  x  x   x  x a9 a8",
-                          " a7 a6 a5 a4  a3 a2 a1 a0",
-                          "  o  o  o  o   o  o  o  o";
+        read_lo         = "  0   0   1   0    0   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0  0  1  0   1  0  0  0",
-                          "  x  x  x  x   x  x a9 a8",
-                          " a7 a6 a5 a4  a3 a2 a1 a0",
-                          "  o  o  o  o   o  o  o  o";
+        read_hi         = "  0   0   1   0    1   0   0   0",
+                          "  0   0   0   0  a11 a10  a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
-        loadpage_lo     = "  0  1  0  0   0  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x  x  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
+        loadpage_lo     = "  0   1   0   0      0   0   0   0",
+                          "  0   0   0   x      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-        loadpage_hi     = "  0  1  0  0   1  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x  x  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  0   0   0   x      x   x   x   x",
+                          "  x   x   x  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-        writepage       = "  0  1  0  0   1  1  0  0",
-                          "  x  x  x  x   x  x a9 a8",
-                          " a7 a6 a5 a4   x  x  x  x",
-                          "  x  x  x  x   x  x  x  x";
+        writepage       = "  0   1   0   0      1   1   0   0",
+                          "  0   0   0   0    a11 a10  a9  a8",
+                          " a7  a6  a5   x      x   x   x   x",
+                          "  x   x   x   x      x   x   x   x";
 
-	mode		= 0x21;
+	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 16;
+	blocksize	= 64;
 	readsize	= 256;
-    ;
+      ;
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
-    ;
+    memory "lfuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x   o o o o  o o o o";
 
-    memory "lock"
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
+                          "x x x x  x x x x   i i i i  i i i i";
+      ;
+
+    memory "hfuse"
         size            = 1;
-        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
-                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   o o o o  o o o o";
 
-        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
-                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-    ;
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
+                          "x x x x  x x x x   i i i i  i i i i";
+      ;
 
-    memory "lfuse"
+    memory "efuse"
         size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x   x x x x  x o o o";
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x   x x x x  x x x i";
       ;
 
-    memory "hfuse"
+    memory "lock"
         size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  x x x i  i i i i";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x   x x o o  o o o o";
 
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  x x x o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
+                          "x x x x  x x x x   1 1 i i  i i i i";
       ;
 
     memory "calibration"
-        size            = 4;
-        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
-    ;
-
-;
+        size            = 1;
+        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
+                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
+      ;
 
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+      ;
+  ;
 
 #------------------------------------------------------------
-# ATtiny261
+# ATmega328
 #------------------------------------------------------------
-# Close to ATtiny26
 
 part
-    id                  = "t261";
-    desc                = "ATTINY261";
-     has_debugwire = yes;
-     flash_instr   = 0xB4, 0x00, 0x10;
-     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC,
-	             0x99, 0xE1, 0xBB, 0xAC;
-#    stk500_devcode      = 0x21;
-#    avr910_devcode      = 0x5e;
-    signature           = 0x1e 0x91 0x0c;
-    pagel               = 0xb3;
-    bs2                 = 0xb2;
-    chip_erase_delay    = 4000;
+    id			= "m328";
+    desc		= "ATmega328";
+    has_debugwire	= yes;
+    flash_instr		= 0xB6, 0x01, 0x11;
+    eeprom_instr	= 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+			  0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+			  0x99, 0xF9, 0xBB, 0xAF;
+    stk500_devcode	= 0x86;
+    # avr910_devcode	= 0x;
+    signature		= 0x1e 0x95 0x14;
+    pagel		= 0xd7;
+    bs2			= 0xc2;
+    chip_erase_delay	= 9000;
+    pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
+		 "x x x x x x x x x x x x x x x x";
 
-    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
-                          "x x x x  x x x x   x x x x  x x x x";
+    chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
+		 "x x x x x x x x x x x x x x x x";
 
-    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
-                          "x x x x  x x x x   x x x x  x x x x";
+    timeout	= 200;
+    stabdelay	= 100;
+    cmdexedelay	= 25;
+    synchloops	= 32;
+    bytedelay	= 0;
+    pollindex	= 3;
+    pollvalue	= 0x53;
+    predelay	= 1;
+    postdelay	= 1;
+    pollmethod	= 1;
 
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 0;
-
-    pp_controlstack     =
-        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
-        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
-        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
-        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 2;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
+    pp_controlstack =
+	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+    hventerstabdelay	= 100;
+    progmodedelay	= 0;
+    latchcycles		= 5;
+    togglevtg		= 1;
+    poweroffdelay	= 15;
+    resetdelayms	= 1;
+    resetdelayus	= 0;
+    hvleavestabdelay	= 15;
+    resetdelay		= 15;
+    chiperasepulsewidth	= 0;
     chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
     programfusepolltimeout = 5;
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    memory "eeprom"
-        paged           = no;
-        size            = 128;
-        page_size       = 4;
-        num_pages       = 32;
-        min_write_delay = 4000;
-        max_write_delay = 4000;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
+    ocdrev              = 1;
 
-        read            = "1  0  1  0   0  0  0  0    x x x x  x x x x",
-                          "x a6 a5 a4  a3 a2 a1 a0    o o o o  o o o o";
+    memory "eeprom"
+	paged		= no;
+	page_size	= 4;
+	size		= 1024;
+	min_write_delay = 3600;
+	max_write_delay = 3600;
+	readback_p1	= 0xff;
+	readback_p2	= 0xff;
+	read = " 1 0 1 0 0 0 0 0",
+	       " 0 0 0 x x x a9 a8",
+	       " a7 a6 a5 a4 a3 a2 a1 a0",
+	       " o o o o o o o o";
 
-        write           = "1  1  0  0   0  0  0  0    x x x x  x x x x",
-                          "x a6 a5 a4  a3 a2 a1 a0    i i i i  i i i i";
+	write = " 1 1 0 0 0 0 0 0",
+	      	" 0 0 0 x x x a9 a8",
+		" a7 a6 a5 a4 a3 a2 a1 a0",
+		" i i i i i i i i";
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
+	loadpage_lo = " 1 1 0 0 0 0 0 1",
+		      " 0 0 0 0 0 0 0 0",
+		      " 0 0 0 0 0 0 a1 a0",
+		      " i i i i i i i i";
 
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  "  x  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
+	writepage = " 1 1 0 0 0 0 1 0",
+		    " 0 0 x x x x a9 a8",
+		    " a7 a6 a5 a4 a3 a2 0 0",
+		    " x x x x x x x x";
 
 	mode		= 0x41;
-	delay		= 10;
+	delay		= 20;
 	blocksize	= 4;
 	readsize	= 256;
     ;
 
     memory "flash"
-        paged           = yes;
-        size            = 2048;
-        page_size       = 32;
-        num_pages       = 64;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-
-        read_lo         = "  0  0  1  0   0  0  0  0",
-                          "  x  x  x  x   x  x a9 a8",
-                          " a7 a6 a5 a4  a3 a2 a1 a0",
-                          "  o  o  o  o   o  o  o  o";
-
-        read_hi         = "  0  0  1  0   1  0  0  0",
-                          "  x  x  x  x   x  x a9 a8",
-                          " a7 a6 a5 a4  a3 a2 a1 a0",
-                          "  o  o  o  o   o  o  o  o";
-
-        loadpage_lo     = "  0  1  0  0   0  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x  x  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
-
-        loadpage_hi     = "  0  1  0  0   1  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x  x  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
-
-        writepage       = "  0  1  0  0   1  1  0  0",
-                          "  x  x  x  x   x  x a9 a8",
-                          " a7 a6 a5 a4   x  x  x  x",
-                          "  x  x  x  x   x  x  x  x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 32;
-	readsize	= 256;
-    ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
-    ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
-                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
-
-        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
-                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-    ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x x x i";
-
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  x x x o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0  0  0    o o o o  o o o o";
-    ;
-
-;
-
-
-#------------------------------------------------------------
-# ATtiny461
-#------------------------------------------------------------
-# Close to ATtiny261
-
-part
-    id                  = "t461";
-    desc                = "ATTINY461";
-     has_debugwire = yes;
-     flash_instr   = 0xB4, 0x00, 0x10;
-     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC,
-	             0x99, 0xE1, 0xBB, 0xAC;
-#    stk500_devcode      = 0x21;
-#    avr910_devcode      = 0x5e;
-    signature           = 0x1e 0x92 0x08;
-    pagel               = 0xb3;
-    bs2                 = 0xb2;
-    chip_erase_delay    = 4000;
-
-    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
-                          "x x x x  x x x x   x x x x  x x x x";
-
-    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
-                          "x x x x  x x x x   x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 0;
-
-    pp_controlstack     =
-        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
-        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
-        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
-        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 2;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
+	paged		= yes;
+	size		= 32768;
+	page_size	= 128;
+	num_pages	= 256;
+	min_write_delay = 4500;
+	max_write_delay = 4500;
+	readback_p1	= 0xff;
+	readback_p2	= 0xff;
+	read_lo = " 0 0 1 0 0 0 0 0",
+		  " 0 0 a13 a12 a11 a10 a9 a8",
+		  " a7 a6 a5 a4 a3 a2 a1 a0",
+		  " o o o o o o o o";
 
-    memory "eeprom"
-        paged           = no;
-        size            = 256;
-        page_size       = 4;
-        num_pages       = 64;
-        min_write_delay = 4000;
-        max_write_delay = 4000;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-
-        read            = " 1  0  1  0   0  0  0  0    x x x x  x x x x",
-                          "a7 a6 a5 a4  a3 a2 a1 a0    o o o o  o o o o";
-
-        write           = " 1  1  0  0   0  0  0  0    x x x x  x x x x",
-                          "a7 a6 a5 a4  a3 a2 a1 a0    i i i i  i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 4;
-	readsize	= 256;
-    ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 4096;
-        page_size       = 64;
-        num_pages       = 64;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-
-        read_lo         = "  0  0  1  0   0   0  0  0",
-                          "  x  x  x  x   x a10 a9 a8",
-                          " a7 a6 a5 a4  a3  a2 a1 a0",
-                          "  o  o  o  o   o   o  o  o";
-
-        read_hi         = "  0  0  1  0   1   0  0  0",
-                          "  x  x  x  x   x a10 a9 a8",
-                          " a7 a6 a5 a4  a3  a2 a1 a0",
-                          "  o  o  o  o   o   o  o  o";
-
-        loadpage_lo     = "  0  1  0  0   0  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x a4  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
-
-        loadpage_hi     = "  0  1  0  0   1  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x a4  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
-
-        writepage       = "  0  1  0  0   1   1  0  0",
-                          "  x  x  x  x   x a10 a9 a8",
-                          " a7 a6 a5  x   x   x  x  x",
-                          "  x  x  x  x   x   x  x  x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-    ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
-    ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
-                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
-
-        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
-                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-    ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x x x i";
-
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  x x x o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0  0  0    o o o o  o o o o";
-    ;
-
-;
-
-
-#------------------------------------------------------------
-# ATtiny861
-#------------------------------------------------------------
-# Close to ATtiny461
-
-part
-    id                  = "t861";
-    desc                = "ATTINY861";
-     has_debugwire = yes;
-     flash_instr   = 0xB4, 0x00, 0x10;
-     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBC, 0x00, 0xB4, 0x00, 0xBA, 0x0D, 0xBB, 0xBC,
-	             0x99, 0xE1, 0xBB, 0xAC;
-#    stk500_devcode      = 0x21;
-#    avr910_devcode      = 0x5e;
-    signature           = 0x1e 0x93 0x0d;
-    pagel               = 0xb3;
-    bs2                 = 0xb2;
-    chip_erase_delay    = 4000;
-
-    pgm_enable          = "1 0 1 0  1 1 0 0   0 1 0 1  0 0 1 1",
-                          "x x x x  x x x x   x x x x  x x x x";
-
-    chip_erase          = "1 0 1 0  1 1 0 0   1 0 0 x  x x x x",
-                          "x x x x  x x x x   x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 0;
-
-    pp_controlstack     =
-        0xC4, 0xE4, 0xC4, 0xE4, 0xCC, 0xEC, 0xCC, 0xEC,
-        0xD4, 0xF4, 0xD4, 0xF4, 0xDC, 0xFC, 0xDC, 0xFC,
-        0xC8, 0xE8, 0xD8, 0xF8, 0x4C, 0x6C, 0x5C, 0x7C,
-        0xEC, 0xBC, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 2;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-        paged           = no;
-        size            = 512;
-        num_pages       = 128;
-        page_size       = 4;
-        min_write_delay = 4000;
-        max_write_delay = 4000;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-
-        read            = " 1  0  1  0   0  0  0  0    x x x x  x x x a8",
-                          "a7 a6 a5 a4  a3 a2 a1 a0    o o o o  o o o  o";
-
-        write           = " 1  1  0  0   0  0  0  0    x x x x  x x x a8",
-                          "a7 a6 a5 a4  a3 a2 a1 a0    i i i i  i i i  i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 4;
-	readsize	= 256;
-    ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 8192;
-        page_size       = 64;
-        num_pages       = 128;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-
-        read_lo         = "  0  0  1  0   0   0  0  0",
-                          "  x  x  x  x a11 a10 a9 a8",
-                          " a7 a6 a5 a4  a3  a2 a1 a0",
-                          "  o  o  o  o   o   o  o  o";
-
-        read_hi         = "  0  0  1  0   1   0  0  0",
-                          "  x  x  x  x a11 a10 a9 a8",
-                          " a7 a6 a5 a4  a3  a2 a1 a0",
-                          "  o  o  o  o   o   o  o  o";
-
-        loadpage_lo     = "  0  1  0  0   0  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x a4  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
-
-        loadpage_hi     = "  0  1  0  0   1  0  0  0",
-                          "  x  x  x  x   x  x  x  x",
-                          "  x  x  x a4  a3 a2 a1 a0",
-                          "  i  i  i  i   i  i  i  i";
-
-        writepage       = "  0  1  0  0   1   1  0  0",
-                          "  x  x  x  x a11 a10 a9 a8",
-                          " a7 a6 a5  x   x   x  x  x",
-                          "  x  x  x  x   x   x  x  x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-    ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0 a1 a0    o o o o  o o o o";
-    ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0  1  0  1   1  0  0  0    x x x x  x x x x",
-                          "x  x  x  x   x  x  x  x    x x x x  x x o o";
-
-        write           = "1  0  1  0   1  1  0  0    1 1 1 1  1 1 i i",
-                          "x  x  x  x   x  x  x  x    x x x x  x x x x";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-    ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x x x i";
-
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  x x x o";
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0  0  1  1   1  0  0  0    x x x x  x x x x",
-                          "0  0  0  0   0  0  0  0    o o o o  o o o o";
-    ;
-
-;
-
-
-#------------------------------------------------------------
-# ATmega48
-#------------------------------------------------------------
-
-part
-    id               = "m48";
-    desc             = "ATMEGA48";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode   = 0x59;
-#    avr910_devcode   = 0x;
-    signature        = 0x1e 0x92 0x05;
-    pagel            = 0xd7;
-    bs2              = 0xc2;
-    chip_erase_delay = 45000;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    resetdelay          = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-        paged           = no;
-        page_size       = 4;
-        size            = 256;
-        min_write_delay = 3600;
-        max_write_delay = 3600;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
-	readsize	= 256;
-      ;
-    memory "flash"
-        paged           = yes;
-        size            = 4096;
-        page_size       = 64;
-        num_pages       = 64;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0    0   0   0   0",
-                          "  0   0   0   0    0 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        read_hi         = "  0   0   1   0    1   0   0   0",
-                          "  0   0   0   0    0 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0   0   0      0 a10  a9  a8",
-                          " a7  a6  a5   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  x x x o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x x x i";
-      ;
-
-    memory "lock"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
-                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
-
-
-#------------------------------------------------------------
-# ATmega88
-#------------------------------------------------------------
-
-part
-    id               = "m88";
-    desc             = "ATMEGA88";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode   = 0x73;
-#    avr910_devcode   = 0x;
-    signature        = 0x1e 0x93 0x0a;
-    pagel            = 0xd7;
-    bs2              = 0xc2;
-    chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    resetdelay          = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-        paged           = no;
-        page_size       = 4;
-        size            = 512;
-        min_write_delay = 3600;
-        max_write_delay = 3600;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
-	readsize	= 256;
-      ;
-    memory "flash"
-        paged           = yes;
-        size            = 8192;
-        page_size       = 64;
-        num_pages       = 128;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0    0   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        read_hi         = "  0   0   1   0    1   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  x o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
-      ;
-
-    memory "lock"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
-                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
-
-#------------------------------------------------------------
-# ATmega88P
-#------------------------------------------------------------
-
-part
-    id               = "m88p";
-    desc             = "ATMEGA88P";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-                     0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-                     0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode   = 0x73;
-#    avr910_devcode   = 0x;
-    signature        = 0x1e 0x93 0x0f;
-    pagel            = 0xd7;
-    bs2              = 0xc2;
-    chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    timeout             = 200;
-    stabdelay           = 100;
-    cmdexedelay         = 25;
-    synchloops          = 32;
-    bytedelay           = 0;
-    pollindex           = 3;
-    pollvalue           = 0x53;
-    predelay            = 1;
-    postdelay           = 1;
-    pollmethod          = 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    resetdelay          = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-        paged           = no;
-        page_size       = 4;
-        size            = 512;
-        min_write_delay = 3600;
-        max_write_delay = 3600;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_lo     = "  1   1   0   0      0   0   0   1",
-                          "  0   0   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  1   1   0   0      0   0   1   0",
-                          "  0   0   x   x      x   x   x  a8",
-                          " a7  a6  a5  a4     a3  a2   0   0",
-                          "  x   x   x   x      x   x   x   x";
-
-        mode            = 0x41;
-        delay           = 20;
-        blocksize       = 4;
-        readsize        = 256;
-      ;
-    memory "flash"
-        paged           = yes;
-        size            = 8192;
-        page_size       = 64;
-        num_pages       = 128;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0    0   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        read_hi         = "  0   0   1   0    1   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-
-        mode            = 0x41;
-        delay           = 6;
-        blocksize       = 64;
-        readsize        = 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  x o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x i i i";
-      ;
-
-    memory "lock"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
-                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
-
-
-#------------------------------------------------------------
-# ATmega168
-#------------------------------------------------------------
-
-part
-    id              = "m168";
-    desc            = "ATMEGA168";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode  = 0x86;
-    # avr910_devcode = 0x;
-    signature       = 0x1e 0x94 0x06;
-    pagel           = 0xd7;
-    bs2             = 0xc2;
-    chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
-                       "x x x x x x x x x x x x x x x x";
-
-    chip_erase       = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
-                       "x x x x x x x x x x x x x x x x";
-
-    timeout         = 200;
-    stabdelay       = 100;
-    cmdexedelay     = 25;
-    synchloops      = 32;
-    bytedelay       = 0;
-    pollindex       = 3;
-    pollvalue       = 0x53;
-    predelay        = 1;
-    postdelay       = 1;
-    pollmethod      = 1;
-
-    pp_controlstack     =
-	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    resetdelay          = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-        paged           = no;
-        page_size       = 4;
-        size            = 512;
-        min_write_delay = 3600;
-        max_write_delay = 3600;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read            = " 1 0 1 0 0 0 0 0",
-                          " 0 0 0 x x x x a8",
-                          " a7 a6 a5 a4 a3 a2 a1 a0",
-                          " o o o o o o o o";
-    
-        write           = " 1 1 0 0 0 0 0 0",
-                          " 0 0 0 x x x x a8",
-                          " a7 a6 a5 a4 a3 a2 a1 a0",
-                          " i i i i i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
-	readsize	= 256;
-        ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 16384;
-        page_size       = 128;
-        num_pages       = 128;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = " 0 0 1 0 0 0 0 0",
-                          " 0 0 0 a12 a11 a10 a9 a8",
-                          " a7 a6 a5 a4 a3 a2 a1 a0",
-                          " o o o o o o o o";
-        
-        read_hi          = " 0 0 1 0 1 0 0 0",
-                           " 0 0 0 a12 a11 a10 a9 a8",
-                           " a7 a6 a5 a4 a3 a2 a1 a0",
-                           " o o o o o o o o";
-        
-        loadpage_lo     = " 0 1 0 0 0 0 0 0",
-                          " 0 0 0 x x x x x",
-                          " x x a5 a4 a3 a2 a1 a0",
-                          " i i i i i i i i";
-        
-        loadpage_hi     = " 0 1 0 0 1 0 0 0",
-                          " 0 0 0 x x x x x",
-                          " x x a5 a4 a3 a2 a1 a0",
-                          " i i i i i i i i";
-        
-        writepage       = " 0 1 0 0 1 1 0 0",
-                          " 0 0 0 a12 a11 a10 a9 a8",
-                          " a7 a6 x x x x x x",
-                          " x x x x x x x x";
-
-        mode        = 0x41;
-        delay       = 6;
-        blocksize   = 128;
-        readsize    = 256;
-
-        ;
-        
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
-                          "x x x x x x x x o o o o o o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
-                          "x x x x x x x x i i i i i i i i";
-        ;
-    
-    memory "hfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
-                          "x x x x x x x x o o o o o o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
-                          "x x x x x x x x i i i i i i i i";
-        ;
-    
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
-                          "x x x x x x x x x x x x x o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
-                          "x x x x x x x x x x x x x i i i";
-        ;
-    
-    memory "lock"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
-                          "x x x x x x x x x x o o o o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
-                          "x x x x x x x x 1 1 i i i i i i";
-        ;
-    
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
-                          "0 0 0 0 0 0 0 0 o o o o o o o o";
-        ;
-    
-    memory "signature"
-        size            = 3;
-        read            = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
-                          "x x x x x x a1 a0 o o o o o o o o";
-        ;
-;
-
-#------------------------------------------------------------
-# ATmega168P
-#------------------------------------------------------------
-
-part
-    id              = "m168p";
-    desc            = "ATMEGA168P";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode  = 0x86;
-    # avr910_devcode = 0x;
-    signature       = 0x1e 0x94 0x0b;
-    pagel           = 0xd7;
-    bs2             = 0xc2;
-    chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
-                       "x x x x x x x x x x x x x x x x";
-
-    chip_erase       = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
-                       "x x x x x x x x x x x x x x x x";
-
-    timeout         = 200;
-    stabdelay       = 100;
-    cmdexedelay     = 25;
-    synchloops      = 32;
-    bytedelay       = 0;
-    pollindex       = 3;
-    pollvalue       = 0x53;
-    predelay        = 1;
-    postdelay       = 1;
-    pollmethod      = 1;
-
-    pp_controlstack     =
-	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    resetdelay          = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-        paged           = no;
-        page_size       = 4;
-        size            = 512;
-        min_write_delay = 3600;
-        max_write_delay = 3600;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read            = " 1 0 1 0 0 0 0 0",
-                          " 0 0 0 x x x x a8",
-                          " a7 a6 a5 a4 a3 a2 a1 a0",
-                          " o o o o o o o o";
-    
-        write           = " 1 1 0 0 0 0 0 0",
-                          " 0 0 0 x x x x a8",
-                          " a7 a6 a5 a4 a3 a2 a1 a0",
-                          " i i i i i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
-	readsize	= 256;
-        ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 16384;
-        page_size       = 128;
-        num_pages       = 128;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = " 0 0 1 0 0 0 0 0",
-                          " 0 0 0 a12 a11 a10 a9 a8",
-                          " a7 a6 a5 a4 a3 a2 a1 a0",
-                          " o o o o o o o o";
-        
-        read_hi          = " 0 0 1 0 1 0 0 0",
-                           " 0 0 0 a12 a11 a10 a9 a8",
-                           " a7 a6 a5 a4 a3 a2 a1 a0",
-                           " o o o o o o o o";
-        
-        loadpage_lo     = " 0 1 0 0 0 0 0 0",
-                          " 0 0 0 x x x x x",
-                          " x x a5 a4 a3 a2 a1 a0",
-                          " i i i i i i i i";
-        
-        loadpage_hi     = " 0 1 0 0 1 0 0 0",
-                          " 0 0 0 x x x x x",
-                          " x x a5 a4 a3 a2 a1 a0",
-                          " i i i i i i i i";
-        
-        writepage       = " 0 1 0 0 1 1 0 0",
-                          " 0 0 0 a12 a11 a10 a9 a8",
-                          " a7 a6 x x x x x x",
-                          " x x x x x x x x";
-
-        mode        = 0x41;
-        delay       = 6;
-        blocksize   = 128;
-        readsize    = 256;
-
-        ;
-        
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
-                          "x x x x x x x x o o o o o o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
-                          "x x x x x x x x i i i i i i i i";
-        ;
-    
-    memory "hfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
-                          "x x x x x x x x o o o o o o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
-                          "x x x x x x x x i i i i i i i i";
-        ;
-    
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
-                          "x x x x x x x x x x x x x o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
-                          "x x x x x x x x x x x x x i i i";
-        ;
-    
-    memory "lock"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
-                          "x x x x x x x x x x o o o o o o";
-        
-        write           = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
-                          "x x x x x x x x 1 1 i i i i i i";
-        ;
-    
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
-                          "0 0 0 0 0 0 0 0 o o o o o o o o";
-        ;
-    
-    memory "signature"
-        size            = 3;
-        read            = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
-                          "x x x x x x a1 a0 o o o o o o o o";
-        ;
-;
-
-#------------------------------------------------------------
-# ATtiny88
-#------------------------------------------------------------
-
-part
-    id               = "t88";
-    desc             = "attiny88";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode   = 0x73;
-#    avr910_devcode   = 0x;
-    signature        = 0x1e 0x93 0x11;
-    pagel            = 0xd7;
-    bs2              = 0xc2;
-    chip_erase_delay = 9000;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    resetdelay          = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-        paged           = no;
-        page_size       = 4;
-        size            = 64;
-        min_write_delay = 3600;
-        max_write_delay = 3600;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-	write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  "  x  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
-	readsize	= 64;
-      ;
-    memory "flash"
-        paged           = yes;
-        size            = 8192;
-        page_size       = 64;
-        num_pages       = 128;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = "  0   0   1   0    0   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        read_hi         = "  0   0   1   0    1   0   0   0",
-                          "  0   0   0   0  a11 a10  a9  a8",
-                          " a7  a6  a5  a4   a3  a2  a1  a0",
-                          "  o   o   o   o    o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   x      x   x   x   x",
-                          "  x   x   x  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x   i i i i  i i i i";
-      ;
-
-    memory "efuse"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x   x x x x  x o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x   x x x x  x x x i";
-      ;
-
-    memory "lock"
-        size            = 1;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
-                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
-
-#------------------------------------------------------------
-# ATmega328P
-#------------------------------------------------------------
-
-part
-    id			= "m328p";
-    desc		= "ATMEGA328P";
-    has_debugwire	= yes;
-    flash_instr		= 0xB6, 0x01, 0x11;
-    eeprom_instr	= 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-			  0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-			  0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode	= 0x86;
-    # avr910_devcode	= 0x;
-    signature		= 0x1e 0x95 0x0F;
-    pagel		= 0xd7;
-    bs2			= 0xc2;
-    chip_erase_delay	= 9000;
-    pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
-		 "x x x x x x x x x x x x x x x x";
-
-    chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
-		 "x x x x x x x x x x x x x x x x";
-
-    timeout	= 200;
-    stabdelay	= 100;
-    cmdexedelay	= 25;
-    synchloops	= 32;
-    bytedelay	= 0;
-    pollindex	= 3;
-    pollvalue	= 0x53;
-    predelay	= 1;
-    postdelay	= 1;
-    pollmethod	= 1;
-
-    pp_controlstack =
-	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay	= 100;
-    progmodedelay	= 0;
-    latchcycles		= 5;
-    togglevtg		= 1;
-    poweroffdelay	= 15;
-    resetdelayms	= 1;
-    resetdelayus	= 0;
-    hvleavestabdelay	= 15;
-    resetdelay		= 15;
-    chiperasepulsewidth	= 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-	paged		= no;
-	page_size	= 4;
-	size		= 1024;
-	min_write_delay = 3600;
-	max_write_delay = 3600;
-	readback_p1	= 0xff;
-	readback_p2	= 0xff;
-	read = " 1 0 1 0 0 0 0 0",
-	       " 0 0 0 x x x a9 a8",
-	       " a7 a6 a5 a4 a3 a2 a1 a0",
-	       " o o o o o o o o";
-
-	write = " 1 1 0 0 0 0 0 0",
-	      	" 0 0 0 x x x a9 a8",
-		" a7 a6 a5 a4 a3 a2 a1 a0",
-		" i i i i i i i i";
-
-	loadpage_lo = " 1 1 0 0 0 0 0 1",
-		      " 0 0 0 0 0 0 0 0",
-		      " 0 0 0 0 0 0 a1 a0",
-		      " i i i i i i i i";
-
-	writepage = " 1 1 0 0 0 0 1 0",
-		    " 0 0 x x x x a9 a8",
-		    " a7 a6 a5 a4 a3 a2 0 0",
-		    " x x x x x x x x";
-
-	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
-	readsize	= 256;
-    ;
-
-    memory "flash"
-	paged		= yes;
-	size		= 32768;
-	page_size	= 128;
-	num_pages	= 256;
-	min_write_delay = 4500;
-	max_write_delay = 4500;
-	readback_p1	= 0xff;
-	readback_p2	= 0xff;
-	read_lo = " 0 0 1 0 0 0 0 0",
-		  " 0 0 a13 a12 a11 a10 a9 a8",
-		  " a7 a6 a5 a4 a3 a2 a1 a0",
-		  " o o o o o o o o";
-
-	read_hi = " 0 0 1 0 1 0 0 0",
-		  " 0 0 a13 a12 a11 a10 a9 a8",
-		  " a7 a6 a5 a4 a3 a2 a1 a0",
-		  " o o o o o o o o";
-
-	loadpage_lo = " 0 1 0 0 0 0 0 0",
-		      " 0 0 0 x x x x x",
-		      " x x a5 a4 a3 a2 a1 a0",
-		      " i i i i i i i i";
-
-	loadpage_hi = " 0 1 0 0 1 0 0 0",
-		      " 0 0 0 x x x x x",
-		      " x x a5 a4 a3 a2 a1 a0",
-		      " i i i i i i i i";
-
-	writepage = " 0 1 0 0 1 1 0 0",
-		    " 0 0 a13 a12 a11 a10 a9 a8",
-		    " a7 a6 x x x x x x",
-		    " x x x x x x x x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 128;
-	readsize	= 256;
-
-    ;
-
-    memory "lfuse"
-	size = 1;
-	min_write_delay = 4500;
-	max_write_delay = 4500;
-	read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
-	       "x x x x x x x x o o o o o o o o";
-
-	write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
-	      	"x x x x x x x x i i i i i i i i";
-    ;
-
-    memory "hfuse"
-	size = 1;
-	min_write_delay = 4500;
-	max_write_delay = 4500;
-	read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
-	       "x x x x x x x x o o o o o o o o";
-
-	write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
-	      	"x x x x x x x x i i i i i i i i";
-    ;
-
-    memory "efuse"
-	size = 1;
-	min_write_delay = 4500;
-	max_write_delay = 4500;
-	read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
-	       "x x x x x x x x x x x x x o o o";
-
-	write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
-	      	"x x x x x x x x x x x x x i i i";
-    ;
-
-    memory "lock"
-	size = 1;
-	min_write_delay = 4500;
-	max_write_delay = 4500;
-	read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
-	       "x x x x x x x x x x o o o o o o";
-
-	write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
-	      	"x x x x x x x x 1 1 i i i i i i";
-    ;
-
-    memory "calibration"
-	size = 1;
-	read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
-	       "0 0 0 0 0 0 0 0 o o o o o o o o";
-    ;
-
-    memory "signature"
-	size = 3;
-	read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
-	       "x x x x x x a1 a0 o o o o o o o o";
-    ;
-;
-
-#------------------------------------------------------------
-# ATmega328
-#------------------------------------------------------------
-
-part
-    id			 = "m328";
-    desc		 = "ATMEGA328";
-    has_debugwire	 = yes;
-    flash_instr		 = 0xB6, 0x01, 0x11;
-    eeprom_instr	 = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-			   0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-			   0x99, 0xF9, 0xBB, 0xAF;
-    stk500_devcode	 = 0x86;
-    # avr910_devcode	 = 0x;
-    signature		 = 0x1e 0x95 0x14;
-    pagel		 = 0xd7;
-    bs2			 = 0xc2;
-    chip_erase_delay	 = 9000;
-    pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
-		 "x x x x x x x x x x x x x x x x";
-
-    chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
-		 "x x x x x x x x x x x x x x x x";
-
-    timeout	 = 200;
-    stabdelay	 = 100;
-    cmdexedelay	 = 25;
-    synchloops	 = 32;
-    bytedelay	 = 0;
-    pollindex	 = 3;
-    pollvalue	 = 0x53;
-    predelay	 = 1;
-    postdelay	 = 1;
-    pollmethod	 = 1;
-
-    pp_controlstack =
-	 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-	 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-	 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-	 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay	 = 100;
-    progmodedelay	 = 0;
-    latchcycles		 = 5;
-    togglevtg		 = 1;
-    poweroffdelay	 = 15;
-    resetdelayms	 = 1;
-    resetdelayus	 = 0;
-    hvleavestabdelay	 = 15;
-    resetdelay		 = 15;
-    chiperasepulsewidth	 = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    memory "eeprom"
-	 paged		 = no;
-	 page_size	 = 4;
-	 size		 = 1024;
-	 min_write_delay = 3600;
-	 max_write_delay = 3600;
-	 readback_p1	 = 0xff;
-	 readback_p2	 = 0xff;
-	 read = " 1 0 1 0 0 0 0 0",
-	        " 0 0 0 x x x a9 a8",
-	        " a7 a6 a5 a4 a3 a2 a1 a0",
-	        " o o o o o o o o";
-
-	 write = " 1 1 0 0 0 0 0 0",
-	       	" 0 0 0 x x x a9 a8",
-		 " a7 a6 a5 a4 a3 a2 a1 a0",
-		 " i i i i i i i i";
-
-	 loadpage_lo = " 1 1 0 0 0 0 0 1",
-		       " 0 0 0 0 0 0 0 0",
-		       " 0 0 0 0 0 0 a1 a0",
-		       " i i i i i i i i";
-
-	 writepage = " 1 1 0 0 0 0 1 0",
-		     " 0 0 x x x x a9 a8",
-		     " a7 a6 a5 a4 a3 a2 0 0",
-		     " x x x x x x x x";
-
-	 mode		 = 0x41;
-	 delay		 = 20;
-	 blocksize	 = 4;
-	 readsize	 = 256;
-    ;
-
-    memory "flash"
-	 paged		 = yes;
-	 size		 = 32768;
-	 page_size	 = 128;
-	 num_pages	 = 256;
-	 min_write_delay = 4500;
-	 max_write_delay = 4500;
-	 readback_p1	 = 0xff;
-	 readback_p2	 = 0xff;
-	 read_lo = " 0 0 1 0 0 0 0 0",
-		   " 0 0 a13 a12 a11 a10 a9 a8",
-		   " a7 a6 a5 a4 a3 a2 a1 a0",
-		   " o o o o o o o o";
-
-	 read_hi = " 0 0 1 0 1 0 0 0",
-		   " 0 0 a13 a12 a11 a10 a9 a8",
-		   " a7 a6 a5 a4 a3 a2 a1 a0",
-		   " o o o o o o o o";
-
-	 loadpage_lo = " 0 1 0 0 0 0 0 0",
-		       " 0 0 0 x x x x x",
-		       " x x a5 a4 a3 a2 a1 a0",
-		       " i i i i i i i i";
-
-	 loadpage_hi = " 0 1 0 0 1 0 0 0",
-		       " 0 0 0 x x x x x",
-		       " x x a5 a4 a3 a2 a1 a0",
-		       " i i i i i i i i";
-
-	 writepage = " 0 1 0 0 1 1 0 0",
-		     " 0 0 a13 a12 a11 a10 a9 a8",
-		     " a7 a6 x x x x x x",
-		     " x x x x x x x x";
-
-	 mode		 = 0x41;
-	 delay		 = 6;
-	 blocksize	 = 128;
-	 readsize	 = 256;
-
-    ;
-
-    memory "lfuse"
-	 size = 1;
-	 min_write_delay = 4500;
-	 max_write_delay = 4500;
-	 read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
-	        "x x x x x x x x o o o o o o o o";
-
-	 write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
-	       	"x x x x x x x x i i i i i i i i";
-    ;
-
-    memory "hfuse"
-	 size = 1;
-	 min_write_delay = 4500;
-	 max_write_delay = 4500;
-	 read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
-	        "x x x x x x x x o o o o o o o o";
-
-	 write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
-	       	"x x x x x x x x i i i i i i i i";
-    ;
-
-    memory "efuse"
-	 size = 1;
-	 min_write_delay = 4500;
-	 max_write_delay = 4500;
-	 read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
-	        "x x x x x x x x x x x x x o o o";
-
-	 write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
-	       	"x x x x x x x x x x x x x i i i";
-    ;
-
-    memory "lock"
-	 size = 1;
-	 min_write_delay = 4500;
-	 max_write_delay = 4500;
-	 read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
-	        "x x x x x x x x x x o o o o o o";
-
-	 write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
-	       	"x x x x x x x x 1 1 i i i i i i";
-    ;
-
-    memory "calibration"
-	 size = 1;
-	 read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
-	        "0 0 0 0 0 0 0 0 o o o o o o o o";
-    ;
-
-    memory "signature"
-	 size = 3;
-	 read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
-	        "x x x x x x a1 a0 o o o o o o o o";
-    ;
-;
-
-#------------------------------------------------------------
-# ATtiny2313
-#------------------------------------------------------------
-
-part
-     id            = "t2313";
-     desc          = "ATtiny2313";
-     has_debugwire = yes;
-     flash_instr   = 0xB2, 0x0F, 0x1F;
-     eeprom_instr  = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBA, 0x0F, 0xB2, 0x0F, 0xBA, 0x0D, 0xBB, 0xBC,
-	             0x99, 0xE1, 0xBB, 0xAC;
-     stk500_devcode   = 0x23;
-##   Use the ATtiny26 devcode:
-     avr910_devcode   = 0x5e;
-     signature        = 0x1e 0x91 0x0a;
-     pagel            = 0xD4;
-     bs2              = 0xD6;
-     reset            = io;
-     chip_erase_delay = 9000;
-
-     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E,
-        0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E,
-        0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A,
-        0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-     memory "eeprom"
-         size            = 128;
-        paged           = no;
-        page_size       = 4;
-         min_write_delay = 4000;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x x",
-                           "x a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
-
-         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x x",
-                           "x a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  "  x  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 4;
-	readsize	= 256;
-       ;
-     memory "flash"
-         paged           = yes;
-         size            = 2048;
-         page_size       = 32;
-         num_pages       = 64;
-         min_write_delay = 4500;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0    0   0  a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0    0   0  a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-# The information in the data sheet of April/2004 is wrong, this works:
-         loadpage_lo     = "  0   1   0   0    0   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x   x   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-# The information in the data sheet of April/2004 is wrong, this works:
-         loadpage_hi     = "  0   1   0   0    1   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x   x   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-# The information in the data sheet of April/2004 is wrong, this works:
-         writepage       = "  0  1  0  0   1  1  0  0",
-                           "  0  0  0  0   0  0 a9 a8",
-                           " a7 a6 a5 a4   x  x  x  x",
-                           "  x  x  x  x   x  x  x  x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 32;
-	readsize	= 256;
-       ;
-#   ATtiny2313 has Signature Bytes: 0x1E 0x91 0x0A.
-     memory "signature"
-         size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-       ;
-     memory "lock"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
-                           "x x x x  x x x x  1 1 i i  i i i i";
-         read           = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  x x o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "lfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "hfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "efuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
-# The Tiny2313 has calibration data for both 4 MHz and 8 MHz.
-# The information in the data sheet of April/2004 is wrong, this works:
-
-     memory "calibration"
-         size            = 2;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
-     ;
-  ;
-
-#------------------------------------------------------------
-# ATtiny4313
-#------------------------------------------------------------
-
-part
-     id            = "t4313";
-     desc          = "ATtiny4313";
-     has_debugwire = yes;
-     flash_instr   = 0xB2, 0x0F, 0x1F;
-     eeprom_instr  = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBA, 0x0F, 0xB2, 0x0F, 0xBA, 0x0D, 0xBB, 0xBC,
-	             0x99, 0xE1, 0xBB, 0xAC;
-     stk500_devcode   = 0x23;
-##   Use the ATtiny26 devcode:
-     avr910_devcode   = 0x5e;
-     signature        = 0x1e 0x92 0x0d;
-     pagel            = 0xD4;
-     bs2              = 0xD6;
-     reset            = io;
-     chip_erase_delay = 9000;
-
-     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E,
-        0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E,
-        0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A,
-        0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-     memory "eeprom"
-         size            = 256;
-        paged           = no;
-        page_size       = 4;
-         min_write_delay = 4000;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read            = "1   0  1  0   0  0  0  0   0 0 0 x  x x x x",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
-
-         write           = "1   1  0  0   0  0  0  0   0 0 0 x  x x x x",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 4;
-	readsize	= 256;
-       ;
-     memory "flash"
-         paged           = yes;
-         size            = 4096;
-         page_size       = 64;
-         num_pages       = 64;
-         min_write_delay = 4500;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0    0 a10  a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0    0 a10  a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         loadpage_lo     = "  0   1   0   0    0   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-         loadpage_hi     = "  0   1   0   0    1   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-         writepage       = "  0  1  0  0   1   1  0  0",
-                           "  0  0  0  0   0 a10 a9 a8",
-                           " a7 a6 a5  x   x   x  x  x",
-                           "  x  x  x  x   x   x  x  x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 32;
-	readsize	= 256;
-       ;
-#   ATtiny4313 has Signature Bytes: 0x1E 0x92 0x0D.
-     memory "signature"
-         size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-       ;
-     memory "lock"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
-                           "x x x x  x x x x  1 1 i i  i i i i";
-         read           = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  x x o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "lfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "hfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "efuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
-
-     memory "calibration"
-         size            = 2;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
-     ;
-  ;
-
-#------------------------------------------------------------
-# AT90PWM2
-#------------------------------------------------------------
-
-part
-     id            = "pwm2";
-     desc          = "AT90PWM2";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-     stk500_devcode   = 0x65;
-##  avr910_devcode   = ?;
-     signature        = 0x1e 0x93 0x81;
-     pagel            = 0xD8;
-     bs2              = 0xE2;
-     reset            = io;
-     chip_erase_delay = 9000;
-
-     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-     memory "eeprom"
-         size            = 512;
-        paged           = no;
-        page_size       = 4;
-         min_write_delay = 4000;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  o o o o  o o o o";
-
-         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  i i i i  i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 4;
-	readsize	= 256;
-       ;
-     memory "flash"
-         paged           = yes;
-         size            = 8192;
-         page_size       = 64;
-         num_pages       = 128;
-         min_write_delay = 4500;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         loadpage_lo     = "  0   1   0   0    0   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-         loadpage_hi     = "  0   1   0   0    1   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-         writepage       = "  0  1  0  0   1   1   0   0",
-                           "  0  0  0  0   a11 a10 a9  a8",
-                           " a7 a6 a5  x   x   x   x   x",
-                           "  x  x  x  x   x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-       ;
-#   AT90PWM2 has Signature Bytes: 0x1E 0x93 0x81.
-     memory "signature"
-         size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  x  x   x  x  x  x",
-                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-       ;
-     memory "lock"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
-                           "x x x x  x x x x  1 1 i i  i i i i";
-
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  x x o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "lfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "hfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "efuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
-
-     memory "calibration"
-         size            = 1;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  0    o o o o  o o o o";
-     ;
-  ;
-
-#------------------------------------------------------------
-# AT90PWM3
-#------------------------------------------------------------
-
-# Completely identical to AT90PWM2 (including the signature!)
-
-part
-     id            = "pwm3";
-     desc          = "AT90PWM3";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-     stk500_devcode   = 0x65;
-##  avr910_devcode   = ?;
-     signature        = 0x1e 0x93 0x81;
-     pagel            = 0xD8;
-     bs2              = 0xE2;
-     reset            = io;
-     chip_erase_delay = 9000;
-
-     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-     memory "eeprom"
-         size            = 512;
-        paged           = no;
-        page_size       = 4;
-         min_write_delay = 4000;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  o o o o  o o o o";
-
-         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  i i i i  i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 4;
-	readsize	= 256;
-       ;
-     memory "flash"
-         paged           = yes;
-         size            = 8192;
-         page_size       = 64;
-         num_pages       = 128;
-         min_write_delay = 4500;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         loadpage_lo     = "  0   1   0   0    0   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-         loadpage_hi     = "  0   1   0   0    1   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-         writepage       = "  0  1  0  0   1   1   0   0",
-                           "  0  0  0  0   a11 a10 a9  a8",
-                           " a7 a6 a5  x   x   x   x   x",
-                           "  x  x  x  x   x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-       ;
-#   AT90PWM2 has Signature Bytes: 0x1E 0x93 0x81.
-     memory "signature"
-         size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  x  x   x  x  x  x",
-                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-       ;
-     memory "lock"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
-                           "x x x x  x x x x  1 1 i i  i i i i";
-
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  x x o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "lfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "hfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
-
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "efuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
-
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
-
-     memory "calibration"
-         size            = 1;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  0    o o o o  o o o o";
-     ;
-  ;
-
-#------------------------------------------------------------
-# AT90PWM2B
-#------------------------------------------------------------
-# Same as AT90PWM2 but different signature.
-
-part
-     id            = "pwm2b";
-     desc          = "AT90PWM2B";
-     has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-     stk500_devcode   = 0x65;
-##  avr910_devcode   = ?;
-     signature        = 0x1e 0x93 0x83;
-     pagel            = 0xD8;
-     bs2              = 0xE2;
-     reset            = io;
-     chip_erase_delay = 9000;
-
-     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-     memory "eeprom"
-         size            = 512;
-        paged           = no;
-        page_size       = 4;
-         min_write_delay = 4000;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  o o o o  o o o o";
+	read_hi = " 0 0 1 0 1 0 0 0",
+		  " 0 0 a13 a12 a11 a10 a9 a8",
+		  " a7 a6 a5 a4 a3 a2 a1 a0",
+		  " o o o o o o o o";
 
-         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  i i i i  i i i i";
+	loadpage_lo = " 0 1 0 0 0 0 0 0",
+		      " 0 0 0 x x x x x",
+		      " x x a5 a4 a3 a2 a1 a0",
+		      " i i i i i i i i";
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
+	loadpage_hi = " 0 1 0 0 1 0 0 0",
+		      " 0 0 0 x x x x x",
+		      " x x a5 a4 a3 a2 a1 a0",
+		      " i i i i i i i i";
 
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  " a7  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
+	writepage = " 0 1 0 0 1 1 0 0",
+		    " 0 0 a13 a12 a11 a10 a9 a8",
+		    " a7 a6 x x x x x x",
+		    " x x x x x x x x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 4;
+	blocksize	= 128;
 	readsize	= 256;
-       ;
-     memory "flash"
-         paged           = yes;
-         size            = 8192;
-         page_size       = 64;
-         num_pages       = 128;
-         min_write_delay = 4500;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
 
-         read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
+    ;
 
-         loadpage_lo     = "  0   1   0   0    0   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
+    memory "lfuse"
+	size = 1;
+	min_write_delay = 4500;
+	max_write_delay = 4500;
+	read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
+	       "x x x x x x x x o o o o o o o o";
 
-         loadpage_hi     = "  0   1   0   0    1   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
+	write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
+	      	"x x x x x x x x i i i i i i i i";
+    ;
 
-         writepage       = "  0  1  0  0   1   1   0   0",
-                           "  0  0  0  0   a11 a10 a9  a8",
-                           " a7 a6 a5  x   x   x   x   x",
-                           "  x  x  x  x   x   x   x   x";
+    memory "hfuse"
+	size = 1;
+	min_write_delay = 4500;
+	max_write_delay = 4500;
+	read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
+	       "x x x x x x x x o o o o o o o o";
 
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 64;
-	readsize	= 256;
-       ;
-     memory "signature"
-         size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  x  x   x  x  x  x",
-                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-       ;
-     memory "lock"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
-                           "x x x x  x x x x  1 1 i i  i i i i";
+	write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
+	      	"x x x x x x x x i i i i i i i i";
+    ;
 
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  x x o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+    memory "efuse"
+	size = 1;
+	min_write_delay = 4500;
+	max_write_delay = 4500;
+	read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
+	       "x x x x x x x x x x x x x o o o";
 
-     memory "lfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
+	write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
+	      	"x x x x x x x x x x x x x i i i";
+    ;
 
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+    memory "lock"
+	size = 1;
+	min_write_delay = 4500;
+	max_write_delay = 4500;
+	read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+	       "x x x x x x x x x x o o o o o o";
 
-     memory "hfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
+	write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
+	      	"x x x x x x x x 1 1 i i i i i i";
+    ;
 
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+    memory "calibration"
+	size = 1;
+	read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
+	       "0 0 0 0 0 0 0 0 o o o o o o o o";
+    ;
 
-     memory "efuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
+    memory "signature"
+	size = 3;
+	read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
+	       "x x x x x x a1 a0 o o o o o o o o";
+    ;
+;
 
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
+part parent "m328"
+    id			= "m328p";
+    desc		= "ATmega328P";
+    signature		= 0x1e 0x95 0x0F;
 
-     memory "calibration"
-         size            = 1;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  0    o o o o  o o o o";
-     ;
-  ;
+    ocdrev              = 1;
+;
 
 #------------------------------------------------------------
-# AT90PWM3B
+# ATtiny2313
 #------------------------------------------------------------
 
-# Completely identical to AT90PWM2B (including the signature!)
-
 part
-     id            = "pwm3b";
-     desc          = "AT90PWM3B";
+     id            = "t2313";
+     desc          = "ATtiny2313";
      has_debugwire = yes;
-     flash_instr   = 0xB6, 0x01, 0x11;
-     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
-	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
-	             0x99, 0xF9, 0xBB, 0xAF;
-     stk500_devcode   = 0x65;
-##  avr910_devcode   = ?;
-     signature        = 0x1e 0x93 0x83;
-     pagel            = 0xD8;
-     bs2              = 0xE2;
+     flash_instr   = 0xB2, 0x0F, 0x1F;
+     eeprom_instr  = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBA, 0x0F, 0xB2, 0x0F, 0xBA, 0x0D, 0xBB, 0xBC,
+	             0x99, 0xE1, 0xBB, 0xAC;
+     stk500_devcode   = 0x23;
+##   Use the ATtiny26 devcode:
+     avr910_devcode   = 0x5e;
+     signature        = 0x1e 0x91 0x0a;
+     pagel            = 0xD4;
+     bs2              = 0xD6;
      reset            = io;
      chip_erase_delay = 9000;
 
@@ -10561,10 +8234,10 @@ part
     pollmethod		= 1;
 
     pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+        0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E,
+        0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E,
+        0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A,
+        0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 5;
@@ -10580,19 +8253,21 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 0;
+
      memory "eeprom"
-         size            = 512;
+         size            = 128;
         paged           = no;
         page_size       = 4;
          min_write_delay = 4000;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  o o o o  o o o o";
+         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x x",
+                           "x a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0  i i i i  i i i i";
+         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x x",
+                           "x a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
@@ -10601,7 +8276,7 @@ part
 
 	writepage	= "  1   1   0   0      0   0   1   0",
 			  "  0   0   x   x      x   x   x   x",
-			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  x  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
@@ -10611,55 +8286,58 @@ part
        ;
      memory "flash"
          paged           = yes;
-         size            = 8192;
-         page_size       = 64;
-         num_pages       = 128;
+         size            = 2048;
+         page_size       = 32;
+         num_pages       = 64;
          min_write_delay = 4500;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
          read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
+                           "  0   0   0   0    0   0  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0   a11 a10 a9  a8",
+                           "  0   0   0   0    0   0  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
+# The information in the data sheet of April/2004 is wrong, this works:
          loadpage_lo     = "  0   1   0   0    0   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  x   x   x   x   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
+# The information in the data sheet of April/2004 is wrong, this works:
          loadpage_hi     = "  0   1   0   0    1   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  x   x   x   x   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
-         writepage       = "  0  1  0  0   1   1   0   0",
-                           "  0  0  0  0   a11 a10 a9  a8",
-                           " a7 a6 a5  x   x   x   x   x",
-                           "  x  x  x  x   x   x   x   x";
+# The information in the data sheet of April/2004 is wrong, this works:
+         writepage       = "  0  1  0  0   1  1  0  0",
+                           "  0  0  0  0   0  0 a9 a8",
+                           " a7 a6 a5 a4   x  x  x  x",
+                           "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 64;
+	blocksize	= 32;
 	readsize	= 256;
        ;
+#   ATtiny2313 has Signature Bytes: 0x1E 0x91 0x0A.
      memory "signature"
          size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  x  x   x  x  x  x",
+         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                            "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
        ;
      memory "lock"
          size            = 1;
          write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
                            "x x x x  x x x x  1 1 i i  i i i i";
-
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  x x o o  o o o o";
+         read           = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  x x o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
        ;
@@ -10696,34 +8374,36 @@ part
         min_write_delay = 9000;
         max_write_delay = 9000;
      ;
+# The Tiny2313 has calibration data for both 4 MHz and 8 MHz.
+# The information in the data sheet of April/2004 is wrong, this works:
 
      memory "calibration"
-         size            = 1;
+         size            = 2;
          read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  0    o o o o  o o o o";
+                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
      ;
   ;
 
 #------------------------------------------------------------
-# ATtiny25
+# ATtiny4313
 #------------------------------------------------------------
 
 part
-     id            = "t25";
-     desc          = "ATtiny25";
-     has_debugwire = yes;
-     flash_instr   = 0xB4, 0x02, 0x12;
-     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBC, 0x02, 0xB4, 0x02, 0xBA, 0x0D, 0xBB, 0xBC,
+     id            = "t4313";
+     desc          = "ATtiny4313";
+     has_debugwire = yes;
+     flash_instr   = 0xB2, 0x0F, 0x1F;
+     eeprom_instr  = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBA, 0x0F, 0xB2, 0x0F, 0xBA, 0x0D, 0xBB, 0xBC,
 	             0x99, 0xE1, 0xBB, 0xAC;
-## no STK500 devcode in XML file, use the ATtiny45 one
-     stk500_devcode   = 0x14;
-##  avr910_devcode   = ?;
-##  Try the AT90S2313 devcode:
-     avr910_devcode   = 0x20;
-     signature        = 0x1e 0x91 0x08;
+     stk500_devcode   = 0x23;
+##   Use the ATtiny26 devcode:
+     avr910_devcode   = 0x5e;
+     signature        = 0x1e 0x92 0x0d;
+     pagel            = 0xD4;
+     bs2              = 0xD6;
      reset            = io;
-     chip_erase_delay = 4500;
+     chip_erase_delay = 9000;
 
      pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                         "x x x x  x x x x    x x x x  x x x x";
@@ -10742,39 +8422,41 @@ part
     postdelay		= 1;
     pollmethod		= 1;
 
-    hvsp_controlstack   =
-        0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
-        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
-        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
-        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00;
+    pp_controlstack     =
+        0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E,
+        0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E,
+        0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A,
+        0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
-    hvspcmdexedelay     = 0;
-    synchcycles         = 6;
-    latchcycles         = 1;
+    progmodedelay       = 0;
+    latchcycles         = 5;
     togglevtg           = 1;
-    poweroffdelay       = 25;
+    poweroffdelay       = 15;
     resetdelayms        = 1;
     resetdelayus        = 0;
-    hvleavestabdelay    = 100;
-    resetdelay          = 25;
-    chiperasepolltimeout = 40;
-    chiperasetime       = 0;
-    programfusepolltimeout = 25;
-    programlockpolltimeout = 25;
+    hvleavestabdelay    = 15;
+    chiperasepulsewidth = 0;
+    chiperasepolltimeout = 10;
+    programfusepulsewidth = 0;
+    programfusepolltimeout = 5;
+    programlockpulsewidth = 0;
+    programlockpolltimeout = 5;
+
+    ocdrev              = 0;
 
      memory "eeprom"
-         size            = 128;
+         size            = 256;
         paged           = no;
         page_size       = 4;
          min_write_delay = 4000;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x x",
-                           "x a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
+         read            = "1   0  1  0   0  0  0  0   0 0 0 x  x x x x",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x x",
-                           "x a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
+         write           = "1   1  0  0   0  0  0  0   0 0 0 x  x x x x",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
@@ -10783,7 +8465,7 @@ part
 
 	writepage	= "  1   1   0   0      0   0   1   0",
 			  "  0   0   x   x      x   x   x   x",
-			  "  x  a6  a5  a4     a3  a2   0   0",
+			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
@@ -10793,44 +8475,44 @@ part
        ;
      memory "flash"
          paged           = yes;
-         size            = 2048;
-         page_size       = 32;
+         size            = 4096;
+         page_size       = 64;
          num_pages       = 64;
          min_write_delay = 4500;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
          read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0    0   0  a9  a8",
+                           "  0   0   0   0    0 a10  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0    0   0  a9  a8",
+                           "  0   0   0   0    0 a10  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          loadpage_lo     = "  0   1   0   0    0   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x   x   a3  a2  a1  a0",
+                           "  x   x   x  a4   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
          loadpage_hi     = "  0   1   0   0    1   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x   x   a3  a2  a1  a0",
+                           "  x   x   x  a4   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
-         writepage       = "  0  1  0  0   1  1  0  0",
-                           "  0  0  0  0   0  0 a9 a8",
-                           " a7 a6 a5 a4   x  x  x  x",
-                           "  x  x  x  x   x  x  x  x";
+         writepage       = "  0  1  0  0   1   1  0  0",
+                           "  0  0  0  0   0 a10 a9 a8",
+                           " a7 a6 a5  x   x   x  x  x",
+                           "  x  x  x  x   x   x  x  x";
 
 	mode		= 0x41;
 	delay		= 6;
 	blocksize	= 32;
 	readsize	= 256;
        ;
-#   ATtiny25 has Signature Bytes: 0x1E 0x91 0x08.
+#   ATtiny4313 has Signature Bytes: 0x1E 0x92 0x0D.
      memory "signature"
          size            = 3;
          read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
@@ -10840,6 +8522,8 @@ part
          size            = 1;
          write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
                            "x x x x  x x x x  1 1 i i  i i i i";
+         read           = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  x x o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
        ;
@@ -10885,24 +8569,24 @@ part
   ;
 
 #------------------------------------------------------------
-# ATtiny45
+# AT90PWM2
 #------------------------------------------------------------
 
 part
-     id            = "t45";
-     desc          = "ATtiny45";
+     id            = "pwm2";
+     desc          = "AT90PWM2";
      has_debugwire = yes;
-     flash_instr   = 0xB4, 0x02, 0x12;
-     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBC, 0x02, 0xB4, 0x02, 0xBA, 0x0D, 0xBB, 0xBC,
-	             0x99, 0xE1, 0xBB, 0xAC;
-     stk500_devcode   = 0x14;
+     flash_instr   = 0xB6, 0x01, 0x11;
+     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+	             0x99, 0xF9, 0xBB, 0xAF;
+     stk500_devcode   = 0x65;
 ##  avr910_devcode   = ?;
-##  Try the AT90S2313 devcode:
-     avr910_devcode   = 0x20;
-     signature        = 0x1e 0x92 0x06;
+     signature        = 0x1e 0x93 0x81;
+     pagel            = 0xD8;
+     bs2              = 0xE2;
      reset            = io;
-     chip_erase_delay = 4500;
+     chip_erase_delay = 9000;
 
      pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                         "x x x x  x x x x    x x x x  x x x x";
@@ -10921,39 +8605,39 @@ part
     postdelay		= 1;
     pollmethod		= 1;
 
-    hvsp_controlstack     =
-	0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
-        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
-        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
-        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00;
+    pp_controlstack     =
+        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    hvspcmdexedelay     = 0;
-    synchcycles         = 6;
-    latchcycles         = 1;
+    latchcycles         = 5;
     togglevtg           = 1;
-    poweroffdelay       = 25;
+    poweroffdelay       = 15;
     resetdelayms        = 1;
     resetdelayus        = 0;
-    hvleavestabdelay    = 100;
-    resetdelay          = 25;
-    chiperasepolltimeout = 40;
-    chiperasetime       = 0;
-    programfusepolltimeout = 25;
-    programlockpolltimeout = 25;
+    hvleavestabdelay    = 15;
+    chiperasepulsewidth = 0;
+    chiperasepolltimeout = 10;
+    programfusepulsewidth = 0;
+    programfusepolltimeout = 5;
+    programlockpulsewidth = 0;
+    programlockpolltimeout = 5;
 
      memory "eeprom"
-         size            = 256;
-         page_size       = 4;
+         size            = 512;
+        paged           = no;
+        page_size       = 4;
          min_write_delay = 4000;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x x",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
+         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x a8",
+                           "a7 a6 a5 a4  a3 a2 a1 a0  o o o o  o o o o";
 
-         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x x",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
+         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x a8",
+                           "a7 a6 a5 a4  a3 a2 a1 a0  i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
@@ -10972,20 +8656,20 @@ part
        ;
      memory "flash"
          paged           = yes;
-         size            = 4096;
+         size            = 8192;
          page_size       = 64;
-         num_pages       = 64;
+         num_pages       = 128;
          min_write_delay = 4500;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
          read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0    0  a10 a9  a8",
+                           "  0   0   0   0   a11 a10 a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0    0  a10 a9  a8",
+                           "  0   0   0   0   a11 a10 a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
@@ -10999,26 +8683,29 @@ part
                            "  x   x   x  a4   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
-         writepage       = "  0  1  0  0   1  1  0  0",
-                           "  0  0  0  0   0 a10 a9 a8",
-                           " a7 a6 a5  x   x  x  x  x",
-                           "  x  x  x  x   x  x  x  x";
+         writepage       = "  0  1  0  0   1   1   0   0",
+                           "  0  0  0  0   a11 a10 a9  a8",
+                           " a7 a6 a5  x   x   x   x   x",
+                           "  x  x  x  x   x   x   x   x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 32;
+	blocksize	= 64;
 	readsize	= 256;
        ;
-#   ATtiny45 has Signature Bytes: 0x1E 0x92 0x08. (Data sheet 2586C-AVR-06/05 (doc2586.pdf) indicates otherwise!)
+#   AT90PWM2 has Signature Bytes: 0x1E 0x93 0x81.
      memory "signature"
          size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+         read            = "0  0  1  1   0  0  0  0   0  0  x  x   x  x  x  x",
                            "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
        ;
      memory "lock"
          size            = 1;
          write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
                            "x x x x  x x x x  1 1 i i  i i i i";
+
+         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
+                           "x x x x  x x x x  x x o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
        ;
@@ -11048,28 +8735,119 @@ part
      memory "efuse"
          size            = 1;
          write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
+                           "x x x x  x x x x  i i i i  i i i i";
+
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
+     ;
+
+     memory "calibration"
+         size            = 1;
+         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
+                           "0  0  0  0   0  0  0  0    o o o o  o o o o";
+     ;
+  ;
+
+#------------------------------------------------------------
+# AT90PWM3
+#------------------------------------------------------------
+
+# Completely identical to AT90PWM2 (including the signature!)
+
+part parent "pwm2"
+     id            = "pwm3";
+     desc          = "AT90PWM3";
+  ;
+
+#------------------------------------------------------------
+# AT90PWM2B
+#------------------------------------------------------------
+# Same as AT90PWM2 but different signature.
+
+part parent "pwm2"
+     id            = "pwm2b";
+     desc          = "AT90PWM2B";
+     signature     = 0x1e 0x93 0x83;
+
+    ocdrev              = 1;
+  ;
+
+#------------------------------------------------------------
+# AT90PWM3B
+#------------------------------------------------------------
+
+# Completely identical to AT90PWM2B (including the signature!)
+
+part parent "pwm2b"
+     id            = "pwm3b";
+     desc          = "AT90PWM3B";
+
+    ocdrev              = 1;
+  ;
+
+#------------------------------------------------------------
+# AT90PWM316
+#------------------------------------------------------------
+
+# Similar to AT90PWM3B, but with 16 kiB flash, 512 B EEPROM, and 1024 B SRAM.
+
+part parent "pwm3b"
+     id            = "pwm316";
+     desc          = "AT90PWM316";
+     signature     = 0x1e 0x94 0x83;
+
+    ocdrev              = 1;
+
+    memory "flash"
+        paged           = yes;
+        size            = 16384;
+        page_size       = 128;
+        num_pages       = 128;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        readback_p1     = 0xff;
+        readback_p2     = 0xff;
+        read_lo         = "  0   0   1   0      0   0   0   0",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
+
+        read_hi         = "  0   0   1   0      1   0   0   0",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
+
+        loadpage_lo     = "  0   1   0   0      0   0   0   0",
+                          "  0   0   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
+
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  0   0   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
+        writepage       = "  0   1   0   0      1   1   0   0",
+                          "  0   0 a13 a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
+                          "  x   x   x   x      x   x   x   x";
 
-     memory "calibration"
-         size            = 2;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
-     ;
+	mode		= 0x21;
+	delay		= 6;
+	blocksize	= 128;
+	readsize	= 256;
+      ;
   ;
 
 #------------------------------------------------------------
-# ATtiny85
+# ATtiny25
 #------------------------------------------------------------
 
 part
-     id            = "t85";
-     desc          = "ATtiny85";
+     id            = "t25";
+     desc          = "ATtiny25";
      has_debugwire = yes;
      flash_instr   = 0xB4, 0x02, 0x12;
      eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
@@ -11080,7 +8858,7 @@ part
 ##  avr910_devcode   = ?;
 ##  Try the AT90S2313 devcode:
      avr910_devcode   = 0x20;
-     signature        = 0x1e 0x93 0x0b;
+     signature        = 0x1e 0x91 0x08;
      reset            = io;
      chip_erase_delay = 4500;
 
@@ -11121,19 +8899,21 @@ part
     programfusepolltimeout = 25;
     programlockpolltimeout = 25;
 
+    ocdrev              = 1;
+
      memory "eeprom"
-         size            = 512;
+         size            = 128;
         paged           = no;
         page_size       = 4;
          min_write_delay = 4000;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
+         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x x",
+                           "x a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
+         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x x",
+                           "x a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
@@ -11141,8 +8921,8 @@ part
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x  a8",
-			  " a7  a6  a5  a4     a3  a2   0   0",
+			  "  0   0   x   x      x   x   x   x",
+			  "  x  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
@@ -11152,36 +8932,36 @@ part
        ;
      memory "flash"
          paged           = yes;
-         size            = 8192;
-         page_size       = 64;
-         num_pages       = 128;
+         size            = 2048;
+         page_size       = 32;
+         num_pages       = 64;
          min_write_delay = 4500;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
          read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0  a11 a10  a9  a8",
+                           "  0   0   0   0    0   0  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0  a11 a10  a9  a8",
+                           "  0   0   0   0    0   0  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          loadpage_lo     = "  0   1   0   0    0   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  x   x   x   x   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
          loadpage_hi     = "  0   1   0   0    1   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  x   x   x   x   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
-         writepage       = "  0  1  0  0   1   1   0  0",
-                           "  0  0  0  0  a11 a10 a9 a8",
-                           " a7 a6 a5  x   x  x  x  x",
+         writepage       = "  0  1  0  0   1  1  0  0",
+                           "  0  0  0  0   0  0 a9 a8",
+                           " a7 a6 a5 a4   x  x  x  x",
                            "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
@@ -11189,7 +8969,7 @@ part
 	blocksize	= 32;
 	readsize	= 256;
        ;
-#   ATtiny85 has Signature Bytes: 0x1E 0x93 0x08.
+#   ATtiny25 has Signature Bytes: 0x1E 0x91 0x08.
      memory "signature"
          size            = 3;
          read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
@@ -11244,214 +9024,30 @@ part
   ;
 
 #------------------------------------------------------------
-# ATmega640
-#------------------------------------------------------------
-# Almost same as ATmega1280, except for different memory sizes
-
-part
-    id               = "m640";
-    desc             = "ATMEGA640";
-    signature        = 0x1e 0x96 0x08;
-    has_jtag         = yes;
-#    stk500_devcode   = 0xB2;
-#    avr910_devcode   = 0x43;
-    chip_erase_delay = 9000;
-    pagel            = 0xD7;
-    bs2              = 0xA0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    rampz               = 0x3b;
-    allowfullpagebitstream = no;
-
-    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 4096;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x    a11 a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
-	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 256;
-	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  x i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
-                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
-
-#------------------------------------------------------------
-# ATmega1280
+# ATtiny45
 #------------------------------------------------------------
 
 part
-    id               = "m1280";
-    desc             = "ATMEGA1280";
-    signature        = 0x1e 0x97 0x03;
-    has_jtag         = yes;
-#    stk500_devcode   = 0xB2;
-#    avr910_devcode   = 0x43;
-    chip_erase_delay = 9000;
-    pagel            = 0xD7;
-    bs2              = 0xA0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+     id            = "t45";
+     desc          = "ATtiny45";
+     has_debugwire = yes;
+     flash_instr   = 0xB4, 0x02, 0x12;
+     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBC, 0x02, 0xB4, 0x02, 0xBA, 0x0D, 0xBB, 0xBC,
+	             0x99, 0xE1, 0xBB, 0xAC;
+     stk500_devcode   = 0x14;
+##  avr910_devcode   = ?;
+##  Try the AT90S2313 devcode:
+     avr910_devcode   = 0x20;
+     signature        = 0x1e 0x92 0x06;
+     reset            = io;
+     chip_erase_delay = 4500;
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
+     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
+                        "x x x x  x x x x    x x x x  x x x x";
+
+     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                        "x x x x  x x x x    x x x x  x x x x";
 
     timeout		= 200;
     stabdelay		= 100;
@@ -11464,183 +9060,176 @@ part
     postdelay		= 1;
     pollmethod		= 1;
 
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+    hvsp_controlstack     =
+	0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
+        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
+        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
+        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
-    latchcycles         = 5;
+    hvspcmdexedelay     = 0;
+    synchcycles         = 6;
+    latchcycles         = 1;
     togglevtg           = 1;
-    poweroffdelay       = 15;
+    poweroffdelay       = 25;
     resetdelayms        = 1;
     resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
+    hvleavestabdelay    = 100;
+    resetdelay          = 25;
+    chiperasepolltimeout = 40;
+    chiperasetime       = 0;
+    programfusepolltimeout = 25;
+    programlockpolltimeout = 25;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    rampz               = 0x3b;
-    allowfullpagebitstream = no;
+    ocdrev              = 1;
 
-    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 4096;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+     memory "eeprom"
+         size            = 256;
+         page_size       = 4;
+         min_write_delay = 4000;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x x",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
+         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x x",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
+			  "  0   0   0   0      0   0  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x    a11 a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  0   0   x   x      x   x   x   x",
+			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
+	delay		= 6;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 131072;
-        page_size       = 256;
-        num_pages       = 512;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+       ;
+     memory "flash"
+         paged           = yes;
+         size            = 4096;
+         page_size       = 64;
+         num_pages       = 64;
+         min_write_delay = 4500;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read_lo         = "  0   0   1   0    0   0   0   0",
+                           "  0   0   0   0    0  a10 a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+         read_hi         = "  0   0   1   0    1   0   0   0",
+                           "  0   0   0   0    0  a10 a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_lo     = "  0   1   0   0    0   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_hi     = "  0   1   0   0    1   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+         writepage       = "  0  1  0  0   1  1  0  0",
+                           "  0  0  0  0   0 a10 a9 a8",
+                           " a7 a6 a5  x   x  x  x  x",
+                           "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 256;
+	delay		= 6;
+	blocksize	= 32;
 	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+       ;
+#   ATtiny45 has Signature Bytes: 0x1E 0x92 0x08. (Data sheet 2586C-AVR-06/05 (doc2586.pdf) indicates otherwise!)
+     memory "signature"
+         size            = 3;
+         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+       ;
+     memory "lock"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
+                           "x x x x  x x x x  1 1 i i  i i i i";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+     memory "lfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  x i i i";
+     memory "hfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
+     memory "efuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                           "x x x x  x x x x  x x x x  x x x i";
 
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
-                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
-      ;
+     ;
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
+     memory "calibration"
+         size            = 2;
+         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
+                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
+     ;
   ;
 
 #------------------------------------------------------------
-# ATmega1281
+# ATtiny85
 #------------------------------------------------------------
-# Identical to ATmega1280
 
-part
-    id               = "m1281";
-    desc             = "ATMEGA1281";
-    signature        = 0x1e 0x97 0x04;
-    has_jtag         = yes;
-#    stk500_devcode   = 0xB2;
-#    avr910_devcode   = 0x43;
-    chip_erase_delay = 9000;
-    pagel            = 0xD7;
-    bs2              = 0xA0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+part
+     id            = "t85";
+     desc          = "ATtiny85";
+     has_debugwire = yes;
+     flash_instr   = 0xB4, 0x02, 0x12;
+     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBC, 0x02, 0xB4, 0x02, 0xBA, 0x0D, 0xBB, 0xBC,
+	             0x99, 0xE1, 0xBB, 0xAC;
+## no STK500 devcode in XML file, use the ATtiny45 one
+     stk500_devcode   = 0x14;
+##  avr910_devcode   = ?;
+##  Try the AT90S2313 devcode:
+     avr910_devcode   = 0x20;
+     signature        = 0x1e 0x93 0x0b;
+     reset            = io;
+     chip_erase_delay = 4500;
+
+     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
+                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
+     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                        "x x x x  x x x x    x x x x  x x x x";
 
     timeout		= 200;
     stabdelay		= 100;
@@ -11653,170 +9242,159 @@ part
     postdelay		= 1;
     pollmethod		= 1;
 
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+    hvsp_controlstack   =
+        0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
+        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
+        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
+        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x00;
     hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
+    hvspcmdexedelay     = 0;
+    synchcycles         = 6;
+    latchcycles         = 1;
     togglevtg           = 1;
-    poweroffdelay       = 15;
+    poweroffdelay       = 25;
     resetdelayms        = 1;
     resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
+    hvleavestabdelay    = 100;
+    resetdelay          = 25;
+    chiperasepolltimeout = 40;
+    chiperasetime       = 0;
+    programfusepolltimeout = 25;
+    programlockpolltimeout = 25;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    rampz               = 0x3b;
-    allowfullpagebitstream = no;
+    ocdrev              = 1;
 
-    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 4096;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+     memory "eeprom"
+         size            = 512;
+        paged           = no;
+        page_size       = 4;
+         min_write_delay = 4000;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x a8",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
+         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x a8",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
+			  "  0   0   0   0      0   0  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x    a11 a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  0   0   x   x      x   x   x  a8",
+			  " a7  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
+	delay		= 6;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 131072;
-        page_size       = 256;
-        num_pages       = 512;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+       ;
+     memory "flash"
+         paged           = yes;
+         size            = 8192;
+         page_size       = 64;
+         num_pages       = 128;
+         min_write_delay = 4500;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read_lo         = "  0   0   1   0    0   0   0   0",
+                           "  0   0   0   0  a11 a10  a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+         read_hi         = "  0   0   1   0    1   0   0   0",
+                           "  0   0   0   0  a11 a10  a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_lo     = "  0   1   0   0    0   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_hi     = "  0   1   0   0    1   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+         writepage       = "  0  1  0  0   1   1   0  0",
+                           "  0  0  0  0  a11 a10 a9 a8",
+                           " a7 a6 a5  x   x  x  x  x",
+                           "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 256;
+	delay		= 6;
+	blocksize	= 32;
 	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+       ;
+#   ATtiny85 has Signature Bytes: 0x1E 0x93 0x08.
+     memory "signature"
+         size            = 3;
+         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+       ;
+     memory "lock"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
+                           "x x x x  x x x x  1 1 i i  i i i i";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+     memory "lfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  x i i i";
+     memory "hfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
+     memory "efuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                           "x x x x  x x x x  x x x x  x x x i";
 
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
-                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
-      ;
+     ;
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
+     memory "calibration"
+         size            = 2;
+         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
+                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
+     ;
   ;
 
 #------------------------------------------------------------
-# ATmega2560
+# ATmega640
 #------------------------------------------------------------
+# Almost same as ATmega1280, except for different memory sizes
 
 part
-    id               = "m2560";
-    desc             = "ATMEGA2560";
-    signature        = 0x1e 0x98 0x01;
+    id               = "m640";
+    desc             = "ATmega640";
+    signature        = 0x1e 0x96 0x08;
     has_jtag         = yes;
 #    stk500_devcode   = 0xB2;
 #    avr910_devcode   = 0x43;
@@ -11845,7 +9423,7 @@ part
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
         0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 5;
@@ -11866,6 +9444,8 @@ part
     rampz               = 0x3b;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -11902,20 +9482,20 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 262144;
+        size            = 65536;
         page_size       = 256;
-        num_pages       = 1024;
+        num_pages       = 256;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
@@ -11930,15 +9510,10 @@ part
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-        load_ext_addr   = "  0   1   0   0      1   1   0   1",
-                          "  0   0   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0   0 a16",
-                          "  0   0   0   0      0   0   0   0";
-
 	mode		= 0x41;
 	delay		= 10;
 	blocksize	= 256;
@@ -12003,13 +9578,13 @@ part
   ;
 
 #------------------------------------------------------------
-# ATmega2561
+# ATmega1280
 #------------------------------------------------------------
 
 part
-    id               = "m2561";
-    desc             = "ATMEGA2561";
-    signature        = 0x1e 0x98 0x02;
+    id               = "m1280";
+    desc             = "ATmega1280";
+    signature        = 0x1e 0x97 0x03;
     has_jtag         = yes;
 #    stk500_devcode   = 0xB2;
 #    avr910_devcode   = 0x43;
@@ -12038,7 +9613,7 @@ part
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
         0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
+        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
     latchcycles         = 5;
@@ -12059,6 +9634,8 @@ part
     rampz               = 0x3b;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -12095,9 +9672,9 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 262144;
+        size            = 131072;
         page_size       = 256;
-        num_pages       = 1024;
+        num_pages       = 512;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
@@ -12127,11 +9704,6 @@ part
                           " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-        load_ext_addr   = "  0   1   0   0      1   1   0   1",
-                          "  0   0   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0   0 a16",
-                          "  0   0   0   0      0   0   0   0";
-
 	mode		= 0x41;
 	delay		= 10;
 	blocksize	= 256;
@@ -12196,20 +9768,32 @@ part
   ;
 
 #------------------------------------------------------------
-# ATmega128RFA1
+# ATmega1281
+#------------------------------------------------------------
+# Identical to ATmega1280
+
+part parent "m1280"
+    id               = "m1281";
+    desc             = "ATmega1281";
+    signature        = 0x1e 0x97 0x04;
+
+    ocdrev              = 3;
+  ;
+
+#------------------------------------------------------------
+# ATmega2560
 #------------------------------------------------------------
-# Identical to ATmega2561 but half the ROM
 
 part
-    id               = "m128rfa1";
-    desc             = "ATMEGA128RFA1";
-    signature        = 0x1e 0xa7 0x01;
+    id               = "m2560";
+    desc             = "ATmega2560";
+    signature        = 0x1e 0x98 0x01;
     has_jtag         = yes;
 #    stk500_devcode   = 0xB2;
 #    avr910_devcode   = 0x43;
-    chip_erase_delay = 55000;
+    chip_erase_delay = 9000;
     pagel            = 0xD7;
-    bs2              = 0xE2;
+    bs2              = 0xA0;
     reset            = dedicated;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
@@ -12253,12 +9837,14 @@ part
     rampz               = 0x3b;
     allowfullpagebitstream = no;
 
+    ocdrev              = 4;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
         size            = 4096;
-        min_write_delay = 50000;
-        max_write_delay = 50000;
+        min_write_delay = 9000;
+        max_write_delay = 9000;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read            = "  1   0   1   0      0   0   0   0",
@@ -12289,11 +9875,11 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 131072;
+        size            = 262144;
         page_size       = 256;
-        num_pages       = 512;
-        min_write_delay = 50000;
-        max_write_delay = 50000;
+        num_pages       = 1024;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read_lo         = "  0   0   1   0      0   0   0   0",
@@ -12321,8 +9907,13 @@ part
                           " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
+        load_ext_addr   = "  0   1   0   0      1   1   0   1",
+                          "  0   0   0   0      0   0   0   0",
+                          "  0   0   0   0      0   0   0 a16",
+                          "  0   0   0   0      0   0   0   0";
+
 	mode		= 0x41;
-	delay		= 20;
+	delay		= 10;
 	blocksize	= 256;
 	readsize	= 256;
       ;
@@ -12385,376 +9976,190 @@ part
   ;
 
 #------------------------------------------------------------
-# ATtiny24
+# ATmega2561
 #------------------------------------------------------------
 
-part
-     id            = "t24";
-     desc          = "ATtiny24";
-     has_debugwire = yes;
-     flash_instr   = 0xB4, 0x07, 0x17;
-     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-	             0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC,
-	             0x99, 0xE1, 0xBB, 0xAC;
-## no STK500 devcode in XML file, use the ATtiny45 one
-     stk500_devcode   = 0x14;
-##  avr910_devcode   = ?;
-##  Try the AT90S2313 devcode:
-     avr910_devcode   = 0x20;
-     signature        = 0x1e 0x91 0x0b;
-     reset            = io;
-     chip_erase_delay = 4500;
-
-     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                        "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    hvsp_controlstack   =
-        0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
-        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
-        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
-        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0F;
-    hventerstabdelay    = 100;
-    hvspcmdexedelay     = 0;
-    synchcycles         = 6;
-    latchcycles         = 1;
-    togglevtg           = 1;
-    poweroffdelay       = 25;
-    resetdelayms        = 0;
-    resetdelayus        = 70;
-    hvleavestabdelay    = 100;
-    resetdelay          = 25;
-    chiperasepolltimeout = 40;
-    chiperasetime       = 0;
-    programfusepolltimeout = 25;
-    programlockpolltimeout = 25;
-
-     memory "eeprom"
-         size            = 128;
-        paged           = no;
-        page_size       = 4;
-         min_write_delay = 4000;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x x",
-                           "x a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
-
-         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x x",
-                           "x a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  "  x  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 4;
-	readsize	= 256;
-       ;
-     memory "flash"
-         paged           = yes;
-         size            = 2048;
-         page_size       = 32;
-         num_pages       = 64;
-         min_write_delay = 4500;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0    0   0  a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0    0   0  a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
-
-         loadpage_lo     = "  0   1   0   0    0   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x   x   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
-
-         loadpage_hi     = "  0   1   0   0    1   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x   x   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
+part parent "m2560"
+    id               = "m2561";
+    desc             = "ATmega2561";
+    signature        = 0x1e 0x98 0x02;
 
-         writepage       = "  0  1  0  0   1  1  0  0",
-                           "  0  0  0  0   0  0 a9 a8",
-                           " a7 a6 a5 a4   x  x  x  x",
-                           "  x  x  x  x   x  x  x  x";
+    ocdrev              = 4;
+  ;
 
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 32;
-	readsize	= 256;
-       ;
-#   ATtiny24 has Signature Bytes: 0x1E 0x91 0x0B.
-     memory "signature"
-         size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-       ;
-     memory "lock"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
-                           "x x x x  x x x x  x x x x  x x i i";
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                           "0 0 0 0  0 0 0 0  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+#------------------------------------------------------------
+# ATmega128RFA1
+#------------------------------------------------------------
+# Identical to ATmega2561 but half the ROM
 
-     memory "lfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
+part parent "m2561"
+    id               = "m128rfa1";
+    desc             = "ATmega128RFA1";
+    signature        = 0x1e 0xa7 0x01;
+    chip_erase_delay = 55000;
+    bs2              = 0xE2;
 
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+    ocdrev              = 3;
 
-     memory "hfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
+    memory "flash"
+        paged           = yes;
+        size            = 131072;
+        page_size       = 256;
+        num_pages       = 512;
+        min_write_delay = 50000;
+        max_write_delay = 50000;
+        readback_p1     = 0x00;
+        readback_p2     = 0x00;
+        read_lo         = "  0   0   1   0      0   0   0   0",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
 
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+        read_hi         = "  0   0   1   0      1   0   0   0",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
 
-     memory "efuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
+        loadpage_lo     = "  0   1   0   0      0   0   0   0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-     memory "calibration"
-         size            = 1;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
-     ;
+        writepage       = "  0   1   0   0      1   1   0   0",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7   x   x   x      x   x   x   x",
+                          "  x   x   x   x      x   x   x   x";
+
+	mode		= 0x41;
+	delay		= 20;
+	blocksize	= 256;
+	readsize	= 256;
+      ;
   ;
 
 #------------------------------------------------------------
-# ATtiny44
+# ATmega256RFR2
 #------------------------------------------------------------
 
-part
-     id            = "t44";
-     desc          = "ATtiny44";
-     has_debugwire = yes;
-     flash_instr   = 0xB4, 0x07, 0x17;
-     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
-                     0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC,
-                     0x99, 0xE1, 0xBB, 0xAC;
-## no STK500 devcode in XML file, use the ATtiny45 one
-     stk500_devcode   = 0x14;
-##  avr910_devcode   = ?;
-##  Try the AT90S2313 devcode:
-     avr910_devcode   = 0x20;
-     signature        = 0x1e 0x92 0x07;
-     reset            = io;
-     chip_erase_delay = 4500;
+part parent "m2561"
+    id               = "m256rfr2";
+    desc             = "ATmega256RFR2";
+    signature        = 0x1e 0xa8 0x02;
+    chip_erase_delay = 55000;
+    bs2              = 0xE2;
 
-     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                        "x x x x  x x x x    x x x x  x x x x";
 
-     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
-                        "x x x x  x x x x    x x x x  x x x x";
+    ocdrev              = 4;
+  ;
 
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
+#------------------------------------------------------------
+# ATmega128RFR2
+#------------------------------------------------------------
 
-    hvsp_controlstack   =
-        0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
-        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
-        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
-        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0F;
-    hventerstabdelay    = 100;
-    hvspcmdexedelay     = 0;
-    synchcycles         = 6;
-    latchcycles         = 1;
-    togglevtg           = 1;
-    poweroffdelay       = 25;
-    resetdelayms        = 0;
-    resetdelayus        = 70;
-    hvleavestabdelay    = 100;
-    resetdelay          = 25;
-    chiperasepolltimeout = 40;
-    chiperasetime       = 0;
-    programfusepolltimeout = 25;
-    programlockpolltimeout = 25;
+part parent "m128rfa1"
+    id               = "m128rfr2";
+    desc             = "ATmega128RFR2";
+    signature        = 0x1e 0xa7 0x02;
 
-     memory "eeprom"
-         size            = 256;
-        paged           = no;
-        page_size       = 4;
-         min_write_delay = 4000;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x x",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x x",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
+    ocdrev              = 3;
+  ;
 
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
+#------------------------------------------------------------
+# ATmega64RFR2
+#------------------------------------------------------------
 
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x   x   x   x",
-			  "  x  a6  a5  a4     a3  a2   0   0",
-			  "  x   x   x   x      x   x   x   x";
+part parent "m128rfa1"
+    id               = "m64rfr2";
+    desc             = "ATmega64RFR2";
+    signature        = 0x1e 0xa6 0x02;
 
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 4;
-	readsize	= 256;
-       ;
-     memory "flash"
-         paged           = yes;
-         size            = 4096;
-         page_size       = 64;
-         num_pages       = 64;
-         min_write_delay = 4500;
-         max_write_delay = 4500;
-         readback_p1     = 0xff;
-         readback_p2     = 0xff;
-         read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0    0  a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
 
-         read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0    0  a10 a9  a8",
-                           " a7  a6  a5  a4   a3  a2  a1  a0",
-                           "  o   o   o   o    o   o   o   o";
+    ocdrev              = 3;
 
-         loadpage_lo     = "  0   1   0   0    0   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
+    memory "flash"
+        paged           = yes;
+        size            = 65536;
+        page_size       = 256;
+        num_pages       = 256;
+        min_write_delay = 50000;
+        max_write_delay = 50000;
+        readback_p1     = 0x00;
+        readback_p2     = 0x00;
+        read_lo         = "  0   0   1   0      0   0   0   0",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
 
-         loadpage_hi     = "  0   1   0   0    1   0   0   0",
-                           "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
-                           "  i   i   i   i    i   i   i   i";
+        read_hi         = "  0   0   1   0      1   0   0   0",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
 
-         writepage       = "  0  1  0  0   1  1  0  0",
-                           "  0  0  0  0   0 a10 a9 a8",
-                           " a7 a6 a5  x   x  x  x  x",
-                           "  x  x  x  x   x  x  x  x";
+        loadpage_lo     = "  0   1   0   0      0   0   0   0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
+
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
+
+        writepage       = "  0   1   0   0      1   1   0   0",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          " a7   x   x   x      x   x   x   x",
+                          "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 32;
+	delay		= 20;
+	blocksize	= 256;
 	readsize	= 256;
-       ;
-#   ATtiny44 has Signature Bytes: 0x1E 0x92 0x07.
-     memory "signature"
-         size            = 3;
-         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
-                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-       ;
-     memory "lock"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
-                           "x x x x  x x x x  x x x x  x x i i";
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
-                           "0 0 0 0  0 0 0 0  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
-
-     memory "lfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
+      ;
+  ;
 
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+#------------------------------------------------------------
+# ATmega2564RFR2
+#------------------------------------------------------------
 
-     memory "hfuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                           "x x x x  x x x x  i i i i  i i i i";
+part parent "m256rfr2"
+    id               = "m2564rfr2";
+    desc             = "ATmega2564RFR2";
+    signature        = 0x1e 0xa8 0x03;
+  ;
 
-         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-       ;
+#------------------------------------------------------------
+# ATmega1284RFR2
+#------------------------------------------------------------
 
-     memory "efuse"
-         size            = 1;
-         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                           "x x x x  x x x x  x x x x  x x x i";
+part parent "m128rfr2"
+    id               = "m1284rfr2";
+    desc             = "ATmega1284RFR2";
+    signature        = 0x1e 0xa7 0x03;
+  ;
 
-         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-     ;
+#------------------------------------------------------------
+# ATmega644RFR2
+#------------------------------------------------------------
 
-     memory "calibration"
-         size            = 1;
-         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
-                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
-     ;
+part parent "m64rfr2"
+    id               = "m644rfr2";
+    desc             = "ATmega644RFR2";
+    signature        = 0x1e 0xa6 0x03;
   ;
 
 #------------------------------------------------------------
-# ATtiny84
+# ATtiny24
 #------------------------------------------------------------
 
 part
-     id            = "t84";
-     desc          = "ATtiny84";
+     id            = "t24";
+     desc          = "ATtiny24";
      has_debugwire = yes;
      flash_instr   = 0xB4, 0x07, 0x17;
      eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
@@ -12765,7 +10170,7 @@ part
 ##  avr910_devcode   = ?;
 ##  Try the AT90S2313 devcode:
      avr910_devcode   = 0x20;
-     signature        = 0x1e 0x93 0x0c;
+     signature        = 0x1e 0x91 0x0b;
      reset            = io;
      chip_erase_delay = 4500;
 
@@ -12806,19 +10211,21 @@ part
     programfusepolltimeout = 25;
     programlockpolltimeout = 25;
 
+    ocdrev              = 1;
+
      memory "eeprom"
-         size            = 512;
+         size            = 128;
         paged           = no;
         page_size       = 4;
          min_write_delay = 4000;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
-         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
+         read            = "1  0  1  0   0  0  0  0   0 0 0 x  x x x x",
+                           "x a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x a8",
-                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
+         write           = "1  1  0  0   0  0  0  0   0 0 0 x  x x x x",
+                           "x a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
@@ -12837,36 +10244,36 @@ part
        ;
      memory "flash"
          paged           = yes;
-         size            = 8192;
-         page_size       = 64;
-         num_pages       = 128;
+         size            = 2048;
+         page_size       = 32;
+         num_pages       = 64;
          min_write_delay = 4500;
          max_write_delay = 4500;
          readback_p1     = 0xff;
          readback_p2     = 0xff;
          read_lo         = "  0   0   1   0    0   0   0   0",
-                           "  0   0   0   0  a11 a10  a9  a8",
+                           "  0   0   0   0    0   0  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          read_hi         = "  0   0   1   0    1   0   0   0",
-                           "  0   0   0   0  a11 a10  a9  a8",
+                           "  0   0   0   0    0   0  a9  a8",
                            " a7  a6  a5  a4   a3  a2  a1  a0",
                            "  o   o   o   o    o   o   o   o";
 
          loadpage_lo     = "  0   1   0   0    0   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  x   x   x   x   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
          loadpage_hi     = "  0   1   0   0    1   0   0   0",
                            "  0   0   0   x    x   x   x   x",
-                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  x   x   x   x   a3  a2  a1  a0",
                            "  i   i   i   i    i   i   i   i";
 
-         writepage       = "  0  1  0  0   1   1   0  0",
-                           "  0  0  0  0  a11 a10 a9 a8",
-                           " a7 a6 a5  x   x  x  x  x",
+         writepage       = "  0  1  0  0   1  1  0  0",
+                           "  0  0  0  0   0  0 a9 a8",
+                           " a7 a6 a5 a4   x  x  x  x",
                            "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
@@ -12874,13 +10281,12 @@ part
 	blocksize	= 32;
 	readsize	= 256;
        ;
-#   ATtiny84 has Signature Bytes: 0x1E 0x93 0x0C.
+#   ATtiny24 has Signature Bytes: 0x1E 0x91 0x0B.
      memory "signature"
          size            = 3;
          read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                            "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
        ;
-
      memory "lock"
          size            = 1;
          write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
@@ -12932,213 +10338,31 @@ part
   ;
 
 #------------------------------------------------------------
-# ATmega32u4
+# ATtiny44
 #------------------------------------------------------------
 
 part
-    id               = "m32u4";
-    desc             = "ATmega32U4";
-    signature        = 0x1e 0x95 0x87;
-    has_jtag         = yes;
-#    stk500_devcode   = 0xB2;
-#    avr910_devcode   = 0x43;
-    chip_erase_delay = 9000;
-    pagel            = 0xD7;
-    bs2              = 0xA0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
-    togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
-
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    rampz               = 0x3b;
-    allowfullpagebitstream = no;
-
-    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 1024;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
-	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 32768;
-        page_size       = 128;
-        num_pages       = 256;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          " a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 128;
-	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
-                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
-
-#------------------------------------------------------------
-# AT90USB646
-#------------------------------------------------------------
+     id            = "t44";
+     desc          = "ATtiny44";
+     has_debugwire = yes;
+     flash_instr   = 0xB4, 0x07, 0x17;
+     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+                     0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC,
+                     0x99, 0xE1, 0xBB, 0xAC;
+## no STK500 devcode in XML file, use the ATtiny45 one
+     stk500_devcode   = 0x14;
+##  avr910_devcode   = ?;
+##  Try the AT90S2313 devcode:
+     avr910_devcode   = 0x20;
+     signature        = 0x1e 0x92 0x07;
+     reset            = io;
+     chip_erase_delay = 4500;
 
-part
-    id               = "usb646";
-    desc             = "AT90USB646";
-    signature        = 0x1e 0x96 0x82;
-    has_jtag         = yes;
-#    stk500_devcode   = 0xB2;
-#    avr910_devcode   = 0x43;
-    chip_erase_delay = 9000;
-    pagel            = 0xD7;
-    bs2              = 0xA0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
+                        "x x x x  x x x x    x x x x  x x x x";
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
+     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                        "x x x x  x x x x    x x x x  x x x x";
 
     timeout		= 200;
     stabdelay		= 100;
@@ -13151,183 +10375,178 @@ part
     postdelay		= 1;
     pollmethod		= 1;
 
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+    hvsp_controlstack   =
+        0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
+        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
+        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
+        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0F;
     hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
+    hvspcmdexedelay     = 0;
+    synchcycles         = 6;
+    latchcycles         = 1;
     togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
+    poweroffdelay       = 25;
+    resetdelayms        = 0;
+    resetdelayus        = 70;
+    hvleavestabdelay    = 100;
+    resetdelay          = 25;
+    chiperasepolltimeout = 40;
+    chiperasetime       = 0;
+    programfusepolltimeout = 25;
+    programlockpolltimeout = 25;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    rampz               = 0x3b;
-    allowfullpagebitstream = no;
+    ocdrev              = 1;
 
-    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 2048;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+     memory "eeprom"
+         size            = 256;
+        paged           = no;
+        page_size       = 4;
+         min_write_delay = 4000;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x x",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
+         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x x",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
+			  "  0   0   0   0      0   0  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  0   0   x   x      x   x   x   x",
+			  "  x  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
+	delay		= 6;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+       ;
+     memory "flash"
+         paged           = yes;
+         size            = 4096;
+         page_size       = 64;
+         num_pages       = 64;
+         min_write_delay = 4500;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read_lo         = "  0   0   1   0    0   0   0   0",
+                           "  0   0   0   0    0  a10 a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+         read_hi         = "  0   0   1   0    1   0   0   0",
+                           "  0   0   0   0    0  a10 a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_lo     = "  0   1   0   0    0   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_hi     = "  0   1   0   0    1   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+         writepage       = "  0  1  0  0   1  1  0  0",
+                           "  0  0  0  0   0 a10 a9 a8",
+                           " a7 a6 a5  x   x  x  x  x",
+                           "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 256;
+	blocksize	= 32;
 	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+       ;
+#   ATtiny44 has Signature Bytes: 0x1E 0x92 0x07.
+     memory "signature"
+         size            = 3;
+         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+       ;
+     memory "lock"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
+                           "x x x x  x x x x  x x x x  x x i i";
+         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
+                           "0 0 0 0  0 0 0 0  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+     memory "lfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  i i i i";
+     memory "hfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
+     memory "efuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                           "x x x x  x x x x  x x x x  x x x i";
 
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
-                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
-      ;
+     ;
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
+     memory "calibration"
+         size            = 1;
+         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
+                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
+     ;
   ;
 
 #------------------------------------------------------------
-# AT90USB647
+# ATtiny84
 #------------------------------------------------------------
-# identical to AT90USB646
 
 part
-    id               = "usb647";
-    desc             = "AT90USB647";
-    signature        = 0x1e 0x96 0x82;
-    has_jtag         = yes;
-#    stk500_devcode   = 0xB2;
-#    avr910_devcode   = 0x43;
-    chip_erase_delay = 9000;
-    pagel            = 0xD7;
-    bs2              = 0xA0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
+     id            = "t84";
+     desc          = "ATtiny84";
+     has_debugwire = yes;
+     flash_instr   = 0xB4, 0x07, 0x17;
+     eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+	             0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC,
+	             0x99, 0xE1, 0xBB, 0xAC;
+## no STK500 devcode in XML file, use the ATtiny45 one
+     stk500_devcode   = 0x14;
+##  avr910_devcode   = ?;
+##  Try the AT90S2313 devcode:
+     avr910_devcode   = 0x20;
+     signature        = 0x1e 0x93 0x0c;
+     reset            = io;
+     chip_erase_delay = 4500;
 
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
+     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
+                        "x x x x  x x x x    x x x x  x x x x";
+
+     chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                        "x x x x  x x x x    x x x x  x x x x";
 
     timeout		= 200;
     stabdelay		= 100;
@@ -13338,294 +10557,293 @@ part
     pollvalue		= 0x53;
     predelay		= 1;
     postdelay		= 1;
-    pollmethod		= 1;
-
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+    pollmethod		= 1;
+
+    hvsp_controlstack   =
+        0x4C, 0x0C, 0x1C, 0x2C, 0x3C, 0x64, 0x74, 0x66,
+        0x68, 0x78, 0x68, 0x68, 0x7A, 0x6A, 0x68, 0x78,
+        0x78, 0x7D, 0x6D, 0x0C, 0x80, 0x40, 0x20, 0x10,
+        0x11, 0x08, 0x04, 0x02, 0x03, 0x08, 0x04, 0x0F;
     hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 5;
+    hvspcmdexedelay     = 0;
+    synchcycles         = 6;
+    latchcycles         = 1;
     togglevtg           = 1;
-    poweroffdelay       = 15;
-    resetdelayms        = 1;
-    resetdelayus        = 0;
-    hvleavestabdelay    = 15;
-    chiperasepulsewidth = 0;
-    chiperasepolltimeout = 10;
-    programfusepulsewidth = 0;
-    programfusepolltimeout = 5;
-    programlockpulsewidth = 0;
-    programlockpolltimeout = 5;
+    poweroffdelay       = 25;
+    resetdelayms        = 0;
+    resetdelayus        = 70;
+    hvleavestabdelay    = 100;
+    resetdelay          = 25;
+    chiperasepolltimeout = 40;
+    chiperasetime       = 0;
+    programfusepolltimeout = 25;
+    programlockpolltimeout = 25;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    rampz               = 0x3b;
-    allowfullpagebitstream = no;
+    ocdrev              = 1;
 
-    memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 2048;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+     memory "eeprom"
+         size            = 512;
+        paged           = no;
+        page_size       = 4;
+         min_write_delay = 4000;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x a8",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   o o o o  o o o o";
 
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
+         write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x a8",
+                           "a7 a6 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
+			  "  0   0   0   0      0   0  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
+			  "  0   0   x   x      x   x   x   x",
+			  "  x  a6  a5  a4     a3  a2   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
+	delay		= 6;
+	blocksize	= 4;
 	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
-        min_write_delay = 4500;
-        max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+       ;
+     memory "flash"
+         paged           = yes;
+         size            = 8192;
+         page_size       = 64;
+         num_pages       = 128;
+         min_write_delay = 4500;
+         max_write_delay = 4500;
+         readback_p1     = 0xff;
+         readback_p2     = 0xff;
+         read_lo         = "  0   0   1   0    0   0   0   0",
+                           "  0   0   0   0  a11 a10  a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+         read_hi         = "  0   0   1   0    1   0   0   0",
+                           "  0   0   0   0  a11 a10  a9  a8",
+                           " a7  a6  a5  a4   a3  a2  a1  a0",
+                           "  o   o   o   o    o   o   o   o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_lo     = "  0   1   0   0    0   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+         loadpage_hi     = "  0   1   0   0    1   0   0   0",
+                           "  0   0   0   x    x   x   x   x",
+                           "  x   x   x  a4   a3  a2  a1  a0",
+                           "  i   i   i   i    i   i   i   i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+         writepage       = "  0  1  0  0   1   1   0  0",
+                           "  0  0  0  0  a11 a10 a9 a8",
+                           " a7 a6 a5  x   x  x  x  x",
+                           "  x  x  x  x   x  x  x  x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 256;
+	blocksize	= 32;
 	readsize	= 256;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+       ;
+#   ATtiny84 has Signature Bytes: 0x1E 0x93 0x0C.
+     memory "signature"
+         size            = 3;
+         read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+       ;
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+     memory "lock"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
+                           "x x x x  x x x x  x x x x  x x i i";
+         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
+                           "0 0 0 0  0 0 0 0  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "hfuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+     memory "lfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "efuse"
-        size            = 1;
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  i i i i";
+     memory "hfuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                           "x x x x  x x x x  i i i i  i i i i";
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "x x x x  x x x x  o o o o  o o o o";
+         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
+       ;
 
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
+     memory "efuse"
+         size            = 1;
+         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                           "x x x x  x x x x  x x x x  x x x i";
 
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
+         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
+                           "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
-      ;
-
-    memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
-                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
-      ;
+     ;
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
+     memory "calibration"
+         size            = 1;
+         read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
+                           "0  0  0  0   0  0  0  a0   o o o o  o o o o";
+     ;
   ;
 
 #------------------------------------------------------------
-# AT90USB1286
+# ATtiny43U
 #------------------------------------------------------------
 
 part
-    id               = "usb1286";
-    desc             = "AT90USB1286";
-    signature        = 0x1e 0x97 0x82;
-    has_jtag         = yes;
-#    stk500_devcode   = 0xB2;
-#    avr910_devcode   = 0x43;
-    chip_erase_delay = 9000;
-    pagel            = 0xD7;
-    bs2              = 0xA0;
-    reset            = dedicated;
-    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "x x x x  x x x x    x x x x  x x x x";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "x x x x  x x x x    x x x x  x x x x";
+    id            = "t43u";
+    desc          = "ATtiny43u";
+    has_debugwire = yes;
+    flash_instr   = 0xB4, 0x07, 0x17;
+    eeprom_instr  = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
+                         0xBC, 0x07, 0xB4, 0x07, 0xBA, 0x0D, 0xBB, 0xBC,
+                         0x99, 0xE1, 0xBB, 0xAC;
+    stk500_devcode   = 0x14;
+##  avr910_devcode   = ?;
+##  Try the AT90S2313 devcode:
+    avr910_devcode   = 0x20;
+    signature        = 0x1e 0x92 0x0C;
+    reset            = io;
+    chip_erase_delay = 1000;
 
-    timeout		= 200;
-    stabdelay		= 100;
-    cmdexedelay		= 25;
-    synchloops		= 32;
-    bytedelay		= 0;
-    pollindex		= 3;
-    pollvalue		= 0x53;
-    predelay		= 1;
-    postdelay		= 1;
-    pollmethod		= 1;
+    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
+                        "x x x x  x x x x    x x x x  x x x x";
 
-    pp_controlstack     =
-        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
-        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
-        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
-        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                        "x x x x  x x x x    x x x x  x x x x";
+
+    timeout                     = 200;
+    stabdelay           = 100;
+    cmdexedelay         = 25;
+    synchloops          = 32;
+    bytedelay           = 0;
+    pollindex           = 3;
+    pollvalue           = 0x53;
+    predelay            = 1;
+    postdelay           = 1;
+    pollmethod          = 1;
+        pp_controlstack = 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, 0x4E, 0x5E,
+                                         0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, 0x06, 0x16, 0x46, 0x56,
+                                         0x0A, 0x1A, 0x4A, 0x5A, 0x1E, 0x7C, 0x00, 0x01, 0x00, 0x00,
+                                         0x00, 0x00;
     hventerstabdelay    = 100;
     progmodedelay       = 0;
+    hvspcmdexedelay     = 0;
     latchcycles         = 5;
     togglevtg           = 1;
-    poweroffdelay       = 15;
+    poweroffdelay       = 20;
     resetdelayms        = 1;
     resetdelayus        = 0;
     hvleavestabdelay    = 15;
+    resetdelay          = 15;
     chiperasepulsewidth = 0;
     chiperasepolltimeout = 10;
     programfusepulsewidth = 0;
     programfusepolltimeout = 5;
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
-
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    rampz               = 0x3b;
-    allowfullpagebitstream = no;
-
     memory "eeprom"
-        paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 4096;
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
-
-        write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0", 
-                          "  i   i   i   i      i   i   i   i";
-
-	loadpage_lo	= "  1   1   0   0      0   0   0   1",
-			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0  a2  a1  a0",
-			  "  i   i   i   i      i   i   i   i";
-
-	writepage	= "  1   1   0   0      0   0   1   0",
-			  "  0   0   x   x      x a10  a9  a8",
-			  " a7  a6  a5  a4     a3   0   0   0",
-			  "  x   x   x   x      x   x   x   x";
-
-	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
-	readsize	= 256;
-      ;
-
+                size            = 64;
+                paged                   = yes;
+                page_size       = 4;
+                num_pages               = 16;
+                min_write_delay = 4000;
+                max_write_delay = 4500;
+                readback_p1     = 0xff;
+                readback_p2     = 0xff;
+                read            = "1  0  1  0   0  0  0  0    0 0 0 x  x x x x",
+                                   "0  0 a4  a3 a2 a1 a0   o o o o  o o o o";
+
+                write           = "1  1  0  0   0  0  0  0    0 0 0 x  x x x x",
+                                   "0  0 a5 a4  a3 a2 a1 a0   i i i i  i i i i";
+
+                loadpage_lo     = "  1   1   0   0      0   0   0   1",
+                                  "  0   0   0   0      0   0   0   0",
+                                  "  0   0   0   0      0   0  a1  a0",
+                                  "  i   i   i   i      i   i   i   i";
+
+                writepage       = "  1   1   0   0      0   0   1   0",
+                                  "  0   0   x   x      x   x   x   x",
+                                  "  0   0  a5  a4     a3  a2   0   0",
+                                  "  x   x   x   x      x   x   x   x";
+
+                mode            = 0x41;
+                delay           = 5;
+                blocksize       = 4;
+                readsize        = 256;
+        ;
     memory "flash"
         paged           = yes;
-        size            = 131072;
-        page_size       = 256;
-        num_pages       = 512;
+        size            = 4096;
+        page_size       = 64;
+        num_pages       = 64;
         min_write_delay = 4500;
         max_write_delay = 4500;
-        readback_p1     = 0x00;
-        readback_p2     = 0x00;
-        read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        readback_p1     = 0xff;
+        readback_p2     = 0xff;
 
-        read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
-                          "  o   o   o   o      o   o   o   o";
+        read_lo         = "  0   0   1   0    0   0   0   0",
+                          "  0   0   0   0    0  a10 a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        read_hi         = "  0   0   1   0    1   0   0   0",
+                          "  0   0   0   0    0  a10 a9  a8",
+                          " a7  a6  a5  a4   a3  a2  a1  a0",
+                          "  o   o   o   o    o   o   o   o";
 
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+        loadpage_lo     = "  0   1   0   0    0   0   0   0",
+                          "  0   0   0   x    x   x   x   x",
+                          "  x   x   x  a4   a3  a2  a1  a0",
+                          "  i   i   i   i    i   i   i   i";
 
-        writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
-                          "  x   x   x   x      x   x   x   x";
+        loadpage_hi     = "  0   1   0   0    1   0   0   0",
+                          "  0   0   0   x    x   x   x   x",
+                          "  x   x   x  a4   a3  a2  a1  a0",
+                          "  i   i   i   i    i   i   i   i";
 
-	mode		= 0x41;
-	delay		= 6;
-	blocksize	= 256;
-	readsize	= 256;
-      ;
+        writepage       = "  0  1  0  0   1  1  0  0",
+                          "  0  0  0  0   0 a10 a9 a8",
+                          " a7 a6 a5  x   x  x  x  x",
+                          "  x  x  x  x   x  x  x  x";
+
+                mode            = 0x41;
+                delay           = 10;
+                blocksize       = 64;
+                readsize        = 256;
+       ;
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+    ;
+    memory "lock"
+        size            = 1;
+        write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
+                          "x x x x  x x x x  1 1 i i  i i i i";
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+    ;
 
     memory "lfuse"
         size            = 1;
@@ -13634,9 +10852,9 @@ part
 
         read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        ;
 
     memory "hfuse"
         size            = 1;
@@ -13645,54 +10863,36 @@ part
 
         read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        ;
 
     memory "efuse"
         size            = 1;
         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  x x x x  i i i i";
+                          "x x x x  x x x x  x x x x  x x x i";
 
         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
                           "x x x x  x x x x  o o o o  o o o o";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
-                          "x x x x  x x x x   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+    ;
 
     memory "calibration"
-        size            = 1;
-        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
-                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
-                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
-      ;
-  ;
+        size            = 2;
+        read            = "0  0  1  1   1  0  0  0    0 0 0 x  x x x x",
+                          "0  0  0  0   0  0  0  a0   o o o o  o o o o";
+    ;
+;
 
 #------------------------------------------------------------
-# AT90USB1287
+# ATmega32u4
 #------------------------------------------------------------
-# identical to AT90USB1286
 
 part
-    id               = "usb1287";
-    desc             = "AT90USB1287";
-    signature        = 0x1e 0x97 0x82;
+    id               = "m32u4";
+    desc             = "ATmega32U4";
+    signature        = 0x1e 0x95 0x87;
     has_jtag         = yes;
 #    stk500_devcode   = 0xB2;
 #    avr910_devcode   = 0x43;
@@ -13742,21 +10942,23 @@ part
     rampz               = 0x3b;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 4096;
+        page_size       = 4;  /* for parallel programming */
+        size            = 1024;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read            = "  1   0   1   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
+                          "  x   x   x   x      x a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         write           = "  1   1   0   0      0   0   0   0",
-                          "  x   x   x   x    a11 a10  a9  a8",
+                          "  x   x   x   x      x a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
@@ -13771,48 +10973,48 @@ part
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 10;
-	blocksize	= 8;
+	delay		= 20;
+	blocksize	= 4;
 	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 131072;
-        page_size       = 256;
-        num_pages       = 512;
+        size            = 32768;
+        page_size       = 128;
+        num_pages       = 256;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7   x   x   x      x   x   x   x",
+                          " a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 256;
+	blocksize	= 128;
 	readsize	= 256;
       ;
 
@@ -13873,25 +11075,26 @@ part
       ;
   ;
 
-
 #------------------------------------------------------------
-# AT90USB162
+# AT90USB646
 #------------------------------------------------------------
 
 part
-    id               = "usb162";
-    desc             = "AT90USB162";
-    has_jtag         = no;
-    has_debugwire    = yes;
-    signature        = 0x1e 0x94 0x82;
+    id               = "usb646";
+    desc             = "AT90USB646";
+    signature        = 0x1e 0x96 0x82;
+    has_jtag         = yes;
+#    stk500_devcode   = 0xB2;
+#    avr910_devcode   = 0x43;
     chip_erase_delay = 9000;
-    reset            = io;
+    pagel            = 0xD7;
+    bs2              = 0xA0;
+    reset            = dedicated;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
                        "x x x x  x x x x    x x x x  x x x x";
-    pagel            = 0xD7;
-    bs2              = 0xC6;
 
     timeout		= 200;
     stabdelay		= 100;
@@ -13903,6 +11106,7 @@ part
     predelay		= 1;
     postdelay		= 1;
     pollmethod		= 1;
+
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
@@ -13923,78 +11127,84 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    idr                 = 0x31;
+    spmcr               = 0x57;
+    rampz               = 0x3b;
+    allowfullpagebitstream = no;
+
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 512;
-        num_pages       = 128;
+        page_size       = 8;  /* for parallel programming */
+        size            = 2048;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
+                          "  x   x   x   x      x a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
+			  "  0   0   0   0      0  a2  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2   0   0",
+			  "  0   0   x   x      x a10  a9  a8",
+			  " a7  a6  a5  a4     a3   0   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
+	delay		= 10;
+	blocksize	= 8;
 	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 16384;
-        page_size       = 128;
-        num_pages       = 128;
+        size            = 65536;
+        page_size       = 256;
+        num_pages       = 256;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 128;
+	blocksize	= 256;
 	readsize	= 256;
       ;
 
@@ -14023,7 +11233,7 @@ part
     memory "efuse"
         size            = 1;
         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+                          "x x x x  x x x x  x x x x  i i i i";
 
         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
                           "x x x x  x x x x  o o o o  o o o o";
@@ -14044,38 +11254,50 @@ part
 
     memory "calibration"
         size            = 1;
-        read            = "0 0 1 1  1 0 0 0    0 0 0 x  x x x x",
+        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
                           "0 0 0 0  0 0 0 0    o o o o  o o o o";
       ;
+
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
   ;
 
 #------------------------------------------------------------
-# AT90USB82
+# AT90USB647
+#------------------------------------------------------------
+# identical to AT90USB646
+
+part parent "usb646"
+    id               = "usb647";
+    desc             = "AT90USB647";
+    signature        = 0x1e 0x96 0x82;
+
+    ocdrev              = 3;
+  ;
+
+#------------------------------------------------------------
+# AT90USB1286
 #------------------------------------------------------------
-# Changes against AT90USB162 (beside IDs)
-#    memory "flash"
-#        size            = 8192;
-#        num_pages       = 64;
 
 part
-    id               = "usb82";
-    desc             = "AT90USB82";
-    has_jtag         = no;
-    has_debugwire    = yes;
-    signature        = 0x1e 0x93 0x82;
+    id               = "usb1286";
+    desc             = "AT90USB1286";
+    signature        = 0x1e 0x97 0x82;
+    has_jtag         = yes;
+#    stk500_devcode   = 0xB2;
+#    avr910_devcode   = 0x43;
     chip_erase_delay = 9000;
-    reset            = io;
+    pagel            = 0xD7;
+    bs2              = 0xA0;
+    reset            = dedicated;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                        "x x x x  x x x x    x x x x  x x x x";
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
                        "x x x x  x x x x    x x x x  x x x x";
-    pagel            = 0xD7;
-    bs2              = 0xC6;
 
     timeout		= 200;
     stabdelay		= 100;
@@ -14087,6 +11309,7 @@ part
     predelay		= 1;
     postdelay		= 1;
     pollmethod		= 1;
+
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
@@ -14107,46 +11330,52 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    idr                 = 0x31;
+    spmcr               = 0x57;
+    rampz               = 0x3b;
+    allowfullpagebitstream = no;
+
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 4;  /* for parallel programming */
-        size            = 512;
-        num_pages       = 128;
+        page_size       = 8;  /* for parallel programming */
+        size            = 4096;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0x00;
         readback_p2     = 0x00;
         read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
+                          "  x   x   x   x    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0", 
                           "  i   i   i   i      i   i   i   i";
 
 	loadpage_lo	= "  1   1   0   0      0   0   0   1",
 			  "  0   0   0   0      0   0   0   0",
-			  "  0   0   0   0      0   0  a1  a0",
+			  "  0   0   0   0      0  a2  a1  a0",
 			  "  i   i   i   i      i   i   i   i";
 
 	writepage	= "  1   1   0   0      0   0   1   0",
-                          "  0   0   0   0    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2   0   0",
+			  "  0   0   x   x      x a10  a9  a8",
+			  " a7  a6  a5  a4     a3   0   0   0",
 			  "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
-	delay		= 20;
-	blocksize	= 4;
+	delay		= 10;
+	blocksize	= 8;
 	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 8192;
-        page_size       = 128;
-        num_pages       = 64;
+        size            = 131072;
+        page_size       = 256;
+        num_pages       = 512;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
@@ -14163,22 +11392,22 @@ part
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
                           "  x   x   x   x      x   x   x   x",
-                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  x  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
                           "a15 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6   x   x      x   x   x   x",
+                          " a7   x   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 128;
+	blocksize	= 256;
 	readsize	= 256;
       ;
 
@@ -14207,7 +11436,7 @@ part
     memory "efuse"
         size            = 1;
         write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "x x x x  x x x x  i i i i  i i i i";
+                          "x x x x  x x x x  x x x x  i i i i";
 
         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
                           "x x x x  x x x x  o o o o  o o o o";
@@ -14228,32 +11457,40 @@ part
 
     memory "calibration"
         size            = 1;
-        read            = "0 0 1 1  1 0 0 0    0 0 0 x  x x x x",
+        read            = "0 0 1 1  1 0 0 0    x x x x  x x x x",
                           "0 0 0 0  0 0 0 0    o o o o  o o o o";
       ;
+
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+        read            = "0  0  1  1   0  0  0  0   x  x  x  x   x  x  x  x",
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
   ;
 
 #------------------------------------------------------------
-# ATmega32U2
+# AT90USB1287
 #------------------------------------------------------------
-# Changes against AT90USB162 (beside IDs)
-#    memory "flash"
-#        size            = 32768;
-#        num_pages       = 256;
-#    memory "eeprom"
-#        size            = 1024;
-#        num_pages       = 256;
+# identical to AT90USB1286
+
+part parent "usb1286"
+    id               = "usb1287";
+    desc             = "AT90USB1287";
+    signature        = 0x1e 0x97 0x82;
+
+    ocdrev              = 3;
+  ;
+
+#------------------------------------------------------------
+# AT90USB162
+#------------------------------------------------------------
+
 part
-    id               = "m32u2";
-    desc             = "ATmega32U2";
+    id               = "usb162";
+    desc             = "AT90USB162";
     has_jtag         = no;
     has_debugwire    = yes;
-    signature        = 0x1e 0x95 0x8a;
+    signature        = 0x1e 0x94 0x82;
     chip_erase_delay = 9000;
     reset            = io;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
@@ -14293,11 +11530,13 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 1;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
-        size            = 1024;
-        num_pages       = 256;
+        size            = 512;
+        num_pages       = 128;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0x00;
@@ -14330,9 +11569,9 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 32768;
+        size            = 16384;
         page_size       = 128;
-        num_pages       = 256;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
@@ -14423,22 +11662,21 @@ part
                           "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
   ;
+
 #------------------------------------------------------------
-# ATmega16U2
+# AT90USB82
 #------------------------------------------------------------
-# Changes against ATmega32U2 (beside IDs)
+# Changes against AT90USB162 (beside IDs)
 #    memory "flash"
-#        size            = 16384;
-#        num_pages       = 128;
-#    memory "eeprom"
-#        size            = 512;
-#        num_pages       = 128;
+#        size            = 8192;
+#        num_pages       = 64;
+
 part
-    id               = "m16u2";
-    desc             = "ATmega16U2";
+    id               = "usb82";
+    desc             = "AT90USB82";
     has_jtag         = no;
     has_debugwire    = yes;
-    signature        = 0x1e 0x94 0x89;
+    signature        = 0x1e 0x93 0x82;
     chip_erase_delay = 9000;
     reset            = io;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
@@ -14478,6 +11716,8 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 1;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
@@ -14515,9 +11755,9 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 16384;
+        size            = 8192;
         page_size       = 128;
-        num_pages       = 128;
+        num_pages       = 64;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
@@ -14610,20 +11850,21 @@ part
   ;
 
 #------------------------------------------------------------
-# ATmega8U2
+# ATmega32U2
 #------------------------------------------------------------
-# Changes against ATmega16U2 (beside IDs)
+# Changes against AT90USB162 (beside IDs)
 #    memory "flash"
-#        size            = 8192;
-#        page_size       = 64;
-#        blocksize       = 64;
-
+#        size            = 32768;
+#        num_pages       = 256;
+#    memory "eeprom"
+#        size            = 1024;
+#        num_pages       = 256;
 part
-    id               = "m8u2";
-    desc             = "ATmega8U2";
+    id               = "m32u2";
+    desc             = "ATmega32U2";
     has_jtag         = no;
     has_debugwire    = yes;
-    signature        = 0x1e 0x93 0x89;
+    signature        = 0x1e 0x95 0x8a;
     chip_erase_delay = 9000;
     reset            = io;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
@@ -14663,11 +11904,13 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
+    ocdrev              = 1;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
-        size            = 512;
-        num_pages       = 128;
+        size            = 1024;
+        num_pages       = 256;
         min_write_delay = 9000;
         max_write_delay = 9000;
         readback_p1     = 0x00;
@@ -14700,9 +11943,9 @@ part
 
     memory "flash"
         paged           = yes;
-        size            = 8192;
-        page_size       = 64;
-        num_pages       = 128;
+        size            = 32768;
+        page_size       = 128;
+        num_pages       = 256;
         min_write_delay = 4500;
         max_write_delay = 4500;
         readback_p1     = 0x00;
@@ -14734,7 +11977,7 @@ part
 
 	mode		= 0x41;
 	delay		= 6;
-	blocksize	= 64;
+	blocksize	= 128;
 	readsize	= 256;
       ;
 
@@ -14794,37 +12037,40 @@ part
       ;
   ;
 #------------------------------------------------------------
-# ATmega325
+# ATmega16U2
 #------------------------------------------------------------
-
+# Changes against ATmega32U2 (beside IDs)
+#    memory "flash"
+#        size            = 16384;
+#        num_pages       = 128;
+#    memory "eeprom"
+#        size            = 512;
+#        num_pages       = 128;
 part
-    id               = "m325";
-    desc             = "ATMEGA325";
-    signature        = 0x1e 0x95 0x05;
-    has_jtag         = yes;
-#   stk500_devcode   = 0x??; # No STK500v1 support?
-#   avr910_devcode   = 0x??; # Try the ATmega16 one
-    avr910_devcode   = 0x74;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
+    id               = "m16u2";
+    desc             = "ATmega16U2";
+    has_jtag         = no;
+    has_debugwire    = yes;
+    signature        = 0x1e 0x94 0x89;
     chip_erase_delay = 9000;
+    reset            = io;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "0 0 0 0  0 0 0 0    0 0 0 0  0 0 0 0";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "0 0 0 0  0 0 0 0    0 0 0 0  0 0 0 0";
-
-    timeout             = 200;
-    stabdelay           = 100;
-    cmdexedelay         = 25;
-    synchloops          = 32;
-    bytedelay           = 0;
-    pollindex           = 3;
-    pollvalue           = 0x53;
-    predelay            = 1;
-    postdelay           = 1;
-    pollmethod          = 1;
+                       "x x x x  x x x x    x x x x  x x x x";
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                       "x x x x  x x x x    x x x x  x x x x";
+    pagel            = 0xD7;
+    bs2              = 0xC6;
 
+    timeout		= 200;
+    stabdelay		= 100;
+    cmdexedelay		= 25;
+    synchloops		= 32;
+    bytedelay		= 0;
+    pollindex		= 3;
+    pollvalue		= 0x53;
+    predelay		= 1;
+    postdelay		= 1;
+    pollmethod		= 1;
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
@@ -14845,175 +12091,173 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    allowfullpagebitstream = no;
+    ocdrev              = 1;
 
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
-        size            = 1024;
+        size            = 512;
+        num_pages       = 128;
         min_write_delay = 9000;
         max_write_delay = 9000;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
+        readback_p1     = 0x00;
+        readback_p2     = 0x00;
         read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   0      0   0  a9  a8",
+                          "  0   0   0   0    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0  a9  a8",
+                          "  0   0   0   0    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
-        loadpage_lo     = "  1   1   0   0      0   0   0   1",
-                          "  0   0   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0   0  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
 
-        writepage       = "  1   1   0   0      0   0   1   0",
-                          "  0   0   0   0      0   0  a9  a8",
+	writepage	= "  1   1   0   0      0   0   1   0",
+                          "  0   0   0   0    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2   0   0",
-                          "  x   x   x   x      x   x   x   x";
+			  "  x   x   x   x      x   x   x   x";
 
-        mode            = 0x41;
-        delay           = 10;
-        blocksize       = 4;
-        readsize        = 256;
+	mode		= 0x41;
+	delay		= 20;
+	blocksize	= 4;
+	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 32768;
+        size            = 16384;
         page_size       = 128;
-        num_pages       = 256;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
+        readback_p1     = 0x00;
+        readback_p2     = 0x00;
         read_lo         = "  0   0   1   0      0   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         read_hi         = "  0   0   1   0      1   0   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0   0   0",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   0      0   0   0   0",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
         writepage       = "  0   1   0   0      1   1   0   0",
-                          "  0 a14 a13 a12    a11 a10  a9  a8",
-                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
                           "  x   x   x   x      x   x   x   x";
 
-        mode            = 0x41;
-        delay           = 10;
-        blocksize       = 128;
-        readsize        = 256;
+	mode		= 0x41;
+	delay		= 6;
+	blocksize	= 128;
+	readsize	= 256;
       ;
 
-    memory "lock"
+    memory "lfuse"
         size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 1 1 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   1 1 i i  i i i i";
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
       ;
 
-    memory "lfuse"
+    memory "hfuse"
         size            = 1;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
+        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
       ;
 
-    memory "hfuse"
+    memory "efuse"
         size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
       ;
 
-    memory "efuse"
+    memory "lock"
         size            = 1;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x   x x o o  o o o o";
 
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0  o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "0 0 0 0  0 0 0 0  1 1 1 1  1 i i i";
+        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
+                          "x x x x  x x x x   1 1 i i  i i i i";
         min_write_delay = 9000;
         max_write_delay = 9000;
       ;
 
+    memory "calibration"
+        size            = 1;
+        read            = "0 0 1 1  1 0 0 0    0 0 0 x  x x x x",
+                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
+      ;
     memory "signature"
         size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  0   0  0  0  0",
-                          "0  0  0  0   0  0 a1 a0   o  o  o  o   o  o  o  o";
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
       ;
-
-    memory "calibration"
-        size            = 1;
-
-        read            = "0 0 1 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-        ;
   ;
 
 #------------------------------------------------------------
-# ATmega645
+# ATmega8U2
 #------------------------------------------------------------
+# Changes against ATmega16U2 (beside IDs)
+#    memory "flash"
+#        size            = 8192;
+#        page_size       = 64;
+#        blocksize       = 64;
 
 part
-    id               = "m645";
-    desc             = "ATMEGA645";
-    signature        = 0x1E 0x96 0x05;
-    has_jtag         = yes;
-#   stk500_devcode   = 0x??; # No STK500v1 support?
-#   avr910_devcode   = 0x??; # Try the ATmega16 one
-    avr910_devcode   = 0x74;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
+    id               = "m8u2";
+    desc             = "ATmega8U2";
+    has_jtag         = no;
+    has_debugwire    = yes;
+    signature        = 0x1e 0x93 0x89;
     chip_erase_delay = 9000;
+    reset            = io;
     pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
-                       "0 0 0 0  0 0 0 0    0 0 0 0  0 0 0 0";
-
-    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 0  0 0 0 0",
-                       "0 0 0 0  0 0 0 0    0 0 0 0  0 0 0 0";
-
-    timeout             = 200;
-    stabdelay           = 100;
-    cmdexedelay         = 25;
-    synchloops          = 32;
-    bytedelay           = 0;
-    pollindex           = 3;
-    pollvalue           = 0x53;
-    predelay            = 1;
-    postdelay           = 1;
-    pollmethod          = 1;
+                       "x x x x  x x x x    x x x x  x x x x";
+    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
+                       "x x x x  x x x x    x x x x  x x x x";
+    pagel            = 0xD7;
+    bs2              = 0xC6;
 
+    timeout		= 200;
+    stabdelay		= 100;
+    cmdexedelay		= 25;
+    synchloops		= 32;
+    bytedelay		= 0;
+    pollindex		= 3;
+    pollvalue		= 0x53;
+    predelay		= 1;
+    postdelay		= 1;
+    pollmethod		= 1;
     pp_controlstack     =
         0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
         0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
@@ -15034,151 +12278,146 @@ part
     programlockpulsewidth = 0;
     programlockpolltimeout = 5;
 
-    idr                 = 0x31;
-    spmcr               = 0x57;
-    allowfullpagebitstream = no;
+    ocdrev              = 1;
 
     memory "eeprom"
         paged           = no; /* leave this "no" */
-        page_size       = 8;  /* for parallel programming */
-        size            = 2048;
+        page_size       = 4;  /* for parallel programming */
+        size            = 512;
+        num_pages       = 128;
         min_write_delay = 9000;
         max_write_delay = 9000;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
+        readback_p1     = 0x00;
+        readback_p2     = 0x00;
         read            = "  1   0   1   0      0   0   0   0",
-                          "  0   0   0   0      0 a10  a9  a8",
+                          "  0   0   0   0    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  o   o   o   o      o   o   o   o";
 
         write           = "  1   1   0   0      0   0   0   0",
-                          "  0   0   0   0      0 a10  a9  a8",
+                          "  0   0   0   0    a11 a10  a9  a8",
                           " a7  a6  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
-        loadpage_lo     = "  1   1   0   0      0   0   0   1",
-                          "  0   0   0   0      0   0   0   0",
-                          "  0   0   0   0      0  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
+	loadpage_lo	= "  1   1   0   0      0   0   0   1",
+			  "  0   0   0   0      0   0   0   0",
+			  "  0   0   0   0      0   0  a1  a0",
+			  "  i   i   i   i      i   i   i   i";
 
-        writepage       = "  1   1   0   0      0   0   1   0",
-                          "  0   0   0   0      0 a10  a9  a8",
-                          " a7  a6  a5  a4     a3   0   0   0",
-                          "  x   x   x   x      x   x   x   x";
+	writepage	= "  1   1   0   0      0   0   1   0",
+                          "  0   0   0   0    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2   0   0",
+			  "  x   x   x   x      x   x   x   x";
 
-        mode            = 0x41;
-        delay           = 10;
-        blocksize       = 8;
-        readsize        = 256;
+	mode		= 0x41;
+	delay		= 20;
+	blocksize	= 4;
+	readsize	= 256;
       ;
 
     memory "flash"
         paged           = yes;
-        size            = 65536;
-        page_size       = 256;
-        num_pages       = 256;
+        size            = 8192;
+        page_size       = 64;
+        num_pages       = 128;
         min_write_delay = 4500;
         max_write_delay = 4500;
-        readback_p1     = 0xff;
-        readback_p2     = 0xff;
-        read_lo         = "   0   0   1   0      0   0   0   0",
-                          " a15 a14 a13 a12    a11 a10  a9  a8",
-                          "  a7  a6  a5  a4     a3  a2  a1  a0",
-                          "   o   o   o   o      o   o   o   o";
+        readback_p1     = 0x00;
+        readback_p2     = 0x00;
+        read_lo         = "  0   0   1   0      0   0   0   0",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
 
-        read_hi         = "   0   0   1   0      1   0   0   0",
-                          " a15 a14 a13 a12    a11 a10  a9  a8",
-                          "  a7  a6  a5  a4     a3  a2  a1  a0",
-                          "   o   o   o   o      o   o   o   o";
+        read_hi         = "  0   0   1   0      1   0   0   0",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6  a5  a4     a3  a2  a1  a0",
+                          "  o   o   o   o      o   o   o   o";
 
         loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0   0   0",
-                          "  a7 a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   0      0   0   0   0",
-                          "  a7 a6  a5  a4     a3  a2  a1  a0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
                           "  i   i   i   i      i   i   i   i";
 
-        writepage       = "   0   1   0   0      1   1   0   0",
-                          " a15 a14 a13 a12    a11 a10  a9  a8",
-                          "  a7  a6  a5  a4     a3  a2  a1  a0",
-                          "   0   0   0   0      0   0   0   0";
-
-        mode            = 0x41;
-        delay           = 10;
-        blocksize       = 128;
-        readsize        = 256;
-      ;
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  x   x   x   x      x   x   x   x",
+                          "  x   x  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
+        writepage       = "  0   1   0   0      1   1   0   0",
+                          "a15 a14 a13 a12    a11 a10  a9  a8",
+                          " a7  a6   x   x      x   x   x   x",
+                          "  x   x   x   x      x   x   x   x";
 
-        write           = "1 0 1 0  1 1 0 0   1 1 1 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
+	mode		= 0x41;
+	delay		= 6;
+	blocksize	= 64;
+	readsize	= 256;
       ;
 
     memory "lfuse"
         size            = 1;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
       ;
 
     memory "hfuse"
         size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  1 0 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
+        read            = "0 1 0 1  1 0 0 0  0 0 0 0  1 0 0 0",
+                          "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
       ;
 
     memory "efuse"
         size            = 1;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                          "x x x x  x x x x  i i i i  i i i i";
 
         read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0  o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "0 0 0 0  0 0 0 0  1 1 1 1  1 i i i";
+                          "x x x x  x x x x  o o o o  o o o o";
         min_write_delay = 9000;
         max_write_delay = 9000;
       ;
 
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  0   0  0  0  0",
-                          "0  0  0  0   0  0 a1 a0   o  o  o  o   o  o  o  o";
+    memory "lock"
+        size            = 1;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x   x x o o  o o o o";
+
+        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
+                          "x x x x  x x x x   1 1 i i  i i i i";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
       ;
 
     memory "calibration"
         size            = 1;
-
-        read            = "0 0 1 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-        ;
+        read            = "0 0 1 1  1 0 0 0    0 0 0 x  x x x x",
+                          "0 0 0 0  0 0 0 0    o o o o  o o o o";
+      ;
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
+                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
+      ;
   ;
-
 #------------------------------------------------------------
-# ATmega3250
+# ATmega325
 #------------------------------------------------------------
 
 part
-    id               = "m3250";
-    desc             = "ATMEGA3250";
-    signature        = 0x1E 0x95 0x06;
+    id               = "m325";
+    desc             = "ATmega325";
+    signature        = 0x1e 0x95 0x05;
     has_jtag         = yes;
 #   stk500_devcode   = 0x??; # No STK500v1 support?
 #   avr910_devcode   = 0x??; # Try the ATmega16 one
@@ -15227,6 +12466,8 @@ part
     spmcr               = 0x57;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 4;  /* for parallel programming */
@@ -15361,13 +12602,13 @@ part
   ;
 
 #------------------------------------------------------------
-# ATmega6450
+# ATmega645
 #------------------------------------------------------------
 
 part
-    id               = "m6450";
-    desc             = "ATMEGA6450";
-    signature        = 0x1E 0x96 0x06;
+    id               = "m645";
+    desc             = "ATmega645";
+    signature        = 0x1E 0x96 0x05;
     has_jtag         = yes;
 #   stk500_devcode   = 0x??; # No STK500v1 support?
 #   avr910_devcode   = 0x??; # Try the ATmega16 one
@@ -15416,6 +12657,8 @@ part
     spmcr               = 0x57;
     allowfullpagebitstream = no;
 
+    ocdrev              = 3;
+
     memory "eeprom"
         paged           = no; /* leave this "no" */
         page_size       = 8;  /* for parallel programming */
@@ -15446,7 +12689,7 @@ part
 
         mode            = 0x41;
         delay           = 10;
-        blocksize       = 4;
+        blocksize       = 8;
         readsize        = 256;
       ;
 
@@ -15465,353 +12708,135 @@ part
                           "   o   o   o   o      o   o   o   o";
 
         read_hi         = "   0   0   1   0      1   0   0   0",
-                          " a15 a14 a13 a12    a11 a10  a9  a8",
-                          "  a7  a6  a5  a4     a3  a2  a1  a0",
-                          "   o   o   o   o      o   o   o   o";
-
-        loadpage_lo     = "  0   1   0   0      0   0   0   0",
-                          "  0   0   0   0      0   0   0   0",
-                          "  a7 a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        loadpage_hi     = "  0   1   0   0      1   0   0   0",
-                          "  0   0   0   0      0   0   0   0",
-                          "  a7 a6  a5  a4     a3  a2  a1  a0",
-                          "  i   i   i   i      i   i   i   i";
-
-        writepage       = "   0   1   0   0      1   1   0   0",
-                          " a15 a14 a13 a12    a11 a10  a9  a8",
-                          "  a7  a6  a5  a4     a3  a2  a1  a0",
-                          "   0   0   0   0      0   0   0   0";
-
-        mode            = 0x41;
-        delay           = 10;
-        blocksize       = 128;
-        readsize        = 256;
-      ;
-
-    memory "lock"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "x x x x  x x x x   x x o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 1 1 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   1 1 i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "lfuse"
-        size            = 1;
-        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "hfuse"
-        size            = 1;
-        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "efuse"
-        size            = 1;
-
-        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
-                          "0 0 0 0  0 0 0 0  o o o o  o o o o";
-
-        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
-                          "0 0 0 0  0 0 0 0  1 1 1 1  1 i i i";
-        min_write_delay = 9000;
-        max_write_delay = 9000;
-      ;
-
-    memory "signature"
-        size            = 3;
-        read            = "0  0  1  1   0  0  0  0   0  0  0  0   0  0  0  0",
-                          "0  0  0  0   0  0 a1 a0   o  o  o  o   o  o  o  o";
-      ;
-
-    memory "calibration"
-        size            = 1;
-
-        read            = "0 0 1 1  1 0 0 0   0 0 0 0  0 0 0 0",
-                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
-        ;
-  ;
-
-#------------------------------------------------------------
-# ATXMEGA64A1
-#------------------------------------------------------------
-
-part
-    id		= "x64a1";
-    desc	= "ATXMEGA64A1";
-    signature	= 0x1e 0x96 0x4e;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
-
-    memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
-        page_size	= 0x20;
-        readsize	= 0x100;
-    ;
-
-    memory "application"
-        size		= 0x00010000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "apptable"
-        size		= 0x00001000;
-        offset		= 0x0080f000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "boot"
-        size		= 0x00001000;
-        offset		= 0x00810000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "flash"
-        size		= 0x00011000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "usersig"
-        size		= 0x200;
-        offset		= 0x8e0400;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
-
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
-    ;
-
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
-
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
-
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
-
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
-
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
-;
+                          " a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  a7  a6  a5  a4     a3  a2  a1  a0",
+                          "   o   o   o   o      o   o   o   o";
 
-#------------------------------------------------------------
-# ATXMEGA128A1
-#------------------------------------------------------------
+        loadpage_lo     = "  0   1   0   0      0   0   0   0",
+                          "  0   0   0   0      0   0   0   0",
+                          "  a7 a6  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-part
-    id		= "x128a1";
-    desc	= "ATXMEGA128A1";
-    signature	= 0x1e 0x97 0x4c;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+        loadpage_hi     = "  0   1   0   0      1   0   0   0",
+                          "  0   0   0   0      0   0   0   0",
+                          "  a7 a6  a5  a4     a3  a2  a1  a0",
+                          "  i   i   i   i      i   i   i   i";
 
-    memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
-        page_size	= 0x20;
-        readsize	= 0x100;
-    ;
+        writepage       = "   0   1   0   0      1   1   0   0",
+                          " a15 a14 a13 a12    a11 a10  a9  a8",
+                          "  a7  a6  a5  a4     a3  a2  a1  a0",
+                          "   0   0   0   0      0   0   0   0";
 
-    memory "application"
-        size		= 0x00020000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        mode            = 0x41;
+        delay           = 10;
+        blocksize       = 128;
+        readsize        = 256;
+      ;
 
-    memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0081e000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+    memory "lock"
+        size            = 1;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "x x x x  x x x x   x x o o  o o o o";
 
-    memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00820000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        write           = "1 0 1 0  1 1 0 0   1 1 1 0  0 0 0 0",
+                          "0 0 0 0  0 0 0 0   1 1 i i  i i i i";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
+      ;
 
-    memory "flash"
-        size		= 0x00022000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+    memory "lfuse"
+        size            = 1;
+        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
+                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
 
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
+                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
+      ;
 
-    memory "usersig"
-        size		= 0x200;
-        offset		= 0x8e0400;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+    memory "hfuse"
+        size            = 1;
+        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
+                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
+                          "0 0 0 0  0 0 0 0   i i i i  i i i i";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
+      ;
 
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
-    ;
+    memory "efuse"
+        size            = 1;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
+        read            = "0 1 0 1  0 0 0 0  0 0 0 0  1 0 0 0",
+                          "0 0 0 0  0 0 0 0  o o o o  o o o o";
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+        write           = "1 0 1 0  1 1 0 0  1 0 1 0  0 1 0 0",
+                          "0 0 0 0  0 0 0 0  1 1 1 1  1 i i i";
+        min_write_delay = 9000;
+        max_write_delay = 9000;
+      ;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+    memory "signature"
+        size            = 3;
+        read            = "0  0  1  1   0  0  0  0   0  0  0  0   0  0  0  0",
+                          "0  0  0  0   0  0 a1 a0   o  o  o  o   o  o  o  o";
+      ;
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+    memory "calibration"
+        size            = 1;
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
-;
+        read            = "0 0 1 1  1 0 0 0   0 0 0 0  0 0 0 0",
+                          "0 0 0 0  0 0 0 0   o o o o  o o o o";
+        ;
+  ;
 
 #------------------------------------------------------------
-# ATXMEGA128A1REVD
+# ATmega3250
 #------------------------------------------------------------
 
-part
-    id		= "x128a1d";
-    desc	= "ATXMEGA128A1REVD";
-    signature	= 0x1e 0x97 0x41;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
-
-    memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
-        page_size	= 0x20;
-        readsize	= 0x100;
-    ;
+part parent "m325"
+    id               = "m3250";
+    desc             = "ATmega3250";
+    signature        = 0x1E 0x95 0x06;
 
-    memory "application"
-        size		= 0x00020000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+    ocdrev              = 3;
+  ;
 
-    memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0081e000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+#------------------------------------------------------------
+# ATmega6450
+#------------------------------------------------------------
 
-    memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00820000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+part parent "m645"
+    id               = "m6450";
+    desc             = "ATmega6450";
+    signature        = 0x1E 0x96 0x06;
 
-    memory "flash"
-        size		= 0x00022000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+    ocdrev              = 3;
+  ;
 
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+#------------------------------------------------------------
+# AVR XMEGA family common values
+#------------------------------------------------------------
 
-    memory "usersig"
-        size		= 0x200;
-        offset		= 0x8e0400;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+part
+    id		= ".xmega";
+    desc	= "AVR XMEGA family common values";
+    has_pdi	= yes;
+    nvm_base	= 0x01c0;
+    mcu_base	= 0x0090;
 
     memory "signature"
         size		= 3;
         offset		= 0x1000090;
     ;
 
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
+    memory "prodsig"
+        size		= 0x32;
+        offset		= 0x8e0200;
+        page_size	= 0x32;
+        readsize	= 0x32;
     ;
 
     memory "fuse1"
@@ -15838,1114 +12863,1311 @@ part
         size		= 1;
         offset		= 0x8f0027;
     ;
+
+    memory "data"
+        # SRAM, only used to supply the offset
+        offset		= 0x1000000;
+    ;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA192A1
+# ATxmega16A4U
 #------------------------------------------------------------
 
-part
-    id		= "x192a1";
-    desc	= "ATXMEGA192A1";
-    signature	= 0x1e 0x97 0x4e;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent ".xmega"
+    id		= "x16a4u";
+    desc	= "ATxmega16A4U";
+    signature	= 0x1e 0x94 0x41;
 
     memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
+        size		= 0x400;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00030000;
-        offset		= 0x0800000;
+        size		= 0x4000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0082e000;
+        size		= 0x1000;
+        offset		= 0x803000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00830000;
+        size		= 0x1000;
+        offset		= 0x804000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00032000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
+        size		= 0x5000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "usersig"
-        size		= 0x200;
+        size		= 0x100;
         offset		= 0x8e0400;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+#------------------------------------------------------------
+# ATxmega16C4
+#------------------------------------------------------------
 
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
-    ;
+part parent "x16a4u"
+    id		= "x16c4";
+    desc	= "ATxmega16C4";
+    signature	= 0x1e 0x95 0x44;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
+#------------------------------------------------------------
+# ATxmega16D4
+#------------------------------------------------------------
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+part parent "x16a4u"
+    id		= "x16d4";
+    desc	= "ATxmega16D4";
+    signature	= 0x1e 0x94 0x42;
+;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+#------------------------------------------------------------
+# ATxmega16A4
+#------------------------------------------------------------
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+part parent "x16a4u"
+    id		= "x16a4";
+    desc	= "ATxmega16A4";
+    signature	= 0x1e 0x94 0x41;
+    has_jtag	= yes;
 
-    memory "lock"
+    memory "fuse0"
         size		= 1;
-        offset		= 0x8f0027;
+        offset		= 0x8f0020;
     ;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA256A1
+# ATxmega32A4U
 #------------------------------------------------------------
 
-part
-    id		= "x256a1";
-    desc	= "ATXMEGA256A1";
-    signature	= 0x1e 0x98 0x46;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent ".xmega"
+    id		= "x32a4u";
+    desc	= "ATxmega32A4U";
+    signature	= 0x1e 0x95 0x41;
 
     memory "eeprom"
-        size		= 0x1000;
-        offset		= 0x08c0000;
+        size		= 0x400;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00040000;
-        offset		= 0x0800000;
+        size		= 0x8000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0083e000;
+        size		= 0x1000;
+        offset		= 0x807000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00840000;
+        size		= 0x1000;
+        offset		= 0x808000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00042000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
+        size		= 0x9000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "usersig"
-        size		= 0x200;
+        size		= 0x100;
         offset		= 0x8e0400;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+#------------------------------------------------------------
+# ATxmega32C4
+#------------------------------------------------------------
 
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
-    ;
+part parent "x32a4u"
+    id		= "x32c4";
+    desc	= "ATxmega32C4";
+    signature	= 0x1e 0x94 0x43;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
+#------------------------------------------------------------
+# ATxmega32D4
+#------------------------------------------------------------
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+part parent "x32a4u"
+    id		= "x32d4";
+    desc	= "ATxmega32D4";
+    signature	= 0x1e 0x95 0x42;
+;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+#------------------------------------------------------------
+# ATxmega32A4
+#------------------------------------------------------------
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+part parent "x32a4u"
+    id		= "x32a4";
+    desc	= "ATxmega32A4";
+    signature	= 0x1e 0x95 0x41;
+    has_jtag	= yes;
 
-    memory "lock"
+    memory "fuse0"
         size		= 1;
-        offset		= 0x8f0027;
+        offset		= 0x8f0020;
     ;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA64A3
+# ATxmega64A4U
 #------------------------------------------------------------
 
-part
-    id		= "x64a3";
-    desc	= "ATXMEGA64A3";
-    signature	= 0x1e 0x96 0x42;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent ".xmega"
+    id		= "x64a4u";
+    desc	= "ATxmega64A4U";
+    signature	= 0x1e 0x96 0x46;
 
     memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
+        size		= 0x800;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00010000;
-        offset		= 0x0800000;
+        size		= 0x10000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00001000;
-        offset		= 0x0080f000;
+        size		= 0x1000;
+        offset		= 0x80f000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00001000;
-        offset		= 0x00810000;
+        size		= 0x1000;
+        offset		= 0x810000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00011000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
+        size		= 0x11000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "usersig"
-        size		= 0x200;
+        size		= 0x100;
         offset		= 0x8e0400;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+#------------------------------------------------------------
+# ATxmega64C3
+#------------------------------------------------------------
+
+part parent "x64a4u"
+    id		= "x64c3";
+    desc	= "ATxmega64C3";
+    signature	= 0x1e 0x96 0x49;
+;
+
+#------------------------------------------------------------
+# ATxmega64D3
+#------------------------------------------------------------
+
+part parent "x64a4u"
+    id		= "x64d3";
+    desc	= "ATxmega64D3";
+    signature	= 0x1e 0x96 0x4a;
+;
+
+#------------------------------------------------------------
+# ATxmega64D4
+#------------------------------------------------------------
+
+part parent "x64a4u"
+    id		= "x64d4";
+    desc	= "ATxmega64D4";
+    signature	= 0x1e 0x96 0x47;
+;
+
+#------------------------------------------------------------
+# ATxmega64A1
+#------------------------------------------------------------
+
+part parent "x64a4u"
+    id		= "x64a1";
+    desc	= "ATxmega64A1";
+    signature	= 0x1e 0x96 0x4e;
+    has_jtag	= yes;
 
     memory "fuse0"
         size		= 1;
         offset		= 0x8f0020;
     ;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
+#------------------------------------------------------------
+# ATxmega64A1U
+#------------------------------------------------------------
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+part parent "x64a1"
+    id		= "x64a1u";
+    desc	= "ATxmega64A1U";
+    signature	= 0x1e 0x96 0x4e;
+;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+#------------------------------------------------------------
+# ATxmega64A3
+#------------------------------------------------------------
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+part parent "x64a1"
+    id		= "x64a3";
+    desc	= "ATxmega64A3";
+    signature	= 0x1e 0x96 0x42;
+;
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
+#------------------------------------------------------------
+# ATxmega64A3U
+#------------------------------------------------------------
+
+part parent "x64a1"
+    id		= "x64a3u";
+    desc	= "ATxmega64A3U";
+    signature	= 0x1e 0x96 0x42;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA128A3
+# ATxmega64A4
 #------------------------------------------------------------
 
-part
-    id		= "x128a3";
-    desc	= "ATXMEGA128A3";
-    signature	= 0x1e 0x97 0x42;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent "x64a1"
+    id		= "x64a4";
+    desc	= "ATxmega64A4";
+    signature	= 0x1e 0x96 0x46;
+;
+
+#------------------------------------------------------------
+# ATxmega64B1
+#------------------------------------------------------------
+
+part parent "x64a1"
+    id		= "x64b1";
+    desc	= "ATxmega64B1";
+    signature	= 0x1e 0x96 0x52;
+;
+
+#------------------------------------------------------------
+# ATxmega64B3
+#------------------------------------------------------------
+
+part parent "x64a1"
+    id		= "x64b3";
+    desc	= "ATxmega64B3";
+    signature	= 0x1e 0x96 0x51;
+;
+
+#------------------------------------------------------------
+# ATxmega128C3
+#------------------------------------------------------------
+
+part parent ".xmega"
+    id		= "x128c3";
+    desc	= "ATxmega128C3";
+    signature	= 0x1e 0x97 0x52;
 
     memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
+        size		= 0x800;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00020000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
+        size		= 0x20000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0081e000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x81e000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00820000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x820000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00022000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
+        size		= 0x22000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "usersig"
         size		= 0x200;
         offset		= 0x8e0400;
-        page_size	= 0x100;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+#------------------------------------------------------------
+# ATxmega128D3
+#------------------------------------------------------------
+
+part parent "x128c3"
+    id		= "x128d3";
+    desc	= "ATxmega128D3";
+    signature	= 0x1e 0x97 0x48;
+;
+
+#------------------------------------------------------------
+# ATxmega128D4
+#------------------------------------------------------------
+
+part parent "x128c3"
+    id		= "x128d4";
+    desc	= "ATxmega128D4";
+    signature	= 0x1e 0x97 0x47;
+;
+
+#------------------------------------------------------------
+# ATxmega128A1
+#------------------------------------------------------------
+
+part parent "x128c3"
+    id		= "x128a1";
+    desc	= "ATxmega128A1";
+    signature	= 0x1e 0x97 0x4c;
+    has_jtag	= yes;
 
     memory "fuse0"
         size		= 1;
         offset		= 0x8f0020;
     ;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
+#------------------------------------------------------------
+# ATxmega128A1 revision D
+#------------------------------------------------------------
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+part parent "x128a1"
+    id		= "x128a1d";
+    desc	= "ATxmega128A1revD";
+    signature	= 0x1e 0x97 0x41;
+;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+#------------------------------------------------------------
+# ATxmega128A1U
+#------------------------------------------------------------
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+part parent "x128a1"
+    id		= "x128a1u";
+    desc	= "ATxmega128A1U";
+    signature	= 0x1e 0x97 0x4c;
+;
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
+#------------------------------------------------------------
+# ATxmega128A3
+#------------------------------------------------------------
+
+part parent "x128a1"
+    id		= "x128a3";
+    desc	= "ATxmega128A3";
+    signature	= 0x1e 0x97 0x42;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA192A3
+# ATxmega128A3U
 #------------------------------------------------------------
 
-part
-    id		= "x192a3";
-    desc	= "ATXMEGA192A3";
-    signature	= 0x1e 0x97 0x44;
+part parent "x128a1"
+    id		= "x128a3u";
+    desc	= "ATxmega128A3U";
+    signature	= 0x1e 0x97 0x42;
+;
+
+#------------------------------------------------------------
+# ATxmega128A4
+#------------------------------------------------------------
+
+part parent ".xmega"
+    id		= "x128a4";
+    desc	= "ATxmega128A4";
+    signature	= 0x1e 0x97 0x46;
     has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
 
     memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
+        size		= 0x800;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00030000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
+        size		= 0x20000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0082e000;
-        page_size	= 0x100;
+        size		= 0x1000;
+        offset		= 0x81f000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00830000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x820000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00032000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
+        size		= 0x22000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "usersig"
         size		= 0x200;
         offset		= 0x8e0400;
-        page_size	= 0x100;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
-
     memory "fuse0"
         size		= 1;
         offset		= 0x8f0020;
     ;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
+#------------------------------------------------------------
+# ATxmega128A4U
+#------------------------------------------------------------
+
+part parent ".xmega"
+    id		= "x128a4u";
+    desc	= "ATxmega128A4U";
+    signature	= 0x1e 0x97 0x46;
+
+    memory "eeprom"
+        size		= 0x800;
+        offset		= 0x8c0000;
+        page_size	= 0x20;
+        readsize	= 0x100;
     ;
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
+    memory "application"
+        size		= 0x20000;
+        offset		= 0x800000;
+        page_size	= 0x100;
+        readsize	= 0x100;
     ;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
+    memory "apptable"
+        size		= 0x1000;
+        offset		= 0x81f000;
+        page_size	= 0x100;
+        readsize	= 0x100;
     ;
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
+    memory "boot"
+        size		= 0x2000;
+        offset		= 0x820000;
+        page_size	= 0x100;
+        readsize	= 0x100;
     ;
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
+    memory "flash"
+        size		= 0x22000;
+        offset		= 0x800000;
+        page_size	= 0x100;
+        readsize	= 0x100;
+    ;
+
+    memory "usersig"
+        size		= 0x100;
+        offset		= 0x8e0400;
+        page_size	= 0x100;
+        readsize	= 0x100;
     ;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA256A3
+# ATxmega128B1
 #------------------------------------------------------------
 
-part
-    id		= "x256a3";
-    desc	= "ATXMEGA256A3";
-    signature	= 0x1e 0x98 0x42;
+part parent ".xmega"
+    id		= "x128b1";
+    desc	= "ATxmega128B1";
+    signature	= 0x1e 0x97 0x4d;
     has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
 
     memory "eeprom"
-        size		= 0x1000;
-        offset		= 0x08c0000;
+        size		= 0x800;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00040000;
-        offset		= 0x0800000;
+        size		= 0x20000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0083e000;
+        size		= 0x2000;
+        offset		= 0x81e000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00840000;
+        size		= 0x2000;
+        offset		= 0x820000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00042000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
+        size		= 0x22000;
+        offset		= 0x800000;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
     memory "usersig"
-        size		= 0x200;
+        size		= 0x100;
         offset		= 0x8e0400;
         page_size	= 0x100;
         readsize	= 0x100;
     ;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
-
     memory "fuse0"
         size		= 1;
         offset		= 0x8f0020;
     ;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
-
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
-
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
-
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+#------------------------------------------------------------
+# ATxmega128B3
+#------------------------------------------------------------
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
+part parent "x128b1"
+    id		= "x128b3";
+    desc	= "ATxmega128B3";
+    signature	= 0x1e 0x97 0x4b;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA256A3B
+# ATxmega192C3
 #------------------------------------------------------------
 
-part
-    id		= "x256a3b";
-    desc	= "ATXMEGA256A3B";
-    signature	= 0x1e 0x98 0x43;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent ".xmega"
+    id		= "x192c3";
+    desc	= "ATxmega192C3";
+    signature	= 0x1e 0x97 0x51;
 
     memory "eeprom"
-        size		= 0x1000;
-        offset		= 0x08c0000;
+        size		= 0x800;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00040000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
+        size		= 0x30000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0083e000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x82e000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00840000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x830000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00042000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
+        size		= 0x32000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "usersig"
         size		= 0x200;
         offset		= 0x8e0400;
-        page_size	= 0x100;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+#------------------------------------------------------------
+# ATxmega192D3
+#------------------------------------------------------------
+
+part parent "x192c3"
+    id		= "x192d3";
+    desc	= "ATxmega192D3";
+    signature	= 0x1e 0x97 0x49;
+;
+
+#------------------------------------------------------------
+# ATxmega192A1
+#------------------------------------------------------------
+
+part parent "x192c3"
+    id		= "x192a1";
+    desc	= "ATxmega192A1";
+    signature	= 0x1e 0x97 0x4e;
+    has_jtag	= yes;
 
     memory "fuse0"
         size		= 1;
         offset		= 0x8f0020;
     ;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
-
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+#------------------------------------------------------------
+# ATxmega192A3
+#------------------------------------------------------------
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+part parent "x192a1"
+    id		= "x192a3";
+    desc	= "ATxmega192A3";
+    signature	= 0x1e 0x97 0x44;
+;
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+#------------------------------------------------------------
+# ATxmega192A3U
+#------------------------------------------------------------
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
+part parent "x192a1"
+    id		= "x192a3u";
+    desc	= "ATxmega192A3U";
+    signature	= 0x1e 0x97 0x44;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA16A4
+# ATxmega256C3
 #------------------------------------------------------------
 
-part
-    id		= "x16a4";
-    desc	= "ATXMEGA16A4";
-    signature	= 0x1e 0x94 0x41;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent ".xmega"
+    id		= "x256c3";
+    desc	= "ATxmega256C3";
+    signature	= 0x1e 0x98 0x46;
 
     memory "eeprom"
-        size		= 0x0400;
-        offset		= 0x08c0000;
+        size		= 0x1000;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00004000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
+        size		= 0x40000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00001000;
-        offset		= 0x00803000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x83e000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00001000;
-        offset		= 0x00804000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x840000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00005000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
+        size		= 0x42000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "usersig"
         size		= 0x200;
         offset		= 0x8e0400;
-        page_size	= 0x100;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+#------------------------------------------------------------
+# ATxmega256D3
+#------------------------------------------------------------
+
+part parent "x256c3"
+    id		= "x256d3";
+    desc	= "ATxmega256D3";
+    signature	= 0x1e 0x98 0x44;
+;
+
+#------------------------------------------------------------
+# ATxmega256A1
+#------------------------------------------------------------
+
+part parent "x256c3"
+    id		= "x256a1";
+    desc	= "ATxmega256A1";
+    signature	= 0x1e 0x98 0x46;
+    has_jtag	= yes;
 
     memory "fuse0"
         size		= 1;
         offset		= 0x8f0020;
     ;
+;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
+#------------------------------------------------------------
+# ATxmega256A3
+#------------------------------------------------------------
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+part parent "x256a1"
+    id		= "x256a3";
+    desc	= "ATxmega256A3";
+    signature	= 0x1e 0x98 0x42;
+;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+#------------------------------------------------------------
+# ATxmega256A3U
+#------------------------------------------------------------
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+part parent "x256a1"
+    id		= "x256a3u";
+    desc	= "ATxmega256A3U";
+    signature	= 0x1e 0x98 0x42;
+;
+
+#------------------------------------------------------------
+# ATxmega256A3B
+#------------------------------------------------------------
+
+part parent "x256a1"
+    id		= "x256a3b";
+    desc	= "ATxmega256A3B";
+    signature	= 0x1e 0x98 0x43;
+;
+
+#------------------------------------------------------------
+# ATxmega256A3BU
+#------------------------------------------------------------
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
+part parent "x256a1"
+    id		= "x256a3bu";
+    desc	= "ATxmega256A3BU";
+    signature	= 0x1e 0x98 0x43;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA32A4
+# ATxmega384C3
 #------------------------------------------------------------
 
-part
-    id		= "x32a4";
-    desc	= "ATXMEGA32A4";
-    signature	= 0x1e 0x95 0x41;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent ".xmega"
+    id		= "x384c3";
+    desc	= "ATxmega384C3";
+    signature	= 0x1e 0x98 0x45;
 
     memory "eeprom"
-        size		= 0x0400;
-        offset		= 0x08c0000;
+        size		= 0x1000;
+        offset		= 0x8c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00008000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
+        size		= 0x60000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00001000;
-        offset		= 0x00807000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x85e000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00001000;
-        offset		= 0x00808000;
-        page_size	= 0x100;
+        size		= 0x2000;
+        offset		= 0x860000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00009000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
-
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
+        size		= 0x62000;
+        offset		= 0x800000;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
 
     memory "usersig"
         size		= 0x200;
         offset		= 0x8e0400;
-        page_size	= 0x100;
+        page_size	= 0x200;
         readsize	= 0x100;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+#------------------------------------------------------------
+# ATxmega384D3
+#------------------------------------------------------------
 
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
+part parent "x384c3"
+    id		= "x384d3";
+    desc	= "ATxmega384D3";
+    signature	= 0x1e 0x98 0x47;
+;
+
+#------------------------------------------------------------
+# ATxmega8E5
+#------------------------------------------------------------
+
+part parent ".xmega"
+    id		= "x8e5";
+    desc	= "ATxmega8E5";
+    signature	= 0x1e 0x93 0x41;
+
+    memory "eeprom"
+        size		= 0x0200;
+        offset		= 0x08c0000;
+        page_size	= 0x20;
+        readsize	= 0x100;
     ;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
+    memory "application"
+        size		= 0x2000;
+        offset		= 0x0800000;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
+    memory "apptable"
+        size		= 0x800;
+        offset		= 0x00801800;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
+    memory "boot"
+        size		= 0x800;
+        offset		= 0x00804000;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
+    memory "flash"
+        size		= 0x2800;
+        offset		= 0x0800000;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
+    memory "usersig"
+        size            = 0x80;
+        offset          = 0x8e0400;
+        page_size       = 0x80;
+        readsize	= 0x100;
     ;
 ;
 
 #------------------------------------------------------------
-# ATXMEGA64A4
+# ATxmega16E5
 #------------------------------------------------------------
 
-part
-    id		= "x64a4";
-    desc	= "ATXMEGA64A4";
-    signature	= 0x1e 0x96 0x46;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+part parent ".xmega"
+    id		= "x16e5";
+    desc	= "ATxmega16E5";
+    signature	= 0x1e 0x94 0x45;
 
     memory "eeprom"
-        size		= 0x0800;
+        size		= 0x0200;
         offset		= 0x08c0000;
         page_size	= 0x20;
         readsize	= 0x100;
     ;
 
     memory "application"
-        size		= 0x00010000;
+        size		= 0x4000;
         offset		= 0x0800000;
-        page_size	= 0x100;
+        page_size	= 0x80;
         readsize	= 0x100;
     ;
 
     memory "apptable"
-        size		= 0x00001000;
-        offset		= 0x0080f000;
-        page_size	= 0x100;
+        size		= 0x1000;
+        offset		= 0x00803000;
+        page_size	= 0x80;
         readsize	= 0x100;
     ;
 
     memory "boot"
-        size		= 0x00001000;
-        offset		= 0x00810000;
-        page_size	= 0x100;
+        size		= 0x1000;
+        offset		= 0x00804000;
+        page_size	= 0x80;
         readsize	= 0x100;
     ;
 
     memory "flash"
-        size		= 0x00011000;
+        size		= 0x5000;
         offset		= 0x0800000;
-        page_size	= 0x100;
+        page_size	= 0x80;
         readsize	= 0x100;
     ;
 
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
+    memory "usersig"
+        size            = 0x80;
+        offset          = 0x8e0400;
+        page_size       = 0x80;
         readsize	= 0x100;
     ;
+;
 
-    memory "usersig"
-        size		= 0x200;
-        offset		= 0x8e0400;
-        page_size	= 0x100;
+#------------------------------------------------------------
+# ATxmega32E5
+#------------------------------------------------------------
+
+part parent ".xmega"
+    id		= "x32e5";
+    desc	= "ATxmega32E5";
+    signature	= 0x1e 0x95 0x4c;
+
+    memory "eeprom"
+        size		= 0x0400;
+        offset		= 0x08c0000;
+        page_size	= 0x20;
         readsize	= 0x100;
     ;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
+    memory "application"
+        size		= 0x8000;
+        offset		= 0x0800000;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
+    memory "apptable"
+        size		= 0x1000;
+        offset		= 0x00807000;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
+    memory "boot"
+        size		= 0x1000;
+        offset		= 0x00804000;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
+    memory "flash"
+        size		= 0x9000;
+        offset		= 0x0800000;
+        page_size	= 0x80;
+        readsize	= 0x100;
     ;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
+    memory "usersig"
+        size            = 0x80;
+        offset          = 0x8e0400;
+        page_size       = 0x80;
+        readsize	= 0x100;
     ;
+;
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+#------------------------------------------------------------
+# AVR32UC3A0512
+#------------------------------------------------------------
 
-    memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
+part
+    id		= "uc3a0512";
+    desc	= "AT32UC3A0512";
+    signature	= 0xED 0xC0 0x3F;
+    has_jtag	= yes;
+    is_avr32	= yes;
+
+    memory "flash"
+        paged           = yes;
+        page_size       = 512;           # bytes
+        readsize        = 512;           # bytes
+        num_pages       = 1024;          # could be set dynamicly
+        size            = 0x00080000;    # could be set dynamicly
+        offset          = 0x80000000;
     ;
 ;
 
+part parent "uc3a0512"
+    id		= "ucr2";
+    desc	= "deprecated, use 'uc3a0512'";
+;
+
 #------------------------------------------------------------
-# ATXMEGA128A4
+# ATtiny1634.
 #------------------------------------------------------------
 
 part
-    id		= "x128a4";
-    desc	= "ATXMEGA128A4";
-    signature	= 0x1e 0x97 0x46;
-    has_jtag	= yes;
-    has_pdi	= yes;
-    nvm_base	= 0x01c0;
+    id              = "t1634";
+    desc            = "ATtiny1634";
+     has_debugwire = yes;
+     flash_instr   = 0xB6, 0x01, 0x11;
+     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
+                0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
+                0x99, 0xF9, 0xBB, 0xAF;
+    stk500_devcode  = 0x86;
+    # avr910_devcode = 0x;
+    signature       = 0x1e 0x94 0x12;
+    pagel           = 0xB3;
+    bs2             = 0xB1;
+    reset	    = io;
+    chip_erase_delay = 9000;
+    pgm_enable       = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
+                       "x x x x x x x x x x x x x x x x";
+
+    chip_erase       = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
+                       "x x x x x x x x x x x x x x x x";
+
+    timeout         = 200;
+    stabdelay       = 100;
+    cmdexedelay     = 25;
+    synchloops      = 32;
+    bytedelay       = 0;
+    pollindex       = 3;
+    pollvalue       = 0x53;
+    predelay        = 1;
+    postdelay       = 1;
+    pollmethod      = 1;
+
+    pp_controlstack     =
+        0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E,
+        0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E,
+        0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A,
+        0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+    hventerstabdelay    = 100;
+    progmodedelay       = 0;
+    latchcycles         = 0;
+    togglevtg           = 1;
+    poweroffdelay       = 15;
+    resetdelayms        = 1;
+    resetdelayus        = 0;
+    hvleavestabdelay    = 15;
+    resetdelay          = 15;
+    chiperasepulsewidth = 0;
+    chiperasepolltimeout = 10;
+    programfusepulsewidth = 0;
+    programfusepolltimeout = 5;
+    programlockpulsewidth = 0;
+    programlockpolltimeout = 5;
 
     memory "eeprom"
-        size		= 0x0800;
-        offset		= 0x08c0000;
-        page_size	= 0x20;
-        readsize	= 0x100;
-    ;
+        paged           = no;
+        page_size       = 4;
+        size            = 256;
+        min_write_delay = 3600;
+        max_write_delay = 3600;
+        readback_p1     = 0xff;
+        readback_p2     = 0xff;
+        read            = " 1 0 1 0 0 0 0 0",
+                          " 0 0 0 x x x x a8",
+                          " a7 a6 a5 a4 a3 a2 a1 a0",
+                          " o o o o o o o o";
 
-    memory "application"
-        size		= 0x00020000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        write           = " 1 1 0 0 0 0 0 0",
+                          " 0 0 0 x x x x a8",
+                          " a7 a6 a5 a4 a3 a2 a1 a0",
+                          " i i i i i i i i";
+
+   loadpage_lo   = "  1   1   0   0      0   0   0   1",
+           "  0   0   0   0      0   0   0   0",
+           "  0   0   0   0      0   0  a1  a0",
+           "  i   i   i   i      i   i   i   i";
+
+   writepage   = "  1   1   0   0      0   0   1   0",
+           "  0   0   x   x      x   x   x  a8",
+           " a7  a6  a5  a4     a3  a2   0   0",
+           "  x   x   x   x      x   x   x   x";
+
+   mode      = 0x41;
+   delay      = 5;
+   blocksize   = 4;
+   readsize   = 256;
+        ;
+
+    memory "flash"
+        paged           = yes;
+        size            = 16384;
+        page_size       = 32;
+        num_pages       = 512;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        readback_p1     = 0xff;
+        readback_p2     = 0xff;
+        read_lo         = " 0 0 1 0 0 0 0 0",
+                          " 0 0 0 a12 a11 a10 a9 a8",
+                          " a7 a6 a5 a4 a3 a2 a1 a0",
+                          " o o o o o o o o";
+
+        read_hi          = " 0 0 1 0 1 0 0 0",
+                           " 0 0 0 a12 a11 a10 a9 a8",
+                           " a7 a6 a5 a4 a3 a2 a1 a0",
+                           " o o o o o o o o";
 
-    memory "apptable"
-        size		= 0x00002000;
-        offset		= 0x0081e000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        loadpage_lo     = " 0 1 0 0 0 0 0 0",
+                          " 0 0 0 x x x x x",
+                          " x x a5 a4 a3 a2 a1 a0",
+                          " i i i i i i i i";
 
-    memory "boot"
-        size		= 0x00002000;
-        offset		= 0x00820000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        loadpage_hi     = " 0 1 0 0 1 0 0 0",
+                          " 0 0 0 x x x x x",
+                          " x x a5 a4 a3 a2 a1 a0",
+                          " i i i i i i i i";
 
-    memory "flash"
-        size		= 0x00022000;
-        offset		= 0x0800000;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        writepage       = " 0 1 0 0 1 1 0 0",
+                          " 0 0 0 a12 a11 a10 a9 a8",
+                          " a7 a6 x x x x x x",
+                          " x x x x x x x x";
 
-    memory "prodsig"
-        size		= 0x200;
-        offset		= 0x8e0200;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        mode        = 0x41;
+        delay       = 6;
+        blocksize   = 128;
+        readsize    = 256;
 
-    memory "usersig"
-        size		= 0x200;
-        offset		= 0x8e0400;
-        page_size	= 0x100;
-        readsize	= 0x100;
-    ;
+        ;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x1000090;
-    ;
+    memory "lfuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
+                          "x x x x x x x x o o o o o o o o";
 
-    memory "fuse0"
-        size		= 1;
-        offset		= 0x8f0020;
-    ;
+        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
+                          "x x x x x x x x i i i i i i i i";
+        ;
 
-    memory "fuse1"
-        size		= 1;
-        offset		= 0x8f0021;
-    ;
+    memory "hfuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
+                          "x x x x x x x x o o o o o o o o";
 
-    memory "fuse2"
-        size		= 1;
-        offset		= 0x8f0022;
-    ;
+        write           = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
+                          "x x x x x x x x i i i i i i i i";
+        ;
 
-    memory "fuse4"
-        size		= 1;
-        offset		= 0x8f0024;
-    ;
+    memory "efuse"
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
+                          "x x x x x x x x x x x o o o o o";
 
-    memory "fuse5"
-        size		= 1;
-        offset		= 0x8f0025;
-    ;
+        write           = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
+                          "x x x x x x x x x x x i i i i i";
+        ;
 
     memory "lock"
-        size		= 1;
-        offset		= 0x8f0027;
-    ;
-;
-
+        size            = 1;
+        min_write_delay = 4500;
+        max_write_delay = 4500;
+        read            = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+                          "x x x x x x x x x x x x x x o o";
 
-#------------------------------------------------------------
-# AVR32UC3A0512
-#------------------------------------------------------------
+        write           = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
+                          "x x x x x x x x 1 1 1 1 1 1 i i";
+        ;
 
-part
-    id		= "ucr2";
-    desc	= "32UC3A0512";
-    signature	= 0xED 0xC0 0x3F;
-    has_jtag	= yes;
-    is_avr32    = yes;
+    memory "calibration"
+        size            = 1;
+        read            = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
+                          "0 0 0 0 0 0 0 0 o o o o o o o o";
+        ;
 
-    memory "flash"
-        paged           = yes;
-        page_size		= 512;               # bytes
-        readsize		= 512;				 # bytes
-        num_pages       = 1024;              # could be set dynamicly
-        size			= 0x00080000;		 # could be set dynamicly
-        offset			= 0x80000000;
-    ;
+    memory "signature"
+        size            = 3;
+        read            = "0 0 1 1 0 0 0 0 0 0 0 x x x x x",
+                          "x x x x x x a1 a0 o o o o o o o o";
+        ;
 ;
 
 #------------------------------------------------------------
-# ATtiny4
+# Common values for reduced core tinys (4/5/9/10/20/40)
 #------------------------------------------------------------
 
 part
-    id		= "t4";
-    desc	= "ATtiny4";
-    signature	= 0x1e 0x8f 0x0a;
+    id		= ".reduced_core_tiny";
+    desc	= "Common values for reduced core tinys";
     has_tpi	= yes;
 
-    memory "flash"
-        size		= 512;
-        offset		= 0x4000;
-        page_size	= 16;
-        blocksize	= 128;
-    ;
-
     memory "signature"
         size		= 3;
         offset		= 0x3fc0;
@@ -16972,16 +14194,14 @@ part
     ;
 ;
 
-
 #------------------------------------------------------------
-# ATtiny5
+# ATtiny4
 #------------------------------------------------------------
 
-part
-    id		= "t5";
-    desc	= "ATtiny5";
-    signature	= 0x1e 0x8f 0x09;
-    has_tpi	= yes;
+part parent ".reduced_core_tiny"
+    id		= "t4";
+    desc	= "ATtiny4";
+    signature	= 0x1e 0x8f 0x0a;
 
     memory "flash"
         size		= 512;
@@ -16989,43 +14209,26 @@ part
         page_size	= 16;
         blocksize	= 128;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x3fc0;
-        page_size	= 16;
-    ;
-
-    memory "fuse"
-        size		= 1;
-        offset		= 0x3f40;
-        page_size	= 16;
-	blocksize	= 4;
-    ;
-
-    memory "calibration"
-        size		= 1;
-        offset		= 0x3f80;
-        page_size	= 16;
-    ;
+#------------------------------------------------------------
+# ATtiny5
+#------------------------------------------------------------
 
-    memory "lockbits"
-        size		= 1;
-        offset		= 0x3f00;
-        page_size	= 16;
-    ;
+part parent "t4"
+    id		= "t5";
+    desc	= "ATtiny5";
+    signature	= 0x1e 0x8f 0x09;
 ;
 
-
 #------------------------------------------------------------
 # ATtiny9
 #------------------------------------------------------------
 
-part
+part parent ".reduced_core_tiny"
     id		= "t9";
     desc	= "ATtiny9";
     signature	= 0x1e 0x90 0x08;
-    has_tpi	= yes;
 
     memory "flash"
         size		= 1024;
@@ -17033,74 +14236,114 @@ part
         page_size	= 16;
         blocksize	= 128;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x3fc0;
-        page_size	= 16;
-    ;
+#------------------------------------------------------------
+# ATtiny10
+#------------------------------------------------------------
 
-    memory "fuse"
-        size		= 1;
-        offset		= 0x3f40;
-        page_size	= 16;
-	blocksize	= 4;
-    ;
+part parent "t9"
+    id		= "t10";
+    desc	= "ATtiny10";
+    signature	= 0x1e 0x90 0x03;
+;
 
-    memory "calibration"
-        size		= 1;
-        offset		= 0x3f80;
-        page_size	= 16;
-    ;
+#------------------------------------------------------------
+# ATtiny20
+#------------------------------------------------------------
 
-    memory "lockbits"
-        size		= 1;
-        offset		= 0x3f00;
-        page_size	= 16;
+part parent ".reduced_core_tiny"
+    id          = "t20";
+    desc        = "ATtiny20";
+    signature   = 0x1e 0x91 0x0F;
+
+    memory "flash"
+        size            = 2048;
+        offset          = 0x4000;
+        page_size       = 16;
+        blocksize       = 128;
     ;
 ;
 
-
 #------------------------------------------------------------
-# ATtiny10
+# ATtiny40
 #------------------------------------------------------------
 
-part
-    id		= "t10";
-    desc	= "ATtiny10";
-    signature	= 0x1e 0x90 0x03;
-    has_tpi	= yes;
+part parent ".reduced_core_tiny"
+    id		= "t40";
+    desc	= "ATtiny40";
+    signature	= 0x1e 0x92 0x0E;
 
     memory "flash"
-        size		= 1024;
+        size		= 4096;
         offset		= 0x4000;
-        page_size	= 16;
+        page_size	= 64;
         blocksize	= 128;
     ;
+;
 
-    memory "signature"
-        size		= 3;
-        offset		= 0x3fc0;
-        page_size	= 16;
+#------------------------------------------------------------
+# ATmega406
+#------------------------------------------------------------
+
+part
+    id				= "m406";
+    desc			= "ATMEGA406";
+    has_jtag			= yes;
+    signature			= 0x1e 0x95 0x07;
+
+    # STK500 parameters (parallel programming IO lines)
+    pagel			= 0xa7;
+    bs2				= 0xa0;
+    serial			= no;
+    parallel			= yes;
+
+    # STK500v2 HV programming parameters, from XML
+    pp_controlstack		= 0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f,
+				  0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f,
+				  0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b,
+				  0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+
+    # JTAG ICE mkII parameters, also from XML files
+    allowfullpagebitstream	= no;
+    enablepageprogramming	= yes;
+    idr				= 0x51;
+    rampz			= 0x00;
+    spmcr			= 0x57;
+    eecr			= 0x3f;
+
+    memory "eeprom"
+        paged		= no;
+        size		= 512;
+        page_size	= 4;
+        blocksize	= 4;
+	readsize	= 4;
+        num_pages	= 128;
     ;
 
-    memory "fuse"
-        size		= 1;
-        offset		= 0x3f40;
-        page_size	= 16;
-	blocksize	= 4;
+    memory "flash"
+        paged		= yes;
+        size		= 40960;
+        page_size	= 128;
+        blocksize	= 128;
+	readsize	= 128;
+        num_pages	= 320;
     ;
 
-    memory "calibration"
-        size		= 1;
-        offset		= 0x3f80;
-        page_size	= 16;
+    memory "hfuse"
+        size            = 1;
+    ;
+
+    memory "lfuse"
+        size            = 1;
     ;
 
     memory "lockbits"
         size		= 1;
-        offset		= 0x3f00;
-        page_size	= 16;
+    ;
+
+    memory "signature"
+        size            = 3;
     ;
 ;
 
diff --git a/AstroEQ-ConfigUtility/hex/AstroEQATMega162Based(Legacy).7.hex b/AstroEQ-ConfigUtility/hex/AstroEQATMega162Based(Legacy).7.hex
new file mode 100644
index 0000000000000000000000000000000000000000..3dc1909ddff704d2c7456a8f4af67799ac5f7cb5
Binary files /dev/null and b/AstroEQ-ConfigUtility/hex/AstroEQATMega162Based(Legacy).7.hex differ
diff --git a/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega1280(Legacy).7.hex b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega1280(Legacy).7.hex
new file mode 100644
index 0000000000000000000000000000000000000000..a60ef4ca0f950f31042d355ff88a5143a9d29392
Binary files /dev/null and b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega1280(Legacy).7.hex differ
diff --git a/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega2560(Legacy).7.hex b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega2560(Legacy).7.hex
new file mode 100644
index 0000000000000000000000000000000000000000..ded9b903c072dd9cb4ece93cda0b11ffea92f528
Binary files /dev/null and b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega2560(Legacy).7.hex differ
diff --git a/AstroEQ-ConfigUtility/hex/AstroEQV4-DIYBoard(includingKits).7.hex b/AstroEQ-ConfigUtility/hex/AstroEQV4-DIYBoard(includingKits).7.hex
new file mode 100644
index 0000000000000000000000000000000000000000..a4fb1f68ae9e2105d18add3343b401614eedd1b2
Binary files /dev/null and b/AstroEQ-ConfigUtility/hex/AstroEQV4-DIYBoard(includingKits).7.hex differ
diff --git a/AstroEQ-ConfigUtility/hex/AstroEQV4-EQ5Board.7.hex b/AstroEQ-ConfigUtility/hex/AstroEQV4-EQ5Board.7.hex
new file mode 100644
index 0000000000000000000000000000000000000000..a4fb1f68ae9e2105d18add3343b401614eedd1b2
Binary files /dev/null and b/AstroEQ-ConfigUtility/hex/AstroEQV4-EQ5Board.7.hex differ
diff --git a/AstroEQ-ConfigUtility/hex/hexNames.txt b/AstroEQ-ConfigUtility/hex/hexNames.txt
index c6b2995c3dc93dd42a0d66bd71d999e33d4138f8..edcb6353e709358c40bf0dfbacfe2a0b7b6c87c1 100644
--- a/AstroEQ-ConfigUtility/hex/hexNames.txt
+++ b/AstroEQ-ConfigUtility/hex/hexNames.txt
@@ -1,10 +1,10 @@
-AstroEQArduinoMega1280(Legacy)	6.8
-AstroEQArduinoMega2560(Legacy)	6.8
-AstroEQATMega162Based(Legacy)	6.8
-AstroEQV4-EQ5Board	6.8
-AstroEQV4-DIYBoard(includingKits)	6.8
-AstroEQArduinoMega1280(Legacy)EEPROMReader	1.2
-AstroEQArduinoMega2560(Legacy)EEPROMReader	1.2
-AstroEQATMega162Based(Legacy)EEPROMReader	1.2
-AstroEQV4-EQ5BoardEEPROMReader	1.2
-AstroEQV4-DIYBoard(includingKits)EEPROMReader	1.2
\ No newline at end of file
+AstroEQArduinoMega1280(Legacy)	6.8	7.0
+AstroEQArduinoMega2560(Legacy)	6.8	7.0
+AstroEQATMega162Based(Legacy)	6.8	7.0
+AstroEQV4-EQ5Board	6.8	7.0
+AstroEQV4-DIYBoard(includingKits)	6.8	7.0
+AstroEQArduinoMega1280(Legacy)EEPROMReader	1.2	1.2
+AstroEQArduinoMega2560(Legacy)EEPROMReader	1.2	1.2
+AstroEQATMega162Based(Legacy)EEPROMReader	1.2	1.2
+AstroEQV4-EQ5BoardEEPROMReader	1.2	1.2
+AstroEQV4-DIYBoard(includingKits)EEPROMReader	1.2	1.2
\ No newline at end of file
diff --git a/AstroEQ-Firmware/AstroEQ6.ino b/AstroEQ-Firmware/AstroEQ6.ino
index 4a9cab9dddad6a891faba5bd62ec7f9ac146a82f..6e47f8dd8cbc58b628c023134ffe25379f86f2bf 100644
--- a/AstroEQ-Firmware/AstroEQ6.ino
+++ b/AstroEQ-Firmware/AstroEQ6.ino
@@ -9,7 +9,7 @@
  
   Works with EQ5, HEQ5, and EQ6 mounts
  
-  Current Verison: 6.8
+  Current Verison: 7.0
 */
 
 //Only works with ATmega162, and Arduino Mega boards (1280 and 2560)
@@ -111,11 +111,15 @@ void systemInitialiser(){
   
 
 #ifdef LEGACY_MODE
-  modeState[STATE16][MODE0] = !EEPROM.readByte(Driver_Address);
-  modeState[STATE2][MODE0] =  !modeState[STATE16][MODE0];
+  //modeState[STATE2][MODE0] =  EEPROM.readByte(Driver_Address);
+  //modeState[STATE16][MODE0] = !modeState[STATE2][MODE0];
+  modeState[STATE2][MODE0] =  EEPROM.readByte(Driver_Address);
 #else
+  //modeState[STATE16][MODE1] = !EEPROM.readByte(Driver_Address);
+  //modeState[STATE16][MODE0] = modeState[STATE16][MODE1];
   modeState[STATE16][MODE0] = !EEPROM.readByte(Driver_Address);
-  modeState[STATE16][MODE1] = modeState[STATE16][MODE0];
+  modeState[STATE2][MODE0] = modeState[STATE16][MODE0];
+  modeState[STATE2][MODE1] = !modeState[STATE16][MODE0];
 #endif
   
   unsigned int multiplierRA = synta.cmd.siderealIVal[RA]/75;
diff --git a/Downloads/AstroEQ-Hardware.zip b/Downloads/AstroEQ-Hardware.zip
index 03fc1b022e5c7c38568af8158488c78de803865c..213b5de71d76ad943336cb637af29c9b65a53683 100644
Binary files a/Downloads/AstroEQ-Hardware.zip and b/Downloads/AstroEQ-Hardware.zip differ
diff --git a/Downloads/AstroEQ6-ConfigUtility-LINUX.zip b/Downloads/AstroEQ6-ConfigUtility-LINUX.zip
index 5026b7e4f10bcd4ef8ab45cb56d5814fb56d31a0..a910d583d98f1f27a06e6e07035335eeb73463a7 100644
Binary files a/Downloads/AstroEQ6-ConfigUtility-LINUX.zip and b/Downloads/AstroEQ6-ConfigUtility-LINUX.zip differ
diff --git a/Downloads/AstroEQ6-ConfigUtility.zip b/Downloads/AstroEQ6-ConfigUtility.zip
index aea581c56587c5f9d58b872e0697ce8b63cdc0f0..f3ec46c547a7ac9ac6ab8202a9765ebadc729459 100644
Binary files a/Downloads/AstroEQ6-ConfigUtility.zip and b/Downloads/AstroEQ6-ConfigUtility.zip differ
diff --git a/Downloads/AstroEQ6-Firmware.zip b/Downloads/AstroEQ6-Firmware.zip
index 217946a009b67aea852be82a70dd05cea57f93f3..c7bc703eb98864ecf1f3e72b16ddbc2789f79811 100644
Binary files a/Downloads/AstroEQ6-Firmware.zip and b/Downloads/AstroEQ6-Firmware.zip differ
diff --git a/README b/README
index 38cedaef92b99b064fc399b599bc287bcf7c0a96..92b177c7d952ee9fb84f0dc6fb954223741833b5 100644
--- a/README
+++ b/README
@@ -1,7 +1,8 @@
-Last Updated: 31/12/2013
+Last Updated: 16/02/2014
 
-A small number of AstroEQ controllers are available to purchase. These can be bought from me on the AstronomyShed forum. 
-Just send me a PM on Astronomy Shed (http://www.astronomyshed.co.uk/forum/memberlist.php?mode=viewprofile&u=2603).
+Version 7 includes a change to the microstepping mode being used. AstroEQ now uses 1/4 and 1/32th stepping modes for the DRV8825 chip. If you have legacy hardware, please read the "Upgrading from 6.x to 7.x firmware" file.
+
+A small number of AstroEQ controllers are available to purchase. These can be bought from me on my website (http://www.astroeq.co.uk).
 
 AstroEQ6 has been rebuilt from the ground up to be the best AstroEQ firmware to date.
 
@@ -23,7 +24,7 @@ The EQMOD Project can be found at: http://eq-mod.sourceforge.net/
 
   Works with EQ3, EQ5, HEQ5, and EQ6 mounts. Along With custom mounts.
  
-  Current Software Verison: 6.8
+  Current Software Verison: 7.0
   Current Hardware Version: 4.3
 
 ---------------------------------------------------------------------------------------
diff --git a/Upgrading from 6.x to 7.x firmware.txt b/Upgrading from 6.x to 7.x firmware.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f42d9139a306688a976186aac6e8df7a2978240f
--- /dev/null
+++ b/Upgrading from 6.x to 7.x firmware.txt	
@@ -0,0 +1,29 @@
+Upgrading to 7.x from 6.x:
+
+If you have a non-legacy controller, i.e. one which does not have '(legacy)' written next to it in the configuration utility, then refer to section 'A'.
+If you have a legacy controller, refer to section 'B'
+
+
+
+Section 'A':
+
+As of version 7, AstroEQ now uses 1/4 and 1/32th stepping for the DRV8824/5 driver boards. The change does not affect the A498x driver boards as they do not support 1/32th stepping mode.
+
+To account for these changes, please download and run the new configuration utility. Enter your step angle and gear ratios as normal and click 'Update'. That is all.
+
+
+
+Section 'B':
+
+As of version 7, AstroEQ now uses 1/4 and 1/32th stepping for the DRV8824/5 driver boards. The change does not affect the A498x driver boards as they do not support 1/32th stepping mode.
+
+For legacy controllers, only two pins are used to select the step mode. Because of this, one of the mode pins for each driver board is wired to a supply rail. 
+
+If you have a A498x board, you do not need to make any hardware changes. Simply download and run the new config utility, enter your gear ratios/step angles and proceed as normal.
+
+If you have a DRV8824/5 board, you need to make some changes. Essentially you need to swap the pins on the driver boards labelled 'M0' and 'M1'. Once the changes are made, download and run the new config utility, enter your gear ratios/step angles and proceed as normal.
+
+
+
+While I know this is an inconvenience it is a necessary evil to improve the performance of AstroEQ.
+
diff --git a/repo/dists/stable/main/binary-amd64/Packages.gz b/repo/dists/stable/main/binary-amd64/Packages.gz
index c9bd8849ace2a8a6896844d6acfd978afd273bbc..178428d467c16e37375668e60f07399aef6183b0 100644
Binary files a/repo/dists/stable/main/binary-amd64/Packages.gz and b/repo/dists/stable/main/binary-amd64/Packages.gz differ
diff --git a/repo/dists/stable/main/binary-armhf/Packages.gz b/repo/dists/stable/main/binary-armhf/Packages.gz
index 6f59140071132a2485d482926c71da2c428dffa3..f73a59a2bbcb950b530e15732a8dcaf17e8d7975 100644
Binary files a/repo/dists/stable/main/binary-armhf/Packages.gz and b/repo/dists/stable/main/binary-armhf/Packages.gz differ
diff --git a/repo/dists/stable/main/binary-i386/Packages.gz b/repo/dists/stable/main/binary-i386/Packages.gz
index 3e62fde01d7094524c41f10d816a652a9fc76fd0..bd297d9435560743e719cf65027fddb32208eb67 100644
Binary files a/repo/dists/stable/main/binary-i386/Packages.gz and b/repo/dists/stable/main/binary-i386/Packages.gz differ
diff --git a/repo/pool/main/amd64/astroequploader/astroequploader-1.03-amd64.deb b/repo/pool/main/amd64/astroequploader/astroequploader-1.03-amd64.deb
deleted file mode 100644
index 0d3c8b51d2f3abacd19d427fc179b3d4cabae46e..0000000000000000000000000000000000000000
Binary files a/repo/pool/main/amd64/astroequploader/astroequploader-1.03-amd64.deb and /dev/null differ
diff --git a/repo/pool/main/amd64/astroequploader/astroequploader-1.05-amd64.deb b/repo/pool/main/amd64/astroequploader/astroequploader-1.05-amd64.deb
new file mode 100644
index 0000000000000000000000000000000000000000..95ce24d433732ae70d3444a26c9e8ec814c0aa98
Binary files /dev/null and b/repo/pool/main/amd64/astroequploader/astroequploader-1.05-amd64.deb differ
diff --git a/repo/pool/main/armhf/astroequploader/astroequploader-1.04-armhf.deb b/repo/pool/main/armhf/astroequploader/astroequploader-1.04-armhf.deb
deleted file mode 100644
index a99fb678da6bd93fb1bf0d4ac704030436392a66..0000000000000000000000000000000000000000
Binary files a/repo/pool/main/armhf/astroequploader/astroequploader-1.04-armhf.deb and /dev/null differ
diff --git a/repo/pool/main/armhf/astroequploader/astroequploader-1.05-armhf.deb b/repo/pool/main/armhf/astroequploader/astroequploader-1.05-armhf.deb
new file mode 100644
index 0000000000000000000000000000000000000000..903d56da1515935bb638829496006a7792519b35
Binary files /dev/null and b/repo/pool/main/armhf/astroequploader/astroequploader-1.05-armhf.deb differ
diff --git a/repo/pool/main/i386/astroequploader/astroequploader-1.03-i386.deb b/repo/pool/main/i386/astroequploader/astroequploader-1.03-i386.deb
deleted file mode 100644
index f9c8c7f44b6c5ff147c8716c9ced2e5ab2d2dc94..0000000000000000000000000000000000000000
Binary files a/repo/pool/main/i386/astroequploader/astroequploader-1.03-i386.deb and /dev/null differ
diff --git a/repo/pool/main/i386/astroequploader/astroequploader-1.05-i386.deb b/repo/pool/main/i386/astroequploader/astroequploader-1.05-i386.deb
new file mode 100644
index 0000000000000000000000000000000000000000..8facd94998ec9bfad8292b8f6748b90eaa7fb2f8
Binary files /dev/null and b/repo/pool/main/i386/astroequploader/astroequploader-1.05-i386.deb differ