Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Avrdude build version into avrdude.conf #1542

Merged
merged 1 commit into from
Oct 29, 2023
Merged

Add Avrdude build version into avrdude.conf #1542

merged 1 commit into from
Oct 29, 2023

Conversation

Youw
Copy link
Contributor

@Youw Youw commented Oct 28, 2023

Resolves: #1475

@Youw
Copy link
Contributor Author

Youw commented Oct 28, 2023

NOTE: I have not tested autotools changes.

@mcuee mcuee added the enhancement New feature or request label Oct 29, 2023
@mcuee
Copy link
Collaborator

mcuee commented Oct 29, 2023

Yes this works fine for CMake build.

The latest comit from https://github.com/Youw/avrdude/tree/main is 7cf7c73

MINGW64 /c/work/avr/avrdude_test/avrdude_pr1542/build_mingw64_nt-10.0-22621/src
$ cat avrdude.conf | grep avrdude_version
avrdude_version = "7.2-20231028 (7cf7c73)";

@mcuee
Copy link
Collaborator

mcuee commented Oct 29, 2023

NOTE: I have not tested autotools changes.

No problem. And it indeed does not work. But this is okay, we can leave that to @dl8dtl or someone else.

MINGW64 /c/work/avr/avrdude_test/avrdude_pr1542/src

$ ./avrdude.exe
Usage: avrdude [options]
Options:
  -p <partno>            Specify AVR device; -p ? lists all known parts
  -p <wildcard>/<flags>  Run developer options for matched AVR devices,
                         e.g., -p ATmega328P/s or /S for part definition
  -b <baudrate>          Override RS-232 baud rate
  -B <bitclock>          Specify bit clock period (us)
  -C <config-file>       Specify location of configuration file
  -c <programmer>        Specify programmer; -c ? and -c ?type list all
  -c <wildcard>/<flags>  Run developer options for matched programmers,
                         e.g., -c 'ur*'/s for programmer info/definition
  -A                     Disable trailing-0xff removal for file/AVR read
  -D                     Disable auto erase for flash memory; implies -A
  -i <delay>             ISP Clock Delay [in microseconds]
  -P <port>              Connection; -P ?s or -P ?sa lists serial ones
  -r                     Reconnect to -P port after "touching" it; wait
                         400 ms for each -r; needed for some USB boards
  -F                     Override invalid signature or initial checks
  -e                     Perform a chip erase
  -O                     Perform RC oscillator calibration (see AVR053)
  -t                     Run an interactive terminal when it is its turn
  -T <terminal cmd line> Run terminal line when it is its turn
  -U <memtype>:r|w|v:<filename>[:format]
                         Carry out memory operation when it is its turn
                         Multiple -t, -T and -U options can be specified
  -n                     Do not write to the device whilst processing -U
  -V                     Do not automatically verify during -U
  -E <exitsp>[,<exitsp>] List programmer exit specifications
  -x <extended_param>    Pass <extended_param> to programmer, see -xhelp
  -v                     Verbose output; -v -v for more
  -q                     Quell progress output; -q -q for less
  -l logfile             Use logfile rather than stderr for diagnostics
  -?                     Display this usage

avrdude version 7.2-20230720, https://github.com/avrdudes/avrdude

$ cat avrdude.conf | grep avrdude_version
avrdude_version = "@AVRDUDE_FULL_VERSION@";

@mcuee
Copy link
Collaborator

mcuee commented Oct 29, 2023

NOTE: I have not tested autotools changes.

No problem. And it indeed does not work. But this is okay, we can leave that to @dl8dtl or someone else.

I will take the liberty and merge this PR now as it sorted out the issue with the main CMake build system.

@mcuee mcuee merged commit 9dfb616 into avrdudes:main Oct 29, 2023
10 checks passed
@mcuee
Copy link
Collaborator

mcuee commented Oct 29, 2023

Full build log under MSYS2 mingw64 using auto-tools, just for reference.

MINGW64 /c/work/avr/avrdude_test/avrdude_pr1542/src
$ ./bootstrap
+ rm -rf autom4te.cache
+ LIBTOOLIZE=libtoolize
+ glibtoolize --version
+ libtoolize
libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
+ aclocal
+ autoheader
+ autoconf
configure.ac:46: warning: AC_PROG_LEX without either yywrap or noyywrap is obsolete
../autoconf-2.71/lib/autoconf/programs.m4:716: _AC_PROG_LEX is expanded from...
../autoconf-2.71/lib/autoconf/programs.m4:709: AC_PROG_LEX is expanded from...
configure.ac:46: the top level
configure.ac:123: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:123: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:123: the top level
configure.ac:243: warning: The macro `AC_HEADER_TIME' is obsolete.
configure.ac:243: You should run autoupdate.
../autoconf-2.71/lib/autoconf/headers.m4:743: AC_HEADER_TIME is expanded from...
configure.ac:243: the top level
configure.ac:265: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:265: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:265: the top level
configure.ac:297: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:297: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:297: the top level
configure.ac:315: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:315: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:315: the top level
configure.ac:327: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:327: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:327: the top level
configure.ac:339: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:339: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:339: the top level
configure.ac:351: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:351: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:351: the top level
configure.ac:474: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:474: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
configure.ac:474: the top level
configure.ac:499: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:499: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
configure.ac:499: the top level
configure.ac:523: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:523: You should run autoupdate.
../autoconf-2.71/lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
configure.ac:523: the top level
+ automake -a -c
configure.ac:37: installing './compile'
configure.ac:28: installing './config.guess'
configure.ac:28: installing './config.sub'
configure.ac:33: installing './install-sh'
configure.ac:33: installing './missing'
Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
doc/Makefile.am:33: installing 'doc/mdate-sh'
doc/Makefile.am:33: installing 'doc/texinfo.tex'

$ ./configure --prefix=/mingw64
configure: loading site script /etc/config.site
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
checking target system type... x86_64-w64-mingw32
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe
checking if the linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /mingw64/bin/nm -B
checking the name lister (/mingw64/bin/nm -B) interface... BSD nm
checking whether ln -s works... no, using cp -pR
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-w64-mingw32 file names to x86_64-w64-mingw32 format... func_convert_file_msys_to_w32
checking how to convert x86_64-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /mingw64/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for sys/time.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for bison... bison -y
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... none needed
checking for library containing yywrap... no
checking whether yytext is a pointer... yes
checking for -ar... ar
checking whether yylex_destroy is generated by flex... version 2.6.4 => yes
checking for WSAStartup in -lws2_32... yes
checking for tputs in -ltermcap... yes
checking for tputs in -lncurses... yes
checking for readline in -lreadline... yes
checking for elf_getshdrstrndx in -lelf... yes
checking for libelf.h... yes
checking for libelf/libelf.h... yes
checking for library containing gethostent... no
checking for library containing setsockopt... none required
checking for usb_get_string_simple in -lusb... yes
checking for usb.h... no
checking for lusb0_usb.h... yes
checking for libusb_init in -lusb-1.0... yes
checking for libusb-1.0/libusb.h... yes
checking for libusb.h... no
checking for libusb_init in -lusb... no
checking for libusb.h... (cached) no
checking for library containing hid_init... -lhidapi
checking for hidapi/hidapi.h... yes
checking for sp_open in -lserialport... yes
checking for libserialport.h... yes
checking for ftdi_new in -lftdi1... yes
checking for ftdi_usb_get_strings in -lftdi... no
checking for ftdi_tcioflush... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for fcntl.h... yes
checking for sys/ioctl.h... no
checking for sys/time.h... (cached) yes
checking for termios.h... no
checking for unistd.h... (cached) yes
checking for ddk/hidsdi.h... no
checking for an ANSI C-conforming const... yes
checking for netinet/in.h... no
checking for memset... yes
checking for select... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for strerror... yes
checking for strncasecmp... yes
checking for strtol... yes
checking for strtoul... yes
checking for gettimeofday... yes
checking for usleep... yes
checking for getaddrinfo... yes
checking for a Win32 HID library... yes
checking for uint_t... no
checking for ulong_t... no
checking for serial device... com1
checking if gcc accepts -Wno-pointer-sign ... yes
checking if gcc accepts -mno-cygwin... no
configure: Your compiler does not understand the -mno-cygwin option.
configure: You might want to select an alternative compiler, like
configure:
configure: CC=mingw32-gcc ./configure
configure:
checking if linker accepts -static... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating doc/Makefile
config.status: creating avrdude.spec
config.status: creating Makefile
config.status: creating avrdude.conf.tmp
config.status: creating ac_cfg.h
config.status: executing depfiles commands
config.status: executing libtool commands


Configuration summary:
----------------------
DO HAVE    libelf
DO HAVE    libusb
DO HAVE    libusb_1_0
DO HAVE    libftdi1
DON'T HAVE libftdi
DO HAVE    libhid
DO HAVE    libhidapi
DON'T HAVE libreadline
DO HAVE    libserialport
DO HAVE    pthread
DISABLED   doc
DISABLED   parport
DISABLED   linuxgpio
DISABLED   linuxspi

$ make
  YACC     config_gram.c
updating config_gram.h
  LEX      lexer.c
make  all-recursive
make[1]: Entering directory '/c/work/avr/avrdude_test/avrdude_pr1542/src'
Making all in .
make[2]: Entering directory '/c/work/avr/avrdude_test/avrdude_pr1542/src'
  CC       avrdude-main.o
  CC       avrdude-whereami.o
  CC       avrdude-developer_opts.o
  CC       libavrdude_a-config_gram.o
  CC       libavrdude_a-lexer.o
  CC       libavrdude_a-arduino.o
  CC       libavrdude_a-avr.o
  CC       libavrdude_a-avr910.o
  CC       libavrdude_a-avrcache.o
  CC       libavrdude_a-avrftdi.o
  CC       libavrdude_a-avrftdi_tpi.o
  CC       libavrdude_a-avrintel.o
  CC       libavrdude_a-avrpart.o
  CC       libavrdude_a-bitbang.o
  CC       libavrdude_a-buspirate.o
  CC       libavrdude_a-butterfly.o
  CC       libavrdude_a-ch341a.o
  CC       libavrdude_a-config.o
  CC       libavrdude_a-confwin.o
  CC       libavrdude_a-crc16.o
  CC       libavrdude_a-dfu.o
  CC       libavrdude_a-dryrun.o
  CC       libavrdude_a-fileio.o
  CC       libavrdude_a-flip1.o
  CC       libavrdude_a-flip2.o
  CC       libavrdude_a-ft245r.o
  CC       libavrdude_a-jtagmkI.o
  CC       libavrdude_a-jtagmkII.o
  CC       libavrdude_a-jtag3.o
  CC       libavrdude_a-leds.o
  CC       libavrdude_a-linuxgpio.o
  CC       libavrdude_a-linuxspi.o
  CC       libavrdude_a-lists.o
  CC       libavrdude_a-micronucleus.o
  CC       libavrdude_a-par.o
  CC       libavrdude_a-pgm.o
  CC       libavrdude_a-pgm_type.o
  CC       libavrdude_a-pickit2.o
  CC       libavrdude_a-pindefs.o
  CC       libavrdude_a-ppi.o
  CC       libavrdude_a-ppiwin.o
  CC       libavrdude_a-serbb_posix.o
  CC       libavrdude_a-serbb_win32.o
  CC       libavrdude_a-ser_avrdoper.o
  CC       libavrdude_a-ser_posix.o
  CC       libavrdude_a-ser_win32.o
  CC       libavrdude_a-serialadapter.o
  CC       libavrdude_a-stk500.o
  CC       libavrdude_a-stk500v2.o
  CC       libavrdude_a-stk500generic.o
  CC       libavrdude_a-strutil.o
  CC       libavrdude_a-teensy.o
  CC       libavrdude_a-term.o
  CC       libavrdude_a-usbasp.o
  CC       libavrdude_a-serialupdi.o
  CC       libavrdude_a-updi_link.o
  CC       libavrdude_a-updi_state.o
  CC       libavrdude_a-updi_readwrite.o
  CC       libavrdude_a-updi_nvm.o
  CC       libavrdude_a-urclock.o
  CC       libavrdude_a-usb_hidapi.o
  CC       libavrdude_a-usb_libusb.o
  CC       libavrdude_a-usbtiny.o
  CC       libavrdude_a-update.o
  CC       libavrdude_a-wiring.o
  CC       libavrdude_a-xbee.o
  AR       libavrdude.a
C:\msys64\mingw64\bin\ar.exe: `u' modifier ignored since `D' is the default (see `U')
  CCLD     avrdude.exe
  CC       libavrdude_la-config_gram.lo
  CC       libavrdude_la-lexer.lo
  CC       libavrdude_la-arduino.lo
  CC       libavrdude_la-avr.lo
  CC       libavrdude_la-avr910.lo
  CC       libavrdude_la-avrcache.lo
  CC       libavrdude_la-avrftdi.lo
  CC       libavrdude_la-avrftdi_tpi.lo
  CC       libavrdude_la-avrintel.lo
  CC       libavrdude_la-avrpart.lo
  CC       libavrdude_la-bitbang.lo
  CC       libavrdude_la-buspirate.lo
  CC       libavrdude_la-butterfly.lo
  CC       libavrdude_la-ch341a.lo
  CC       libavrdude_la-config.lo
  CC       libavrdude_la-confwin.lo
  CC       libavrdude_la-crc16.lo
  CC       libavrdude_la-dfu.lo
  CC       libavrdude_la-dryrun.lo
  CC       libavrdude_la-fileio.lo
  CC       libavrdude_la-flip1.lo
  CC       libavrdude_la-flip2.lo
  CC       libavrdude_la-ft245r.lo
  CC       libavrdude_la-jtagmkI.lo
  CC       libavrdude_la-jtagmkII.lo
  CC       libavrdude_la-jtag3.lo
  CC       libavrdude_la-leds.lo
  CC       libavrdude_la-linuxgpio.lo
  CC       libavrdude_la-linuxspi.lo
  CC       libavrdude_la-lists.lo
  CC       libavrdude_la-micronucleus.lo
  CC       libavrdude_la-par.lo
  CC       libavrdude_la-pgm.lo
  CC       libavrdude_la-pgm_type.lo
  CC       libavrdude_la-pickit2.lo
  CC       libavrdude_la-pindefs.lo
  CC       libavrdude_la-ppi.lo
  CC       libavrdude_la-ppiwin.lo
  CC       libavrdude_la-serbb_posix.lo
  CC       libavrdude_la-serbb_win32.lo
  CC       libavrdude_la-ser_avrdoper.lo
  CC       libavrdude_la-ser_posix.lo
  CC       libavrdude_la-ser_win32.lo
  CC       libavrdude_la-serialadapter.lo
  CC       libavrdude_la-stk500.lo
  CC       libavrdude_la-stk500v2.lo
  CC       libavrdude_la-stk500generic.lo
  CC       libavrdude_la-strutil.lo
  CC       libavrdude_la-teensy.lo
  CC       libavrdude_la-term.lo
  CC       libavrdude_la-usbasp.lo
  CC       libavrdude_la-serialupdi.lo
  CC       libavrdude_la-updi_link.lo
  CC       libavrdude_la-updi_state.lo
  CC       libavrdude_la-updi_readwrite.lo
  CC       libavrdude_la-updi_nvm.lo
  CC       libavrdude_la-urclock.lo
  CC       libavrdude_la-usb_hidapi.lo
  CC       libavrdude_la-usb_libusb.lo
  CC       libavrdude_la-usbtiny.lo
  CC       libavrdude_la-update.lo
  CC       libavrdude_la-wiring.lo
  CC       libavrdude_la-xbee.lo
  CCLD     libavrdude.la
libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only
make[2]: Leaving directory '/c/work/avr/avrdude_test/avrdude_pr1542/src'
make[1]: Leaving directory '/c/work/avr/avrdude_test/avrdude_pr1542/src'

@MCUdude
Copy link
Collaborator

MCUdude commented Oct 29, 2023

@mcuee it would be great if you gave us some time to rewiew before merging. There's no rush 😊

I would suggest to move the Avrdude version to the top of the file (or almost at the top) instead of line 436.

@mcuee
Copy link
Collaborator

mcuee commented Oct 29, 2023

Sorry about this. I was too eager to merge the PR as @Youw is rather busy and I do not want him to spend too much time on this one.

Now that the foundation is there, you or others can further improve.

@mcuee
Copy link
Collaborator

mcuee commented Oct 29, 2023

@Youw

I think @MCUdude's comment is valid. If it is not too troublesome, is it possible for you to create a new PR to move the version to the top of the file? Thanks.

@MCUdude
Copy link
Collaborator

MCUdude commented Oct 29, 2023

@mcuee I can do that of @Youw is busy

@mcuee
Copy link
Collaborator

mcuee commented Oct 29, 2023

@mcuee I can do that of @Youw is busy

@MCUdude
Thanks. Please go ahead.

@@ -543,6 +543,9 @@ AC_CONFIG_FILES([
Makefile
])

# Pass into avrdude.conf.in
AVRDUDE_FULL_VERSION='$(VERSION)'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm no autotools expert (nor user for that matter), but my guess is that one more line is missing to make it work:

AC_SUBST(AVRDUDE_FULL_VERSION, $AVRDUDE_FULL_VERSION)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe even:

AC_SUBST(AVRDUDE_FULL_VERSION, '$(VERSION)')

instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding the Avrdude build version to avrdude.conf
3 participants