Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into test_pr1540
Browse files Browse the repository at this point in the history
  • Loading branch information
mcuee committed Nov 1, 2023
2 parents e95c8e1 + 2bb36b9 commit a193aa7
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 12 deletions.
19 changes: 10 additions & 9 deletions src/avrdude.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
#
# AVRDUDE Configuration File
#
# This file contains configuration data used by AVRDUDE which describes
# the programming hardware pinouts and also provides part definitions.

avrdude_conf_version = "@AVRDUDE_FULL_VERSION@";

# This file contains AVRDUDE's default configuration data describing
# programming hardware pinouts and part definitions. Normally, it
# requires AVRDUDE be of the same or higher version than above string.
# AVRDUDE's -C command line option specifies the location of the
# configuration file. The -c option names the programmer configuration
# which must match one of the entry's id parameter. The -p option
# identifies which part AVRDUDE is going to be programming and must match
# one of the parts' id parameters.
# configuration file. The -c option names the programmer configuration
# which must match one of the entry's id parameter. The -p option
# identifies which part AVRDUDE is going to be programming and must
# match one of the parts' id parameters.
#
# DO NOT MODIFY THIS FILE. Modifications will be overwritten the next
# time a "make install" is run. For user-specific additions, use the
Expand Down Expand Up @@ -432,9 +436,6 @@
# ATmega8 0x76
# ATmega169 0x78

# Buildtime configuration
avrdude_version = "@AVRDUDE_FULL_VERSION@";

#
# Overall avrdude defaults; suitable for ~/.config/avrdude/avrdude.rc
#
Expand Down
2 changes: 2 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#include "config_gram.h"

const char *avrdude_conf_version;

const char *default_programmer;
const char *default_parallel;
const char *default_serial;
Expand Down
6 changes: 6 additions & 0 deletions src/config_gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static int pin_name;

%token K_ALIAS
%token K_ALLOW_SUBSHELLS
%token K_AVRDUDE_CONF_VERSION
%token K_BUFF
%token K_CONNTYPE
%token K_DEDICATED
Expand Down Expand Up @@ -213,6 +214,11 @@ def :

part_def TKN_SEMI |

K_AVRDUDE_CONF_VERSION TKN_EQUAL TKN_STRING TKN_SEMI {
avrdude_conf_version = cache_string($3->value.string);
free_token($3);
} |

K_DEFAULT_PROGRAMMER TKN_EQUAL TKN_STRING TKN_SEMI {
default_programmer = cache_string($3->value.string);
free_token($3);
Expand Down
5 changes: 3 additions & 2 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ AC_CONFIG_FILES([
Makefile
])

# Pass into avrdude.conf.in
AVRDUDE_FULL_VERSION='$(VERSION)'
# Pass version number into avrdude.conf
AVRDUDE_FULL_VERSION=$PACKAGE_VERSION
AC_SUBST(AVRDUDE_FULL_VERSION, $AVRDUDE_FULL_VERSION)

# The procedure to create avrdude.conf involves two steps. First,
# normal autoconf substitution will be applied, resulting in
Expand Down
2 changes: 1 addition & 1 deletion src/developer_opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ void dev_output_pgm_part(int dev_opt_c, const char *programmer, int dev_opt_p, c
char *p;

dev_print_comment(cfg_get_prologue());

dev_info("avrdude_conf_version = %s;\n\n", p = cfg_escape(avrdude_conf_version)); free(p);
dev_info("default_programmer = %s;\n", p = cfg_escape(default_programmer)); free(p);
dev_info("default_parallel = %s;\n", p = cfg_escape(default_parallel)); free(p);
dev_info("default_serial = %s;\n", p = cfg_escape(default_serial)); free(p);
Expand Down
3 changes: 3 additions & 0 deletions src/doc/avrdude.texi
Original file line number Diff line number Diff line change
Expand Up @@ -2843,6 +2843,9 @@ the executable.

@table @code

@item avrdude_conf_version = "@var{build-time-version}";
Automatically set during the build process.

@item default_parallel = "@var{default-parallel-device}";
Assign the default parallel port device. Can be overridden using the
@option{-P} option.
Expand Down
1 change: 1 addition & 0 deletions src/lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ INF [Ii][Nn][Ff]([Ii][Nn][Ii][Tt][Yy])?
alias { yylval=NULL; return K_ALIAS; }
allow_subshells { yylval=NULL; return K_ALLOW_SUBSHELLS; }
allowfullpagebitstream { yylval=NULL; ccap(); return K_ALLOWFULLPAGEBITSTREAM; }
avrdude_conf_version { yylval=NULL; return K_AVRDUDE_CONF_VERSION; }
buff { yylval=NULL; ccap(); return K_BUFF; }
chip_erase { yylval=new_token(K_CHIP_ERASE); ccap(); return K_CHIP_ERASE; }
connection_type { yylval=NULL; ccap(); return K_CONNTYPE; }
Expand Down
1 change: 1 addition & 0 deletions src/libavrdude.h
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@ void walk_programmer_types(/*LISTID programmer_types,*/ walk_programmer_types_cb

extern LISTID part_list;
extern LISTID programmers;
extern const char *avrdude_conf_version;
extern const char *default_programmer;
extern const char *default_parallel;
extern const char *default_serial;
Expand Down
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ int main(int argc, char * argv [])
progname[strlen(progname)-4] = 0;
}

avrdude_conf_version = "";

default_programmer = "";
default_parallel = "";
default_serial = "";
Expand Down

0 comments on commit a193aa7

Please sign in to comment.