From 2fbe057b57da78781c2bb36b7ea2e117670642af Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 24 Apr 2023 11:20:16 +0100 Subject: [PATCH 1/3] Document -n behaviour wrt -U and terminal --- src/avrdude.1 | 5 +++-- src/doc/avrdude.texi | 4 ++-- src/main.c | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index 5d90c4fc..1a2e150c 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -586,9 +586,10 @@ written to .Va stderr anyway. .It Fl n -No-write - disables actually writing data to the MCU (useful for debugging +No-write: disables writing data to the MCU whilst processing -U +(useful for debugging .Nm avrdude -). +). The terminal mode continues to write to the device. .It Fl O Perform a RC oscillator run-time calibration according to Atmel application note AVR053. diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index a37a6d82..6560bd20 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -667,8 +667,8 @@ Note that initial diagnostic messages (during option parsing) are still written to @var{stderr} anyway. @item -n -No-write - disables actually writing data to the MCU (useful for -debugging AVRDUDE). +No-write: disables writing data to the MCU whilst processing -U (useful for +debugging AVRDUDE). The terminal mode continues to write to the device. @item -O Perform a RC oscillator run-time calibration according to Atmel diff --git a/src/main.c b/src/main.c index d3376691..619daee0 100644 --- a/src/main.c +++ b/src/main.c @@ -241,7 +241,7 @@ static void usage(void) " Memory operation specification\n" " Multiple -U options are allowed, each request\n" " is performed in the order specified\n" - " -n Do not write anything to the device\n" + " -n Do not write to the device whilst processing -U\n" " -V Do not verify\n" " -t Enter terminal mode\n" " -E [,] List programmer exit specifications\n" @@ -1471,6 +1471,8 @@ int main(int argc, char * argv []) /* * terminal mode */ + if (uflags & UF_NOWRITE) + pmsg_warning("the terminal ignores option -n, that is, it writes to the device\n"); exitrc = terminal_mode(pgm, p); } From 532387c5a26cab47c6f8ed27af1ed2ef159cad0f Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 1 May 2023 18:48:30 +0100 Subject: [PATCH 2/3] Update documentation for -n, -V and -x help --- src/avrdude.1 | 8 ++++++-- src/doc/avrdude.texi | 5 +++-- src/main.c | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index 1a2e150c..c9119354 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -845,14 +845,18 @@ More .Fl v options increase verbosity level. .It Fl V -Disable automatic verify check when uploading data. +Disable automatic verify check when uploading data with -U. .It Fl x Ar extended_param Pass .Ar extended_param to the chosen programmer implementation as an extended parameter. The interpretation of the extended parameter depends on the programmer itself. -See below for a list of programmers accepting extended parameters. +See below for a list of programmers accepting extended parameters +or issue +.Nm +-x help ... to see the extended options of the chosen programmer. + .El .Ss Terminal mode In this mode, diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index 6560bd20..fa755eb9 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -904,13 +904,14 @@ Enable verbose output. More @code{-v} options increase verbosity level. @item -V -Disable automatic verify check when uploading data. +Disable automatic verify check when uploading data with @code{-U}. @item -x @var{extended_param} Pass @var{extended_param} to the chosen programmer implementation as an extended parameter. The interpretation of the extended parameter depends on the programmer itself. See below for a list of programmers -accepting extended parameters. +accepting extended parameters or issue @code{avrdude -x help ...} to +see the extended options of the chosen programmer. @end table diff --git a/src/main.c b/src/main.c index 619daee0..4f64868c 100644 --- a/src/main.c +++ b/src/main.c @@ -242,7 +242,7 @@ static void usage(void) " Multiple -U options are allowed, each request\n" " is performed in the order specified\n" " -n Do not write to the device whilst processing -U\n" - " -V Do not verify\n" + " -V Do not automatically verify during -U\n" " -t Enter terminal mode\n" " -E [,] List programmer exit specifications\n" " -x Pass to programmer, see -xhelp\n" @@ -511,6 +511,7 @@ int main(int argc, char * argv []) const char *exitspecs; /* exit specs string from command line */ const char *programmer; /* programmer id */ int explicit_c; /* 1=explicit -c on command line, 0=not spcified there */ + int explicit_e; /* 1=explicit -e on command line, 0=not spcified there */ char sys_config[PATH_MAX]; /* system wide config file */ char usr_config[PATH_MAX]; /* per-user config file */ char executable_abspath[PATH_MAX]; /* absolute path to avrdude executable */ @@ -602,6 +603,7 @@ int main(int argc, char * argv []) pgm = NULL; programmer = ""; explicit_c = 0; + explicit_e = 0; verbose = 0; baudrate = 0; bitclock = 0.0; @@ -718,6 +720,7 @@ int main(int argc, char * argv []) case 'e': /* perform a chip erase */ erase = 1; + explicit_e = 1; uflags &= ~UF_AUTO_ERASE; break; @@ -1454,7 +1457,7 @@ int main(int argc, char * argv []) * before the chip can accept new programming */ if (uflags & UF_NOWRITE) { - pmsg_warning("conflicting -e and -n options specified, NOT erasing chip\n"); + pmsg_warning("%s-n specified, NOT erasing chip\n", explicit_e? "conflicting -e and ": ""); } else { pmsg_info("erasing chip\n"); exitrc = avr_chip_erase(pgm, p); From e4cef21030f1ed87396864195a7d085a87ff26d0 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 3 May 2023 10:54:39 +0100 Subject: [PATCH 3/3] Ensure pmsg_xyz() messages always start on a new line --- src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.c b/src/main.c index 4f64868c..322e904f 100644 --- a/src/main.c +++ b/src/main.c @@ -124,6 +124,8 @@ int avrdude_message2(FILE *fp, int lno, const char *file, const char *func, int // Reduce effective verbosity level by number of -q above one when printing to stderr if ((quell_progress < 2 || fp != stderr? verbose: verbose+1-quell_progress) >= msglvl) { if(msgmode & MSG2_PROGNAME) { + if(!bols[bi].bol) + fprintf(fp, "\n"); fprintf(fp, "%s", progname); if(verbose >= MSG_NOTICE && (msgmode & MSG2_FUNCTION)) fprintf(fp, " %s()", func);