From cc77f89953a978040f2e29e82f8cb596cb64054f Mon Sep 17 00:00:00 2001
From: MCUdude <hansibull@gmail.com>
Date: Thu, 13 Jan 2022 19:07:56 +0100
Subject: [PATCH 1/2] Add missing ATmega targets  + a little formatting

---
 src/avrdude.conf.in | 368 +++++++++++++++-----------------------------
 1 file changed, 128 insertions(+), 240 deletions(-)

diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in
index 393b0c2a..805d8c54 100644
--- a/src/avrdude.conf.in
+++ b/src/avrdude.conf.in
@@ -3575,8 +3575,14 @@ part
       ;
   ;
 
+#------------------------------------------------------------
+# ATmega64A
+#------------------------------------------------------------
 
-
+part parent "m64"
+    id               = "m64a";
+    desc             = "ATmega64A";
+  ;
 
 #------------------------------------------------------------
 # ATmega128
@@ -3758,6 +3764,15 @@ part
       ;
   ;
 
+#------------------------------------------------------------
+# ATmega128A
+#------------------------------------------------------------
+
+part parent "m128"
+    id               = "m128a";
+    desc             = "ATmega128A";
+  ;
+
 #------------------------------------------------------------
 # AT90CAN128
 #------------------------------------------------------------
@@ -4512,13 +4527,19 @@ part
         ;
   ;
 
+#------------------------------------------------------------
+# ATmega16A
+#------------------------------------------------------------
+
+part parent "m16"
+    id               = "m16a";
+    desc             = "ATmega16A";
+  ;
 
 #------------------------------------------------------------
 # ATmega324P
 #------------------------------------------------------------
 
-# similar to ATmega164P
-
 part
     id               = "m324p";
     desc             = "ATmega324P";
@@ -4705,13 +4726,10 @@ part
         ;
   ;
 
-
 #------------------------------------------------------------
 # ATmega164P
 #------------------------------------------------------------
 
-# like ATmega324P, only smaller
-
 part parent "m324p"
     id               = "m164p";
     desc             = "ATmega164P";
@@ -4730,71 +4748,59 @@ part parent "m324p"
         ;
   ;
 
+#------------------------------------------------------------
+# ATmega164PA
+#------------------------------------------------------------
+
+part parent "m164p"
+    id               = "m164pa";
+    desc             = "ATmega164PA";
+  ;
 
 #------------------------------------------------------------
 # ATmega164A
 #------------------------------------------------------------
 
-# similar to ATmega164P
-
 part parent "m164p"
     id               = "m164a";
     desc             = "ATmega164A";
     signature        = 0x1e 0x94 0x0f;
-
-    ocdrev              = 3;
   ;
 
-
 #------------------------------------------------------------
 # ATmega324PB
 #------------------------------------------------------------
 
-# similar to ATmega324P
-
 part parent "m324p"
     id               = "m324pb";
     desc             = "ATmega324PB";
     signature        = 0x1e 0x95 0x17;
-
-    ocdrev              = 3;
   ;
 
-
 #------------------------------------------------------------
 # ATmega324PA
 #------------------------------------------------------------
 
-# similar to ATmega324P
-
 part parent "m324p"
     id               = "m324pa";
     desc             = "ATmega324PA";
     signature        = 0x1e 0x95 0x11;
-
-    ocdrev              = 3;
   ;
 
 #------------------------------------------------------------
 # ATmega324A
 #------------------------------------------------------------
 
-# similar to ATmega324P
-
 part parent "m324p"
     id               = "m324a";
     desc             = "ATmega324A";
     signature        = 0x1e 0x95 0x15;
-
-    ocdrev              = 3;
   ;
 
 #------------------------------------------------------------
 # ATmega644
 #------------------------------------------------------------
 
-# similar to ATmega164
-
 part
     id               = "m644";
     desc             = "ATmega644";
@@ -4982,27 +4988,38 @@ part
   ;
 
 #------------------------------------------------------------
-# ATmega644P
+# ATmega644A
 #------------------------------------------------------------
 
-# similar to ATmega164p
+part parent "m644"
+    id               = "m644a";
+    desc             = "ATmega644A";
+  ;
+
+#------------------------------------------------------------
+# ATmega644P
+#------------------------------------------------------------
 
 part parent "m644"
     id               = "m644p";
     desc             = "ATmega644P";
     signature        = 0x1e 0x96 0x0a;
-
-    ocdrev              = 3;
   ;
 
+#------------------------------------------------------------
+# ATmega644PA
+#------------------------------------------------------------
 
+part parent "m644"
+    id               = "m644pa";
+    desc             = "ATmega644PA";
+    signature        = 0x1e 0x96 0x0a;
+  ;
 
 #------------------------------------------------------------
 # ATmega1284
 #------------------------------------------------------------
 
-# similar to ATmega164
-
 part
     id               = "m1284";
     desc             = "ATmega1284";
@@ -5189,202 +5206,16 @@ part
         ;
   ;
 
-
-
 #------------------------------------------------------------
 # ATmega1284P
 #------------------------------------------------------------
 
-# similar to ATmega164p
-
-part
+part parent "m1284"
     id               = "m1284p";
     desc             = "ATmega1284P";
-    has_jtag         = yes;
-    stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
-    avr910_devcode   = 0x74;
     signature        = 0x1e 0x97 0x05;
-    pagel            = 0xd7;
-    bs2              = 0xa0;
-    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";
-
-    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, 0x02;
-    hventerstabdelay    = 100;
-    progmodedelay       = 0;
-    latchcycles         = 6;
-    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;
-    allowfullpagebitstream = no;
-
-    ocdrev              = 3;
-
-    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     = 0xff;
-        readback_p2     = 0xff;
-	read            = "  1   0   1   0      0   0   0   0",
-                          "  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    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	= 128;
-	readsize	= 256;
-      ;
-
-    memory "flash"
-        paged           = yes;
-        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",
-                          "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		= 0x41;
-	delay		= 10;
-	blocksize	= 256;
-	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   o o 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;
-        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;
-        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;
-
-        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 "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 0   o o o o  o o o o";
-        ;
   ;
 
-
-
 #------------------------------------------------------------
 # ATmega162
 #------------------------------------------------------------
@@ -6756,6 +6587,14 @@ part
       ;
   ;
 
+#------------------------------------------------------------
+# ATmega32A
+#------------------------------------------------------------
+
+part parent "m32"
+    id               = "m32a";
+    desc             = "ATmega32A";
+  ;
 
 #------------------------------------------------------------
 # ATmega8
@@ -8220,6 +8059,15 @@ part
       ;
   ;
 
+#------------------------------------------------------------
+# ATmega48A
+#------------------------------------------------------------
+
+part parent "m48"
+    id               = "m48a";
+    desc             = "ATmega48A";
+  ;
+
 #------------------------------------------------------------
 # ATmega48P
 #------------------------------------------------------------
@@ -8228,8 +8076,16 @@ part parent "m48"
     id               = "m48p";
     desc             = "ATmega48P";
     signature        = 0x1e 0x92 0x0a;
+  ;
 
-    ocdrev              = 1;
+#------------------------------------------------------------
+# ATmega48PA
+#------------------------------------------------------------
+
+part parent "m48"
+    id               = "m48pa";
+    desc             = "ATmega48PA";
+    signature        = 0x1e 0x92 0x0a;
   ;
 
 #------------------------------------------------------------
@@ -8240,8 +8096,6 @@ part parent "m48"
     id               = "m48pb";
     desc             = "ATmega48PB";
     signature        = 0x1e 0x92 0x10;
-
-    ocdrev              = 1;
   ;
 
 #------------------------------------------------------------
@@ -8432,6 +8286,15 @@ part
       ;
   ;
 
+#------------------------------------------------------------
+# ATmega88A
+#------------------------------------------------------------
+
+part parent "m88"
+    id               = "m88a";
+    desc             = "ATmega88A";
+  ;
+
 #------------------------------------------------------------
 # ATmega88P
 #------------------------------------------------------------
@@ -8440,8 +8303,16 @@ part parent "m88"
     id               = "m88p";
     desc             = "ATmega88P";
     signature        = 0x1e 0x93 0x0f;
+  ;
 
-    ocdrev              = 1;
+#------------------------------------------------------------
+# ATmega88PA
+#------------------------------------------------------------
+
+part parent "m88"
+    id               = "m88pa";
+    desc             = "ATmega88PA";
+    signature        = 0x1e 0x93 0x0f;
   ;
 
 #------------------------------------------------------------
@@ -8452,8 +8323,6 @@ part parent "m88"
     id               = "m88pb";
     desc             = "ATmega88PB";
     signature        = 0x1e 0x93 0x16;
-
-    ocdrev              = 1;
   ;
 
 #------------------------------------------------------------
@@ -8646,6 +8515,15 @@ part
         ;
 ;
 
+#------------------------------------------------------------
+# ATmega168A
+#------------------------------------------------------------
+
+part parent "m168"
+    id               = "m168a";
+    desc             = "ATmega168A";
+  ;
+
 #------------------------------------------------------------
 # ATmega168P
 #------------------------------------------------------------
@@ -8654,9 +8532,17 @@ part parent "m168"
     id              = "m168p";
     desc            = "ATmega168P";
     signature       = 0x1e 0x94 0x0b;
+  ;
 
-    ocdrev              = 1;
-;
+#------------------------------------------------------------
+# ATmega168PA
+#------------------------------------------------------------
+
+part parent "m168"
+    id              = "m168pa";
+    desc            = "ATmega168PA";
+    signature       = 0x1e 0x94 0x0b;
+  ;
 
 #------------------------------------------------------------
 # ATmega168PB
@@ -8666,9 +8552,7 @@ part parent "m168"
     id              = "m168pb";
     desc            = "ATmega168PB";
     signature       = 0x1e 0x94 0x15;
-
-    ocdrev              = 1;
-;
+  ;
 
 #------------------------------------------------------------
 # ATtiny828
@@ -9798,20 +9682,24 @@ part
     ;
 ;
 
-part parent "m328"
-    id			= "m328p";
-    desc		= "ATmega328P";
-    signature		= 0x1e 0x95 0x0F;
+#------------------------------------------------------------
+# ATmega328P
+#------------------------------------------------------------
 
-    ocdrev              = 1;
+part parent "m328"
+    id              = "m328p";
+    desc            = "ATmega328P";
+    signature       = 0x1e 0x95 0x0f;
 ;
 
-part parent "m328"
-    id			= "m328pb";
-    desc		= "ATmega328PB";
-    signature		= 0x1e 0x95 0x16;
+#------------------------------------------------------------
+# ATmega328PB
+#------------------------------------------------------------
 
-    ocdrev              = 1;
+part parent "m328"
+    id              = "m328pb";
+    desc            = "ATmega328PB";
+    signature       = 0x1e 0x95 0x16;
 
     memory "efuse"
         size = 1;

From 99d8fa5d88ecdd8decd51ffd97a7da6e1fcb2adc Mon Sep 17 00:00:00 2001
From: MCUdude <hansibull@gmail.com>
Date: Thu, 13 Jan 2022 19:44:50 +0100
Subject: [PATCH 2/2] Add missing ATtiny targets  + a little formatting

---
 src/avrdude.conf.in | 96 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 86 insertions(+), 10 deletions(-)

diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in
index 805d8c54..8accc0ff 100644
--- a/src/avrdude.conf.in
+++ b/src/avrdude.conf.in
@@ -2082,9 +2082,16 @@ 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";
       ;
-
 ;
 
+#------------------------------------------------------------
+# ATtiny13A
+#------------------------------------------------------------
+
+part parent "t13"
+    id               = "t13a";
+    desc             = "ATtiny13A";
+  ;
 
 #------------------------------------------------------------
 # ATtiny15
@@ -7234,14 +7241,11 @@ part
         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";
     ;
-
 ;
 
-
 #------------------------------------------------------------
 # ATtiny261
 #------------------------------------------------------------
-# Close to ATtiny26
 
 part
     id                  = "t261";
@@ -7425,14 +7429,20 @@ part
         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";
     ;
-
 ;
 
+#------------------------------------------------------------
+# ATtiny261A
+#------------------------------------------------------------
+
+part parent "t261"
+    id               = "t261a";
+    desc             = "ATtiny261A";
+  ;
 
 #------------------------------------------------------------
 # ATtiny461
 #------------------------------------------------------------
-# Close to ATtiny261
 
 part
     id                  = "t461";
@@ -7616,14 +7626,20 @@ part
         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";
     ;
-
 ;
 
+#------------------------------------------------------------
+# ATtiny461A
+#------------------------------------------------------------
+
+part parent "t461"
+    id               = "t461a";
+    desc             = "ATtiny461A";
+  ;
 
 #------------------------------------------------------------
 # ATtiny861
 #------------------------------------------------------------
-# Close to ATtiny461
 
 part
     id                  = "t861";
@@ -7807,9 +7823,16 @@ part
         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";
     ;
-
 ;
 
+#------------------------------------------------------------
+# ATtiny861A
+#------------------------------------------------------------
+
+part parent "t861"
+    id               = "t861a";
+    desc             = "ATtiny861A";
+  ;
 
 #------------------------------------------------------------
 # ATtiny28
@@ -8742,6 +8765,14 @@ writepage   = "  1   1   0   0      0   0   1   0",
         ;
 ;
 
+#------------------------------------------------------------
+# ATtiny828R
+#------------------------------------------------------------
+
+part parent "t828"
+    id              = "t828r";
+    desc            = "ATtiny828R";
+  ;
 
 #------------------------------------------------------------
 # ATtiny87
@@ -9947,6 +9978,15 @@ part
      ;
   ;
 
+#------------------------------------------------------------
+# ATtiny2313A
+#------------------------------------------------------------
+
+part parent "t2313"
+    id              = "t2313a";
+    desc            = "ATtiny2313A";
+  ;
+
 #------------------------------------------------------------
 # ATtiny4313
 #------------------------------------------------------------
@@ -11986,6 +12026,15 @@ part
      ;
   ;
 
+#------------------------------------------------------------
+# ATtiny24A
+#------------------------------------------------------------
+
+part parent "t24"
+    id               = "t24a";
+    desc             = "ATtiny24A";
+  ;
+
 #------------------------------------------------------------
 # ATtiny44
 #------------------------------------------------------------
@@ -12170,6 +12219,15 @@ part
      ;
   ;
 
+#------------------------------------------------------------
+# ATtiny44A
+#------------------------------------------------------------
+
+part parent "t44"
+    id               = "t44a";
+    desc             = "ATtiny44A";
+  ;
+
 #------------------------------------------------------------
 # ATtiny84
 #------------------------------------------------------------
@@ -12355,6 +12413,15 @@ part
      ;
   ;
 
+#------------------------------------------------------------
+# ATtiny84A
+#------------------------------------------------------------
+
+part parent "t84"
+    id               = "t84a";
+    desc             = "ATtiny84A";
+  ;
+
 #------------------------------------------------------------
 # ATtiny441
 #------------------------------------------------------------
@@ -16086,7 +16153,7 @@ part parent "uc3a0512"
 ;
 
 #------------------------------------------------------------
-# ATtiny1634.
+# ATtiny1634
 #------------------------------------------------------------
 
 part
@@ -16274,6 +16341,15 @@ part
         ;
 ;
 
+#------------------------------------------------------------
+# ATtiny1634R
+#------------------------------------------------------------
+
+part parent "t1634"
+    id              = "t1634r";
+    desc            = "ATtiny1634R";
+  ;
+
 #------------------------------------------------------------
 # Common values for reduced core tinys (4/5/9/10/20/40)
 #------------------------------------------------------------