Tracey Emery <[email protected]> writes:
> On Fri, Apr 24, 2020 at 08:18:53AM -0600, Tracey Emery wrote:
>> I can certainly test this here in the future. Having newer avrdude would
>> be great. None of the ESP "suite of tools" uses avrdude, so those won't
>> be affected.
>>
>> I'm working on a ATTiny project, which would be a good test case for
>> this. :D
>>
>> > --
>> > jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
>>
>> --
>>
>> Tracey Emery
>
> Here is a diff for later review. Tested communications with my
> buspirate, with no problems.
>
> --
>
> Tracey Emery
Hello, I've tested this on amd64 -current using an Arduino UNO with a
simple program, works as expected.
> diff b8b1ea7c41effe940702be2e1fa45f122b9f3cc7 /usr/ports/mystuff
> blob - f36bee3303e7d620c926342c755d4f26336e9f69
> file + devel/avrdude/Makefile
> --- devel/avrdude/Makefile
> +++ devel/avrdude/Makefile
> @@ -2,10 +2,12 @@
>
> COMMENT= AVR microcontroller hardware in-system programmer
>
> -V= 5.11
> +V= 6.3
> DISTNAME= avrdude-${V}
> -REVISION= 4
> DISTFILES+= avrdude-${V}.tar.gz avrdude-doc-${V}.pdf
> +
> +SHARED_LIBS += avrdude 0.0 # 1.0
> +
> CATEGORIES= devel
>
> HOMEPAGE= http://www.nongnu.org/avrdude/
> @@ -13,7 +15,7 @@ HOMEPAGE= http://www.nongnu.org/avrdude/
> # GPLv2+
> PERMIT_PACKAGE= Yes
>
> -WANTLIB += c curses ftdi m pthread readline usb usb-1.0
> +WANTLIB += c curses elf ftdi1 m pthread readline usb usb-1.0
>
> MASTER_SITES= ${MASTER_SITE_SAVANNAH:=avrdude/}
> EXTRACT_ONLY= avrdude-${V}${EXTRACT_SUFX}
> @@ -23,7 +25,7 @@ CONFIGURE_STYLE= autoconf
> CONFIGURE_ARGS+= CPPFLAGS="-I${LOCALBASE}/include" \
> LDFLAGS="-L${LOCALBASE}/lib -pthread"
>
> -LIB_DEPENDS= devel/libftdi \
> +LIB_DEPENDS= devel/libftdi1 \
> devel/libusb-compat
>
> SUBST_VARS+= V
> blob - c143503b71077821ad44e1110d56fac3bb6fff06
> file + devel/avrdude/distinfo
> --- devel/avrdude/distinfo
> +++ devel/avrdude/distinfo
> @@ -1,4 +1,4 @@
> -SHA256 (avrdude-5.11.tar.gz) = Yxf08w/LG69+B+VeXHQ68+Hn+UnyBtOHKmIq7THVldc=
> -SHA256 (avrdude-doc-5.11.pdf) = 7mmFOgnvMLPV2yVrxpDT6lp4ezQjVsDTghUrLBbNEtM=
> -SIZE (avrdude-5.11.tar.gz) = 549113
> -SIZE (avrdude-doc-5.11.pdf) = 236872
> +SHA256 (avrdude-6.3.tar.gz) = D59zG2OUyneVuINZaJp/ofuoGMbh2WJRPrKNpnDgoZY=
> +SHA256 (avrdude-doc-6.3.pdf) = 8+fMdVehEcGB8/BNLasHXoNB141+f4kUtXgZjRjayi8=
> +SIZE (avrdude-6.3.tar.gz) = 909744
> +SIZE (avrdude-doc-6.3.pdf) = 255521
> blob - 9bc1c22fbaa811e0c3fe93f8b334a775d0ee1934
> file + /dev/null
> --- devel/avrdude/patches/patch-avrdude_conf_in
> +++ devel/avrdude/patches/patch-avrdude_conf_in
> @@ -1,201 +0,0 @@
> -$OpenBSD: patch-avrdude_conf_in,v 1.2 2013/05/05 16:48:08 edd Exp $
> -
> -Add support for attiny4313:
> -http://savannah.nongnu.org/patch/?7393
> -
> ---- avrdude.conf.in.orig Fri Aug 26 21:50:33 2011
> -+++ avrdude.conf.in Sat May 4 10:30:28 2013
> -@@ -9788,6 +9788,193 @@ part
> - ;
> -
> - #------------------------------------------------------------
> -+# 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";
> -+
> -+# 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 a10 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;
> -+ ;
> -+# 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;
> -+ ;
> -+# The Tiny4313 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";
> -+ ;
> -+ ;
> -+
> -+#------------------------------------------------------------
> - # AT90PWM2
> - #------------------------------------------------------------
> -
> blob - 99293fb72e40ca32fa095e6f9bead4a3bc8169d5
> file + /dev/null
> --- devel/avrdude/patches/patch-configure_ac
> +++ devel/avrdude/patches/patch-configure_ac
> @@ -1,23 +0,0 @@
> -$OpenBSD: patch-configure_ac,v 1.1 2017/09/25 09:16:12 robert Exp $
> -
> -Index: configure.ac
> ---- configure.ac.orig
> -+++ configure.ac
> -@@ -297,7 +297,7 @@ if test "$GCC" = yes; then
> - safe_CFLAGS=$CFLAGS
> - CFLAGS="$ENABLE_WARNINGS -Wno-pointer-sign"
> -
> -- AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
> -+ AC_TRY_COMPILE(, [], [
> - no_pointer_sign=yes
> - AC_MSG_RESULT([yes])
> - ], [
> -@@ -322,7 +322,7 @@ case $target in
> - safe_CFLAGS="$CFLAGS"
> - CFLAGS="$ENABLE_WARNINGS -mno-cygwin"
> -
> -- AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
> -+ AC_TRY_COMPILE(, [], [
> - no_cygwin=yes
> - AC_MSG_RESULT([yes])
> - ], [
> blob - /dev/null
> file + devel/avrdude/patches/patch-fileio_c
> --- devel/avrdude/patches/patch-fileio_c
> +++ devel/avrdude/patches/patch-fileio_c
> @@ -0,0 +1,17 @@
> +$OpenBSD$
> +
> +Define EM_AVR, since it isn't included in our base libelf yet.
> +
> +Index: fileio.c
> +--- fileio.c.orig
> ++++ fileio.c
> +@@ -34,6 +34,9 @@
> + #elif defined(HAVE_LIBELF_LIBELF_H)
> + #include <libelf/libelf.h>
> + #endif
> ++#ifndef EM_AVR
> ++#define EM_AVR 83
> ++#endif
> + #define EM_AVR32 0x18ad /* inofficial */
> + #endif
> +
> blob - 3706aaf620ca6def50b50ef333cfc2531bf5ee22
> file + devel/avrdude/patches/patch-stk500v2_c
> --- devel/avrdude/patches/patch-stk500v2_c
> +++ devel/avrdude/patches/patch-stk500v2_c
> @@ -1,7 +1,9 @@
> -$OpenBSD: patch-stk500v2_c,v 1.5 2013/05/05 16:48:08 edd Exp $
> ---- stk500v2.c.orig Fri Aug 26 21:22:10 2011
> -+++ stk500v2.c Sat May 4 10:30:28 2013
> -@@ -319,6 +319,7 @@ static void stk500v2_jtagmkII_setup(PROGRAMMER * pgm)
> +$OpenBSD$
> +
> +Index: stk500v2.c
> +--- stk500v2.c.orig
> ++++ stk500v2.c
> +@@ -350,6 +350,7 @@ static void stk500v2_jtag3_setup(PROGRAMMER * pgm)
> void stk500v2_teardown(PROGRAMMER * pgm)
> {
> free(pgm->cookie);
> @@ -9,23 +11,25 @@ $OpenBSD: patch-stk500v2_c,v 1.5 2013/05/05 16:48:08 e
> }
>
> static void stk500v2_jtagmkII_teardown(PROGRAMMER * pgm)
> -@@ -330,6 +331,7 @@ static void stk500v2_jtagmkII_teardown(PROGRAMMER * pg
> +@@ -361,6 +362,7 @@ static void stk500v2_jtagmkII_teardown(PROGRAMMER * pg
> jtagmkII_teardown(pgm);
>
> free(mycookie);
> + pgm->cookie = NULL;
> }
>
> -
> -@@ -1158,12 +1160,14 @@ static int stk500hv_initialize(PROGRAMMER * pgm,
> AVRPA
> + static void stk500v2_jtag3_teardown(PROGRAMMER * pgm)
> +@@ -1477,6 +1479,8 @@ static int stk500hv_initialize(PROGRAMMER * pgm, AVRPA
> + }
> + free(PDATA(pgm)->flash_pagecache);
> + free(PDATA(pgm)->eeprom_pagecache);
> ++ PDATA(pgm)->flash_pagecache = NULL;
> ++ PDATA(pgm)->eeprom_pagecache = NULL;
> if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) ==
> NULL) {
> - fprintf(stderr, "%s: stk500pp_initialize(): Out of memory\n",
> + avrdude_message(MSG_INFO, "%s: stk500hv_initialize(): Out of memory\n",
> progname);
> -+ PDATA(pgm)->eeprom_pagecache = NULL;
> - return -1;
> - }
> - if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize))
> == NULL) {
> - fprintf(stderr, "%s: stk500pp_initialize(): Out of memory\n",
> +@@ -1486,6 +1490,7 @@ static int stk500hv_initialize(PROGRAMMER * pgm, AVRPA
> + avrdude_message(MSG_INFO, "%s: stk500hv_initialize(): Out of memory\n",
> progname);
> free(PDATA(pgm)->flash_pagecache);
> + PDATA(pgm)->flash_pagecache = NULL;
> blob - 1988eb689b6bf479789a6082e7ed1e612a9b5e09
> file + devel/avrdude/pkg/PLIST
> --- devel/avrdude/pkg/PLIST
> +++ devel/avrdude/pkg/PLIST
> @@ -1,5 +1,9 @@
> -@comment $OpenBSD: PLIST,v 1.8 2018/09/04 12:46:10 espie Exp $
> +@comment $OpenBSD: PLIST,v$
> @bin bin/avrdude
> +include/libavrdude.h
> +@static-lib lib/libavrdude.a
> +lib/libavrdude.la
> +@lib lib/libavrdude.so.${LIBavrdude_VERSION}
> @man man/man1/avrdude.1
> share/doc/avrdude/
> share/doc/avrdude/avrdude-doc-${V}.pdf