diff --git a/ChangeLog b/ChangeLog index 46d97e17..a834c4f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,21 @@ +2011-08-26 Joerg Wunsch + + Submitted by Stefan Tomanek: + patch #7542: add default_bitclock to configuration files + * config.c: Add the new keyword and its handling. + * config.h: (Ditto.) + * config_gram.y: (Ditto.) + * avrdude.conf.in: (Ditto.) + * main.c: (Ditto.) + * lexer.l: (Ditto.) + * avrdude.1: Document the change. + * doc/avrdude.texi: (Ditto.) + 2011-08-26 Joerg Wunsch Submitted by Brett Hagman: - Add support for the "Wiring" board/bootloader + patch #7603: wiring - programmer type for Wiring boards + (based on STK500v2) * wiring.c: New file. * wiring.h: (Ditto.) * Makefile.am: Add new files. diff --git a/avrdude.1 b/avrdude.1 index 44ea4e70..a8fe0974 100644 --- a/avrdude.1 +++ b/avrdude.1 @@ -330,6 +330,10 @@ Unlike certain parameters in the STK500, the JTAG ICE resets all its parameters to default values when the programming software signs off from the ICE, so for MCUs running at lower clock speeds, this parameter must be specified on the command-line. +You can use the 'default_bitclock' keyword in your +.Pa ${HOME}/.avrduderc +file to assign a default value to keep from having to specify this +option on every invocation. .It Fl c Ar programmer-id Use the pin configuration specified by the argument. Pin configurations are read from the config file (see the diff --git a/avrdude.conf.in b/avrdude.conf.in index 9f0b0f88..8b6e6317 100644 --- a/avrdude.conf.in +++ b/avrdude.conf.in @@ -316,6 +316,7 @@ # default_parallel = "@DEFAULT_PAR_PORT@"; default_serial = "@DEFAULT_SER_PORT@"; +# default_bitclock = 2.5 # diff --git a/config.c b/config.c index 7105884a..6f0b571d 100644 --- a/config.c +++ b/config.c @@ -35,6 +35,7 @@ char default_programmer[MAX_STR_CONST]; char default_parallel[PATH_MAX]; char default_serial[PATH_MAX]; +double default_bitclock; char string_buf[MAX_STR_CONST]; char *string_buf_ptr; diff --git a/config.h b/config.h index e557bf4d..02355795 100644 --- a/config.h +++ b/config.h @@ -57,6 +57,7 @@ extern LISTID programmers; extern char default_programmer[]; extern char default_parallel[]; extern char default_serial[]; +extern double default_bitclock; diff --git a/config_gram.y b/config_gram.y index 0e1af900..1de7d650 100644 --- a/config_gram.y +++ b/config_gram.y @@ -94,6 +94,7 @@ static int parse_cmdbits(OPCODE * op); %token K_DEFAULT_PARALLEL %token K_DEFAULT_PROGRAMMER %token K_DEFAULT_SERIAL +%token K_DEFAULT_BITCLOCK %token K_DESC %token K_DEVICECODE %token K_DRAGON_DW @@ -273,6 +274,11 @@ def : strncpy(default_serial, $3->value.string, PATH_MAX); default_serial[PATH_MAX-1] = 0; free_token($3); + } | + + K_DEFAULT_BITCLOCK TKN_EQUAL TKN_NUMBER TKN_SEMI { + default_bitclock = $3->value.number; + free_token($3); } ; diff --git a/doc/avrdude.texi b/doc/avrdude.texi index 18bc4a50..17db40e6 100644 --- a/doc/avrdude.texi +++ b/doc/avrdude.texi @@ -427,6 +427,8 @@ Unlike certain parameters in the STK500, the JTAG ICE resets all its parameters to default values when the programming software signs off from the ICE, so for MCUs running at lower clock speeds, this parameter must be specified on the command-line. +It can also be set in the configuration file by using the 'default_bitclock' +keyword. @item -c @var{programmer-id} Specify the programmer to be used. AVRDUDE knows about several common @@ -1485,6 +1487,10 @@ Assign the default serial port device. Can be overridden using the Assign the default programmer id. Can be overridden using the @option{-c} option. +@item default_bitclock = "@var{default-bitclock}"; +Assign the default bitclock value. Can be overridden using the @option{-B} +option. + @end table diff --git a/lexer.l b/lexer.l index 980eb3ba..cc3a40f3 100644 --- a/lexer.l +++ b/lexer.l @@ -135,6 +135,7 @@ desc { yylval=NULL; return K_DESC; } default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; } default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; } default_serial { yylval=NULL; return K_DEFAULT_SERIAL; } +default_bitclock { yylval=NULL; return K_DEFAULT_BITCLOCK; } devicecode { yylval=NULL; return K_DEVICECODE; } dragon_dw { yylval=NULL; return K_DRAGON_DW; } dragon_hvsp { yylval=NULL; return K_DRAGON_HVSP; } diff --git a/main.c b/main.c index 4d1ee273..13c7fa48 100644 --- a/main.c +++ b/main.c @@ -314,6 +314,7 @@ int main(int argc, char * argv []) default_parallel[0] = 0; default_serial[0] = 0; + default_bitclock = 0.0; init_config(); @@ -607,6 +608,10 @@ int main(int argc, char * argv []) } } } + // set bitclock from configuration files unless changed by command line + if (default_bitclock > 0 && bitclock == 0.0) { + bitclock = default_bitclock; + } if (verbose) { fprintf(stderr, "\n");