Hello,

devel/avrdude is currently version 5.11
avrdude 6.x includes support for direct reading of ELF files via
libelf. OpenBSD's sys/exec_elf.h does not include an e_machine entry for
EM_AVR, which causes compilation of 6.3 to fail as follows:

fileio.c:910:15: error: use of undeclared identifier 'EM_AVR'
    machine = EM_AVR;
              ^
I can get it to compile (on amd64 -current) by just writing:

#define EM_AVR 83

at the top of fileio.c. '83' is a value I got here:
https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
I don't know if there is a preferred standardization of these values.

now it builds and I can upload a .hex file to my arduino uno and
everything seems to work fine.

another solution which also gets avrdude 6.3 to build is to just 
disable the ELF file reading functionality altogether. I did this as follows:

--- /usr/ports/pobj/avrdude-6.3/avrdude-6.3/Makefile.in.orig    Wed Apr 22 
12:48:59 2020
+++ /usr/ports/pobj/avrdude-6.3/avrdude-6.3/Makefile.in Wed Apr 22 12:49:25 2020
@@ -431,7 +431,6 @@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBELF = @LIBELF@
 LIBFTDI = @LIBFTDI@
 LIBFTDI1 = @LIBFTDI1@
 LIBHID = @LIBHID@
@@ -565,7 +564,7 @@
 avrdude_CFLAGS = @ENABLE_WARNINGS@
 libavrdude_a_CFLAGS = @ENABLE_WARNINGS@
 libavrdude_la_CFLAGS = $(libavrdude_a_CFLAGS)
-avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBUSB@ 
@LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
+avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBUSB@ 
@LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBPTHREAD@ -lm
 noinst_LIBRARIES = libavrdude.a
 lib_LTLIBRARIES = libavrdude.la
 libavrdude_a_SOURCES = \


--- /usr/ports/pobj/avrdude-6.3/avrdude-6.3/configure.ac.orig   Tue Feb 16 
16:29:19 2016
+++ /usr/ports/pobj/avrdude-6.3/avrdude-6.3/configure.ac        Wed Apr 22 
12:15:07 2020
@@ -79,20 +79,6 @@
 AC_CHECK_LIB([termcap], [tputs])
 AC_CHECK_LIB([ncurses], [tputs])
 AC_CHECK_LIB([readline], [readline])
-AH_TEMPLATE([HAVE_LIBELF],
-            [Define if ELF support is enabled via libelf])
-AC_CHECK_LIB([elf], [elf_getshdrstrndx], [have_libelf=yes])
-if test x$have_libelf = xyes; then
-   case $target in
-       *)
-               LIBELF="-lelf"
-               ;;
-   esac
-   AC_DEFINE([HAVE_LIBELF])
-   AC_CHECK_HEADERS([libelf.h libelf/libelf.h])
-fi
-AC_SUBST(LIBELF, $LIBELF)
-
 AC_SEARCH_LIBS([gethostent], [nsl])
 AC_SEARCH_LIBS([setsockopt], [socket])
 AH_TEMPLATE([HAVE_LIBUSB],


again, I can build avrdude and then flash a simple program onto my
arduino uno.

What do people think of this? Reasons to go for one approach vs another?
Any potential problems with just setting EM_AVR that I need to be aware
of? I'm not an AVR expert by any means, just wanted to do some playing
around and thought updating our 9-year old avrdude version might be nice.

Cheers,
Andrea

Reply via email to