Merge pull request #1547 from stefanrueger/parse-avrdude_version

Add avrdude_conf_version to grammar
This commit is contained in:
Stefan Rueger
2023-10-30 14:26:21 +00:00
committed by GitHub
9 changed files with 29 additions and 12 deletions

View File

@@ -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
@@ -432,9 +436,6 @@
# ATmega8 0x76
# ATmega169 0x78
# Buildtime configuration
avrdude_version = "@AVRDUDE_FULL_VERSION@";
#
# Overall avrdude defaults; suitable for ~/.config/avrdude/avrdude.rc
#

View File

@@ -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;

View File

@@ -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
@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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.

View File

@@ -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; }

View File

@@ -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;

View File

@@ -571,6 +571,8 @@ int main(int argc, char * argv [])
progname[strlen(progname)-4] = 0;
}
avrdude_conf_version = "";
default_programmer = "";
default_parallel = "";
default_serial = "";