Commit Graph

775 Commits

Author SHA1 Message Date
Stefan Rueger 7fab75336e
Replace tabs in avrdude.conf.in with spaces 2022-08-24 11:46:24 +01:00
Stefan Rueger 716984dbb1
Reformat conditional programmers in avrdude.conf.in using -c* 2022-08-24 10:57:25 +01:00
Stefan Rueger 57ebd36a01
Rewrite avrdude.conf.in file from avrdude -c* -p* output
Some manual editing is still necessary to cater for the
@HAVE_PARPORT_BEGIN@ etc sections. This commit also fixes
superfluous whitesapce at the end of avrdude.conf.in lines

Although the avrdude.conf file has changed much, the internal
representation in avrdude has not. This can be verified by
exporting the raw internal data through

  avrdude -c*/r -p*/r >/tmp/avrdude.raw

before the change and by comparing again after the change:

  avrdude -c*/r -p*/r | diff - /tmp/avrdude.raw
2022-08-24 01:10:51 +01:00
Stefan Rueger 09d14601af
Fix 4 parts wrt to their interfaces in avrdude.conf 2022-08-24 00:54:11 +01:00
Stefan Rueger 3e49f078b3
Harden list management in pgm.c/config_gram.y 2022-08-24 00:03:45 +01:00
Stefan Rueger 88c48cdf82
Merge pull request #1074 from stefanrueger/1073
Correct flash paged write for avrftdi.c
2022-08-23 17:09:46 +01:00
Stefan Rueger fc6ef68b98
Merge pull request #1083 from stefanrueger/1081
Make avr910 programmer initialize() less verbose
2022-08-23 17:08:23 +01:00
Stefan Rueger 61efb02ef8
Merge pull request #1078 from stefanrueger/terminal
Use const for programmer functions where useful
2022-08-23 17:06:53 +01:00
Stefan Rueger 5f910580b7
Extend const args to avr_set_*() and developer_opts.c
... and print programming modes for -p*/d
2022-08-23 16:57:49 +01:00
Stefan Rueger c6ef6a9b9b
Adapt indentation of a line in buspirate.c to neighbouring lines 2022-08-22 00:00:39 +01:00
Stefan Rueger c7951813ef
Make avr910 programmer initialize() less verbose 2022-08-21 23:49:54 +01:00
Stefan Rueger 56aae55737
Replace loop/if condition and reduce signed comparison warnings in avrftfi.c
Change (int) poll_index >= (int) addr to poll_index+1 > addr as the former
might turn out to be implementation-defined. The latter is always defined
and what we want here (poll_index+1 won't overflow). Originally, the
condition was poll_index > addr-1, which was always false for addr=0 owing to
2^n modulo arithmetic of unsigned.

Also changed a few comparisons so they no longer are between signed
and unsigned integers reducing compiler warnings.
2022-08-21 00:05:44 +01:00
Stefan Rueger f8dd9bc97d
Correct flash paged write for avrftdi.c 2022-08-20 14:08:04 +01:00
Stefan Rueger 38aa1313f9
Print device code in avr910.c as unsigned char 2022-08-19 23:14:19 +01:00
Stefan Rueger c03f4a7925
Use const in PROGRAMMER function arguments where appropriate
In order to get meaningful const properties for the PROGRAMMER, AVRPART and
AVRMEM arguments, some code needed to be moved around, otherwise a network of
"tainted" assignments risked rendering nothing const:

 - Change void (*enable)(PROGRAMMER *pgm) to void (*enable)(PROGRAMMER *pgm,
   const AVRPART *p); this allows changes in the PROGRAMMER structure after
   the part is known. For example, use TPI, UPDI, PDI functions in that
   programmer appropriate to the part. This used to be done later in the
   process, eg, in the initialize() function, which "taints" all other
   programmer functions wrt const and sometimes requires other finessing with
   flags etc. Much clearer with the modified enable() interface.

 - Move TPI initpgm-type code from initialize() to enable() --- note that
   initpgm() does not have the info at the time when it is called whether or
   not TPI is required

 - buspirate.c: move pgm->flag to PDATA(pgm)->flag (so legitimate
   modification of the flag does not change PROGRAMMER structure)

 - Move AVRPART_INIT_SMC and AVRPART_WRITE bits from the flags field in
   AVRPART to jtagmkII.c's private data flags32 fiels as FLAGS32_INIT_SMC and
   FLAGS32_WRITE bits

 - Move the xbeeResetPin component to private data in stk500.c as this is
   needed by xbee when it saddles on the stk500 code (previously, the flags
   component of the part was re-dedicated to this)

 - Change the way the "chained" private data are used in jtag3.c whilst
   keeping the PROGRAMMER structure read-only otherwise

 - In stk500v2.c move the STK600 pgm update from stk500v2_initialize() to
   stk500v2_enable() so the former keeps the PROGRAMMER structure read-only
   (for const assertion).

 - In usbasp change the code from changing PROGRAMMER functions late to
   dispatching to TPI or regular SPI protocol functions at runtime; reason
   being the decision whether to use TPI protocol is done at run-time
   depending on the capability of the attached programmer

Also fixes Issue #1071, the treatment of default eecr value.
2022-08-17 16:05:28 +01:00
Stefan Rueger dfef8bb0a8
Add libavrdude functions avr_mem_is_flash_type() and avr_mem_is_eeprom_type() 2022-08-15 14:57:12 +01:00
Stefan Rueger e332ecf0b4
Change array for copy mem->desc to const char * in term.c 2022-08-15 14:25:58 +01:00
Stefan Rueger 4c6ba0aae6
Merge pull request #1063 from sbngross/main
man-page: Fix logfile short option
2022-08-15 00:49:39 +01:00
Stefan Rueger 0b94ffdd3b
Merge pull request #1059 from stefanrueger/programmer-devopts
Implement -c <wildcard>/dev_options for printing programmer entries of avrdude.conf
2022-08-15 00:48:35 +01:00
Stefan Rueger 297740db0e
Stop listing programmers where id starts with . 2022-08-13 22:57:54 +01:00
Stefan Rueger c9736a9db5
Specifying the full memory name now always works
... even if a memory with longer name and same initial part exists
2022-08-13 20:51:31 +01:00
brutzzl3r 266eb23207 man-page: Fix install dir
`avrdude.1` is installed into `man` dir instead of its proper section
location.
This is due to the definition of `TYPE MAN` which points to
`<DATAROOT>/man` according to cmake docs.

Use `DESTINATION` and add proper section subdir.

This allows for `man -M <YOUR INSTALL dir>/share/man -w 1 avrdude` to succeed
instead of throwing `No manual entry for avrdude in section 1`

Signed-off-by: brutzzl3r <s3b.gr0ss@gmail.com>
2022-08-12 19:49:47 +02:00
Stefan Rueger 533feec4ed
Revert grammar to remove introduced shift/reduce conflicts 2022-08-12 15:52:51 +01:00
Stefan Rueger 8420b27233
Address compiler warnings in 4 source files 2022-08-12 14:58:21 +01:00
Stefan Rueger c2c9053b13
Show comments with -p*/s or -c*/s and reduce -p */r raw output 2022-08-12 00:28:54 +01:00
brutzzl3r 346de71cd5 man-page: Fix logfile short option
man synopsis states [-n -logfile] option. Later on in avrdude.1 as well as in
main.c -l is used.
Also '-logfile' is no option alternative but a parameter.
This is a minor issue but still confusing when one uses / to search
through man pages.

-- Always leave the code cleaner than you found it --

Signed-off-by: brutzzl3r <s3b.gr0ss@gmail.com>
2022-08-11 20:11:48 +02:00
Stefan Rueger ccb576ebc1
Ensure memories are printed at most once for -p */S 2022-08-10 22:25:19 +01:00
Stefan Rueger c9cf308037
Include ctype.h in term.c to resolve missing functions 2022-08-10 16:24:39 +01:00
Stefan Rueger f4c5a8350d
Replace string arrays with const char * and allocated space (part 2)
This commit replaces fixed-string buffers in PROGRAMMER, AVRPART and AVRMEM
that are dealt with by the parser and grammar. Now, string assignments are
always to const char *, ie, these are read-only strings with arbitrary
length.

config_gram.y now only needs to consider one type of string assignment.

This commit also

  - Replaces the simple linear-search cache_string() function with faster
    hashed cache_string(). Either way, the returned value is likely to be
    shared, so should never be free()'d.

  - Duplicates hvupdi_support list in pgm_dup() and frees it in pgm_free()

  - Adds const qualifier to some function args in avrpart.c and pgm.c

  - Hardens some functions against being called with NULL pointers

  - Ensures _new() and _dup() functions for parts, programmers and memory
    return a suitable memory. Out of memory triggers exit in one of three
    functions, cfg_malloc(), cfg_realloc() and cfg_strdup(); there is
    rarely anything useful that AVRDUDE or, for that matter, any
    application compiled against libavrdude can do once you run out of
    memory as AVRDUDE/libavrdude rely heavily on allocation of memory.
2022-08-10 16:14:56 +01:00
Stefan Rueger 7375477f70
Replace string arrays with const char * and allocated space (part 1)
This commit deals with default_programmer, default_serial, default_parallel
and default_spi. The long term objective is to remove all fixed-size buffers
from the structures that lexer.l and config_gram.y deal with.
2022-08-10 11:36:17 +01:00
Stefan Rueger 22c4dbf23e
Harden string processing during parsing in lexer.l, config_gram.y and otherwise
- Replace strdup(s) with cfg_strdup(funname, s) that exits on out of mem
 - Replace malloc(n) with cfg_malloc(funname, n) that exits on out of mem
 - Change multiline string scanning in lexer.l to avoid core dump
 - Remove global variables string_buf and string_bug_ptr
 - Ensure reading strings unescapes strings C-Style
 - Ensure writing strings escapes strings C-Style again

Commit looks longer than needed as unescape() and auxiliary functions needed
to be moved from term.c (not in libavrdude) to config.c (in libavrdude).
2022-08-09 21:20:44 +01:00
Stefan Rueger 8a717987ec
Change unsigned short eecr; to unsigned char eecr; in libavrdude's AVRPART 2022-08-09 13:19:40 +01:00
Stefan Rueger 7c8d336e27
Change dev_info() to stdout and no longer redirect stderr to stdout 2022-08-09 09:23:26 +01:00
Stefan Rueger c21be27a7d
Replace const char array indexing with equivalent code in pindefs.c 2022-08-08 17:27:38 +01:00
Stefan Rueger 1da97f6825
Adjust declaration of locate_programmer_type_id() to definition 2022-08-08 17:21:21 +01:00
Stefan Rueger f25bc55806
Treat -c* the same as -c*/s 2022-08-08 17:03:06 +01:00
Stefan Rueger 49fcd8a96e
Implement -c */[sSA] (syntax-correct dump of programmer structure) 2022-08-08 16:52:09 +01:00
Stefan Rueger 075dee1dd3
Implement -c */r (raw dump of programmer structure) 2022-08-07 17:52:17 +01:00
Stefan Rueger 08049a40ea
Implement dev option -c */[ASsrt] skeleton
Also changed usbdev, usbsn, usbvendor and usbproduct components from
PROGRAMMER structure to be cached string pointers rather than fixed-size
arrays. These will be initialised by pgm_new() with a pointer to nul;
2022-08-07 14:06:04 +01:00
Stefan Rueger 81136688f6
Establish a third option to print out part definitions
Introduced -p <part>/A, which prints what -p <part>/S used to print, ie, all
components of the part structures including the default ones. Now -p <part>/S
prints the expanded part structure without use of parent and without printing
default values. This functionality is new and predominantly needed for
checking specific avrdude.conf entries, eg, avrdude -p*/St | grep pollindex

The option -p <part>/s continues to print a short entry of `avrdude.conf`
using its parent if so defined:

$ avrdude -p m328p/s

part parent "m328"
    desc                = "ATmega328P";
    id                  = "m328p";
    signature           = 0x1e 0x95 0x0f;
;
2022-08-07 08:53:24 +01:00
Stefan Rueger a8bbedcde3
Switch from strerror_r() to strerror() in update.c for portability 2022-08-06 00:20:43 +01:00
Stefan Rueger e681035cc4
Add strerror_r() and access() modes to MSVC compat file 2022-08-05 18:47:40 +01:00
Stefan Rueger e590aead93
Treat comparison of different signedness warning in fileio.c 2022-08-05 18:04:46 +01:00
Stefan Rueger b24a1cf667
Implement a dry run for -U updates before opening the programmer
This commit checks -U update requests for
  - Typos in memory names
  - Whether the files can be written or read
  - Automatic format detection if necessary

before opening the programmer. This to reduce the chances of the
programming failing midway through.

Minor additional changes:
  - Give strerror() system info when files are not read/writeable
  - Lift the auto detection message from MSG_INFO to MSG_NOTICE
  - Provide fileio_fmt_autodetect() in the AVRDUDE library
  - Rename fmtstr() in the AVRDUDE library to fileio_fmtstr() to
    avoid name clashes when an application links with it

Example:

$ avrdude -U - -U typo:r:.:h -U eeprom:w:testin:r -p ... -c ...
avrdude: can't auto detect file format for stdin/out, specify explicitly
avrdude: unknown memory type typo
avrdude: file . is not writeable (not a regular or character file?)
avrdude: file testin is not readable. No such file or directory
2022-08-05 17:38:59 +01:00
Stefan Rueger 5f5002eeaa Change name of update helper functions for print messages 2022-08-04 18:25:14 +01:00
Stefan Rueger ed36c7e1f6
Merge branch 'main' into fix_1041 2022-08-04 18:03:49 +01:00
Stefan Rueger 3412196cd9 Weaken -U memory type check and move after config file parsing in main.c
The check for typos in -U memory names against a list of known memory names
now happens after the config files have been read, so newly declared memory
names can be considered. This commit also weakens the check against existence
of a known memory: it is now sufficent for a name to pass when it could be
the initial string of any known memory of any part. Any -U memory that cannot
possibly be matched up with a known memory is considered a typo and leads to
an exit before the programmer is opened.

This to protect users from typos that leave a device partially programmed.

When every -U memory name might be matching one of the known memories, the
programming is attempted. If the part to be programmed turns out not to have
a particular -U memory, AVRDUDE warns the user and skips this -U update.

This to support unifying interfaces that call AVRDUDE with potentially more
memories than the actual part has (eg, efuse on ATmega8).
2022-08-04 00:14:19 +01:00
Stefan Rueger 648f3319a9 Ignore target memories not present in part
$ avrdude -qp m8 -c ... -U efuse:w:0xff:m && echo OK

avrdude: AVR device initialized and ready to accept instructions
avrdude: skipping -U efuse:... as memory not defined for part ATmega8

avrdude done.  Thank you.

OK
2022-08-03 00:23:15 +01:00
Stefan Rueger 9604a3ef36 Check -U option for unknown memories during parsing
$ avrdude -qp ATmega2560 -c usbtiny -U flesh:w:blink-mega2560+lext-test.hex:i
avrdude: unknown memory type flesh
avrdude: error parsing update operation 'flesh:w:blink-mega2560+lext-test.hex:i'
2022-08-03 00:04:14 +01:00
Stefan Rueger 42c8169c37 Add ordered list of known memories to avr.c with access functions 2022-08-02 23:53:00 +01:00
Stefan Rueger 02027ab766 Enable stdin verification and display correct number of bytes written/verified
Counting the number of bytes written to a memory and/or verified is not
trivial owing to potential holes in the input file and to potential trailing
0xff bytes in flash memory that are not written per default (but see -A). The
new function memstats(), which is best called just after an input file has
been read into mem->buf/mem->tags, computes the right number of bytes written
and allows easy computation of the number of bytes verified.

This commit also changes the strategy for the default verification after
writing to a chip memory, so that the input file only needs reading once thus
enabling successful verification of stdin input files.

Other, minor changes:
 - Improving the grammar of AVRDUDE output, eg, 1 byte written instead of
   1 bytes written
 - Better description of the input file structure in terms of its sections,
   the interval it spans, the number  of pages, the number of padding bytes
   in pages, and the number of actually cut off trailing 0xff bytes for flash
 - Printing <stdin> or <stdout> instead of - in the -U routines
 - Option -V no longer needs to be specified before option -U in order to work

As an aside this commit also provides useful helper functions for printing
plural(), inname(), outname() and interval() all of which return strings fit
for printing.

$ avrdude -qp ATmega2560 -c usbtiny -U blink-mega2560+lext-test.hex

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: input file blink-mega2560+lext-test.hex auto detected as Intel Hex
avrdude: reading input file blink-mega2560+lext-test.hex for flash
         with 1346 bytes in 4 sections within [0, 0x3106d]
         using 7 pages and 446 pad bytes
avrdude: writing 1346 bytes flash ...
avrdude: 1346 bytes of flash written
avrdude: verifying flash memory against blink-mega2560+lext-test.hex
avrdude: 1346 bytes of flash verified

avrdude done.  Thank you.

$ avrdude -qp ATmega328P -c usb-bub-ii -U sketch-ending-in-ff.hex

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: input file sketch-ending-in-ff.hex auto detected as Intel Hex
avrdude: reading input file sketch-ending-in-ff.hex for flash
         with 2160 bytes in 1 section within [0, 0x888]
         using 17 pages and 16 pad bytes, cutting off 25 trailing 0xff bytes
avrdude: writing 2160 bytes flash ...
avrdude: 2160 bytes of flash written
avrdude: verifying flash memory against sketch-ending-in-ff.hex
avrdude: 2185 bytes of flash verified

avrdude done.  Thank you.

$ echo "Hello, world..." | avrdude -qp ATmega328P -c ... -U eeprom:w:-:r

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file <stdin> for eeprom
avrdude: writing 16 bytes eeprom ...
avrdude: 16 bytes of eeprom written
avrdude: verifying eeprom memory against <stdin>
avrdude: 16 bytes of eeprom verified

avrdude done.  Thank you.
2022-08-02 23:26:01 +01:00
Stefan Rueger e91f73392c
Merge pull request #1048 from MCUdude/jtagmkii-updi
Add `jtagmkii_updi` programmer option
2022-08-02 18:32:12 +01:00
Stefan Rueger 310b801c59
Merge pull request #1046 from stefanrueger/stk500
Deprecate original STK500 v1 protocol in favour of optiboot and Arduino as ISP
2022-08-02 18:30:21 +01:00
Stefan Rueger 7f63632c6e
Merge pull request #1040 from stefanrueger/partdesc
Developer options to describe parts and extend avrdude.conf syntax
2022-08-02 18:27:42 +01:00
Stefan Rueger 18e5bfd203
Merge pull request #1033 from MCUdude/ignore-safemode-flag
Ignore `-s` flag as safemode is no longer supported
2022-08-02 18:26:58 +01:00
Stefan Rueger 33ae3719e3
Merge pull request #1031 from MCUdude/jtagmki-fuses-fix
Apply jtagmki patch provided in #443
2022-08-02 18:24:25 +01:00
Stefan Rueger 7730706498
Merge pull request #1030 from stefanrueger/ihexcomments
Provide file format I: Intel HEX with comments that ignores checksum errors
2022-08-02 18:23:23 +01:00
Stefan Rueger 5e9be93100
Merge pull request #1016 from ffontaine/main
CMakeLists.txt: fix build without C++
2022-08-02 18:22:16 +01:00
MCUdude de124bfd9b Improve error detection logic 2022-07-29 12:48:53 +02:00
Stefan Rueger f299439b97 Move developer_opts* file names from library section to main section for c/make 2022-07-27 00:18:06 +01:00
Stefan Rueger 004b46b594 Move useful CMDBIT/part functions from developer_opts.c to avrpart.c 2022-07-27 00:12:57 +01:00
Stefan Rueger 62dcc2e6e8 Declare useful CMDBIT/part functions of developer_opts.c in libavrdude.h 2022-07-26 23:55:42 +01:00
Stefan Rueger 78754b8ccc Add parent id output for developer options -p*/s for parts 2022-07-26 23:43:56 +01:00
MCUdude 104dcf6052 Add new jtagmkii_updi programmer type option
in order to resolve issue #1037
2022-07-26 11:36:50 +02:00
Stefan Rueger 1549273529 Add comments with part names to -p*/s output 2022-07-25 20:30:40 +01:00
Stefan Rueger d5d3a0e09e Improve help message -p/h for developer option -p 2022-07-24 23:38:51 +01:00
Stefan Rueger 3d06457a16
Deprecate original STK500 v1 protocol in favour of optiboot and Arduino as ISP
For paged read/write early AVRDUDE implementations of the STK500 v1 protocol
communicated a word address (below a_div=2) or byte address (a_div=1) based
on the following code irrespective of which memories were used:

  if(m->op[AVR_OP_LOADPAGE_LO] || m->op[AVR_OP_READ_LO])
    a_div = 2;
  else
    a_div = 1;

This turned out to be a bug: it really should have been a_div=2 for flash and
a_div=1 for eeprom. At the time presumably no one noted because Atmel was at
the cusp of replacing their FW 1.x with FW 2 (and the STK500 v2 protocol).

It seems that the world (optiboot, Arduino as ISP, ...) has compensated for
the bug by assuming AVRDUDE sends *all* eeprom addresses as word addresses.
Actually these programmers overcompensated for the bug because for six out of
the 146 known SPI programmable parts with eeprom and page size > 1, AVRDUDE
would still send the eeprom addresses as byte addresses (ATmega8 ATmega8A
ATmega64 ATmega64A ATmega128 ATmega128A) owing to above code.

It makes no sense to correct the bug now seeing that virtually no one uses
the old 2005 STK 500 v1 firmware. This commit now follows optiboot, Arduino
as ISP and other projects, and simply sends all addresses for paged read or
write as word addresses. There are no longer (little known) exceptions for
ATmega8 et al that surprised some optiboot etc users.
2022-07-24 20:39:14 +01:00
Stefan Rueger 29c6645abc
Resolve signed/unsigned comparisons in stk500.c and stk500v2.c 2022-07-24 19:41:42 +01:00
Stefan Rueger 535004ee3d
Consolidate error messages for stk500.c 2022-07-24 19:27:07 +01:00
Stefan Rueger 7310df030f
Check stk500_recv() actually worked before accepting SYNC byte 2022-07-24 18:48:22 +01:00
Stefan Rueger 4babe183da
Initialise memory before avr_set_bits() calls in stk500.c and stk500v2.c 2022-07-24 18:20:35 +01:00
Joerg Wunsch cc93bd2c83 Move the error handling for invalid file formats to fileio.c
The checks used to be in update.c, but as they are related to
the intended file operation, they are better placed in fileio.c.

The checks affected are to refuse 'm' on output (file write),
and 'd', 'h', 'o', and 'b' formats on input (file read).
2022-07-23 22:47:38 +02:00
MCUdude 248c17177c Mention -s and -u in the docs 2022-07-23 22:33:11 +02:00
Joerg Wunsch ce1ae41dd6 Document that 'h', 'o', and 'd' file formats are output-only. 2022-07-23 16:30:38 +02:00
Joerg Wunsch 26f431c944 Handle invalid -U file format specifiers for input
The file format specifiers 'h', 'd', 'o', and 'b' are only valid for
outputting data. Reject them with a proper error message when
attempting to use them for input.
2022-07-23 10:26:17 +02:00
Stefan Rueger 5a517fb74d Make developer opts portable: change statement exprs and index(); use size_t 2022-07-22 23:50:22 +01:00
Stefan Rueger a95d169ccc Warn whenever address bits in avrdude.conf SPI commands are misplaced 2022-07-21 23:11:44 +01:00
Stefan Rueger 02788fb48a Warn whenever address bits in avrdude.conf SPI commands miss 2022-07-21 22:43:08 +01:00
Stefan Rueger 572849ec2a Provide avr_set_addr_mem() to set addresses in SPI opcodes within boundaries
The function avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd,
unsigned long addr) is meant to replace avr_set_addr(OPCODE *op, unsigned
char *cmd, unsigned long addr) in future.

avr_set_addr_mem() has more information about the context of the task in that
it knows the memory size, memory page size, whether or not the memory is a
flash memory (which gets words addressees supplied) and, crucially, knows
which SPI operation it is meant to compute the address bits for.

avr_set_addr_mem() first computes the interval of bit numbers that must be
supplied for the SPI command to stand a chance to work. The function only
sets those address bits that are needed. Once all avr_set_addr() function
calls have been replaced by avr_set_addr_mem(), the SPI commands that need an
address can afford to declare in avrdude.conf all 16 address bits in the
middle two bytes of the SPI command. This over-declaration will be corrected
during runtime by avr_set_addr_mem(). One consequence of this is that parts
can inherit smaller or larger memories from parents without the need to use
different SPI codes in avrdude.conf. Another consequence is that
avr_set_addr_mem() can, and does, tell the caller whether vital address bits
were not declared in the SPI opcode. During parsing of avrdude.conf this
might be utilised to generate a corresponding warning. This will uncover
problematic SPI codes in avrdude.conf that in the past went undetected.
2022-07-21 21:42:07 +01:00
Stefan Rueger 55f6765ea5 Make more useful functions from developer_optc.c available 2022-07-21 18:47:48 +01:00
Stefan Rueger 192e118d2c Make useful functions from developer_optc.c available 2022-07-21 18:36:04 +01:00
Stefan Rueger 696574d1eb Replace !fnmatch(p, s, 0) with own part_match(p, s) 2022-07-21 18:04:41 +01:00
Stefan Rueger 4ada98a1a8 Udate the avrdude.conf introductory documentation 2022-07-20 00:57:35 +01:00
Stefan Rueger 6afa115a5f Make -p*/s print SPI opcodes like "0100.0000--000.aaaa--aaaa.aaaa--iiii.iiii" 2022-07-19 23:44:58 +01:00
Stefan Rueger 30041e3f5f Add compact alternative specification for SPI opcodes in avrdude.conf
As the address bit numbers in the SPI opcodes are highly systematic, they
don't really need to be specified. Each bit can therefore be described as one
of the characters 0 (always 0), 1 (always 1), x (don't care, but will be set
as 0), a (a copy of the correct bit of the byte or word address of read,
write, load, pagewrite or load extended address command of memories with more
than one byte), i (input bit for a load/write) or o (output bit from a read).
The bits therefore do not need to be individually separated.

If a string in the list of strings that describe an SPI opcode does *not*
contain a space *and* is longer than 7 characters, it is interpreted as a
compact bit-pattern  representation. The characters 0, 1, x, a, i and o will
be recognised as the corresponding bit, whilst any of the characters ., -, _
or / can act as arbitrary visual separators, which are ignored. Examples:

  loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii";

  loadpage_lo = "0100.0000", "000x.xxxx", "xxaa.aaaa", "iiii.iiii";

  loadpage_lo = "0100.0000", "000x.xxxx.xxaa.aaaa", "iiii.iiii";

  loadpage_lo = "0100.0000-000x.xxxx--xxaa.aaaa-iiii.iiii";

  loadpage_lo = "0100.0000/000x.xxxx/xxaa.aaaa/iiii.iiii";

The compact format is an extension of the current format, which remains
valid. Both, the compact and the traditional specification can be mixed in
different strings, albeit not in the same string:

  load_ext_addr = "0100.1101", "0000.0000.0000", "0 0 0 a16", "0000.0000";
2022-07-19 22:59:46 +01:00
MCUdude bfdad78fcb Add EEPROM dummy read 2022-07-19 23:44:22 +02:00
Stefan Rueger db37c9d286 Extend rather than reset memory entries in avrdude.conf
This commit changes the philosophy whenever avrdude.conf encounters the
same memory of a part for the second time or whenever a memory is
described that, through inheritance, already existed: AVRDUDE no longer
zaps the memory, it rather extends it.

Therefore, avrdude.conf.in's entry for ATmega128RFA1, which inherits from
the ATmega2561, needs a line `load_ext_addr = NULL;` in its flash memory
description to zap the inherited load_ext_addr SPI command.

Other than this, avrdude.conf.in needs no other change in order to effect
the same internal representation proving earlier updates to the .conf.in
file correct that manually ensured inheritance of memory contents.
2022-07-19 20:00:17 +01:00
Stefan Rueger bdb5ba6055 Add avrdude.conf syntax ((pp|hvsp)_controlstack|(eeprom|flash)_instr) = NULL; 2022-07-19 16:16:55 +01:00
Stefan Rueger 1555906604 Add avrdude.conf syntax memory "name" = NULL; 2022-07-19 15:58:40 +01:00
Stefan Rueger 8503f2d2d5 Add avrdude.conf syntax opcode = NULL; for SPI programming 2022-07-19 15:38:54 +01:00
Stefan Rueger f8b6a246ef Add in lexer.l capability to scan negative decimal integers or reals 2022-07-19 15:17:00 +01:00
Stefan Rueger bb6e1bbaec Add avrdude.conf new syntax: readback = 0x80 0x7f; 2022-07-19 15:01:51 +01:00
Stefan Rueger 8da9c2bbf6 Correct bit number for lone 'a' in config_gram.y
When an SPI command has a lone 'a' the initialisation now is as would be
expected by all commands that take an address. Atmel's opcodes for SPI
programming are consistent in this respect. This commit makes specifying
the bit number in avrdude.conf optional. Instead of

 read_lo = "0 0 1 0 0 0 0 0  0 0 a13 a12 a11 a10 a9 a8  a7 a6 a5 a4 a3 a2 a1 a0  o o o o o o o o";

one can now use

 read_lo = "0 0 1 0 0 0 0 0  0 0 a a a a a a  a a a a a a a a  o o o o o o o o";
2022-07-19 14:46:08 +01:00
Stefan Rueger 8989e6515b Change macros __f() to _f() and adapt to config_file and hvupdi changes 2022-07-19 14:38:34 +01:00
Stefan Rueger 43e2955c61
Merge branch 'avrdudes:main' into partdesc 2022-07-19 13:20:25 +01:00
Stefan Rueger 3b5a1f63c6
Merge branch 'avrdudes:main' into partdesc 2022-07-19 12:57:13 +01:00
Stefan Rueger 3c05fe6412
Merge branch 'avrdudes:main' into config_file 2022-07-19 12:33:12 +01:00
Stefan Rueger e52bd2b99b Move realpath() compatibility definition from config_gram.y to config.h 2022-07-19 08:05:42 +01:00
Stefan Rueger eba67e56fc Make realpath() available for MSC and MINGW32 2022-07-19 07:42:44 +01:00
Stefan Rueger f95a1d3448 Cache config_file components in AVRPART and PROGRAMMER structures
Some 90% of the space of AVRPART and some 50% of PROGRAMMER is occupied by a
4 kB array config_file[] that contains the configuration file name. In
preparation of developer options that output a raw dump of the part
descriptions, this commit changes the config_file components from a large
array, which is duplicated in each part and programmer description, to a
cached string for each config file allowing for smaller raw dumps.

This commit also changes the config file name to its realpath(), eg, shortens
unwarranted `/bin/../etc/` file name components. It also changes the global
variable names `infile` and `fileno` to cfg_infile and cfg_fileno for an ever
so slight improvement of code clarity.
2022-07-18 18:10:09 +01:00
Stefan Rueger 0e7c1512e4 Avoid the warning: enumeration value ‘CONNTYPE_SPI’ not handled in switch 2022-07-18 17:34:06 +01:00
MCUdude ec467c465e Ignore -s flag as safemode is no longer supported
Resolves #1032
2022-07-18 17:13:10 +02:00
Stefan Rueger 068e78e832
Merge branch 'avrdudes:main' into partdesc 2022-07-18 16:02:01 +01:00
Stefan Rueger 6e5bf3bc8d
Merge pull request #1029 from stefanrueger/issue992
Fix usbtiny read/verify for parts with more than 64 kB flash
2022-07-18 14:32:15 +01:00
Stefan Rueger 494199fa78
Merge pull request #1025 from stefanrueger/terminal
Fix terminal write edge cases; add one read mode and add quell command
2022-07-18 14:30:45 +01:00
Stefan Rueger 6fa7400e4e
Merge pull request #1015 from MCUdude/hv-updi
Add support for high-voltage UPDI
2022-07-18 14:28:39 +01:00
Stefan Rueger 1d3a7591ea
Merge pull request #933 from MCUdude/linuxspi-default-port-fix
Fix linuxspi default port
2022-07-18 14:25:52 +01:00
MCUdude 5904611928 Apply jtagmki patch provided in #443 2022-07-17 12:51:43 +02:00
Stefan Rueger 79921e52dc Provide file format I: Intel HEX with comments that ignores checksum errors
The new file type I is essentially Intel HEX that, on download, inserts
comments next to data records with the resolved effective address and an
ASCII dump of that same record. On upload the `I` format is permissive
with respect to check sum errors, eg, after manipulated an Intel HEX file
for debugging.
2022-07-16 23:40:36 +01:00
Stefan Rueger d05ddd188d Fix usbtiny read/verify for parts with more than 64 kB flash
Usbtiny has a protocol or firmware problem that prevents it from reading
flash above 64 kB in page mode (used by -U flash:r:... and -U flash✌️...).
This commit fixes that problem by falling back on byte access for flash paged
reads above 64k. It also issues the correct load extended address command for
parts with more than 128 kB flash thus extending support to ATmega2560 et al.
2022-07-16 11:06:18 +01:00
Stefan Rueger e7e062ec05 Fix terminal line parsing for strings (to some extent) 2022-07-15 18:50:20 +01:00
Stefan Rueger 7ceb163cba Echo terminal command line on Apple 2022-07-14 18:31:44 +01:00
Stefan Rueger 14b27726d4 Protect terminal dump from vagaries of C libray implementation of isalpha() etc
Some C libraries assign true to isalpha(0xff), isdigit(0xff) or
ispunct(0xff), which means that the Operating System terminal sees a
character 0xff which it may not have a useful display character for.

This commit only outputs printable ASCII characters for an AVRDUDE
terminal dump reducing the risk of the OS terminal not being able
to print the character properly.
2022-07-14 17:16:30 +01:00
Stefan Rueger 5721908e63 Revert to double/float only in terminal write and clarify usage 2022-07-14 17:13:13 +01:00
MCUdude dde35018eb Exit if programmer can't send HV pulse to target 2022-07-13 23:49:14 +02:00
Stefan Rueger 901d49c4e6 Change terminal write usage message to accommodate long double 2022-07-13 12:37:10 +01:00
Stefan Rueger b02cce38d7 Added long double data type for terminal write 2022-07-13 12:25:09 +01:00
Stefan Rueger 0b3a5781fc Flush stderr and stdout with all terminal error messages
Error messages are written to stderr whilst normal terminal output is stdout.
When redirecting output to pipelines or files these two streams can get
separated as they are buffered separately. To avoid this, term.c now provides
a function terminal_message() that works just like avrdude_message() but
flushes stderr and stdout before printing on stderr, and it flushes stderr
afterwards.

This commit replaces all avrdude_message() calls except for progress report
with terminal_message() to ensure stdout and stderr streams keep together.
2022-07-13 11:48:29 +01:00
Stefan Rueger 1efbc64922 Add terminal_setup_update_progress() library interface to term.c
This enables the new quell terminal command to switch on and off progress
reports to the terminal. The code for this was moved from main.c to term.c.

It can be used as library call for other frontends than main.c
2022-07-13 11:38:43 +01:00
Stefan Rueger ea226936b7 Fix isspace() and other isxxx() calls in term.c 2022-07-13 11:19:21 +01:00
Stefan Rueger f8145ae1c4 Echo >>> terminal command line for Windows or non-libreadline 2022-07-12 21:53:37 +01:00
Stefan Rueger 3ef8122d90
Merge branch 'avrdudes:main' into partdesc 2022-07-12 18:19:17 +01:00
Stefan Rueger feb38b83ef
Merge branch 'avrdudes:main' into terminal 2022-07-12 18:18:39 +01:00
Stefan Rueger b6204b181a Provide echo of terminal command line prompt under Windows 2022-07-12 15:22:52 +01:00
Stefan Rueger 0edb77bdf8
Merge branch 'main' into issue918 2022-07-12 15:05:45 +01:00
Stefan Rueger 04f790ad85
Merge pull request #1018 from stefanrueger/issue995
Fix Issue #995 ft245r paged read for ATmega2560 et al
2022-07-12 14:55:44 +01:00
Stefan Rueger 1e8b56751e Add quell command in terminal
Sets the quell_progress global variable that can be, and is, consulted by
programmers.

Setting quell_progress to a positive number also switches off progress
bars. It is currently not possible to switch on progress bars again: that
is enabled in main.c once at the start of AVRDUDE.

That code in main should move to avr.c to enable report_update() to consult
quell_progress directly. Will do at another time when touching main.c and
avr.c. smr
2022-07-12 13:19:09 +01:00
Stefan Rueger d9cb9772d7 Fix verbosity level parsing in term.c 2022-07-12 12:30:29 +01:00
Stefan Rueger 63fb79accb Consolidate more error messages in term.c 2022-07-12 12:24:30 +01:00
Stefan Rueger f871a4dc1e Adapt capitalisation of comments in term.c to existing style 2022-07-12 12:02:43 +01:00
Stefan Rueger 7c766ef9bd Refine type detection in terminal write
The code no longer accepts valid mantissa-only doubles that are integer
rejects, eg, 078 or ULL overflows. These are most likely input errors by
the user: 8 is not an octal digit, they might have typed 17 hex digits,
not 16. It's just too hard to explain that 0xffffFFFFffffFFFFf writes
0x4430000000000000, which is the correct double representation of the
valid 17-digit hex mantissa that strtod() is perfectly happy to accept.
2022-07-12 12:01:14 +01:00
Stefan Rueger 704d253636 Remove comparisons between signed and unsigned integers in term.c 2022-07-12 11:59:42 +01:00
Stefan Rueger 8140c9c90b Consolidate error messages in term.c 2022-07-12 11:58:51 +01:00
Stefan Rueger 56113f6d8a Remove echo of tokenised terminal command 2022-07-12 11:51:04 +01:00
Stefan Rueger c5f522342d Improve terminal help message 2022-07-12 11:50:23 +01:00
Stefan Rueger 92425af0cc Improve terminal dump usage message 2022-07-12 11:47:33 +01:00
Stefan Rueger 602e9bb80c Change size for memory type variable in terminal read 2022-07-12 11:44:20 +01:00
Stefan Rueger 7205bbae80 Enhance terminal read with new mode: read <memory> <addr> 2022-07-12 11:43:45 +01:00
Stefan Rueger aa09bcf900 Ensure terminal writes little endian numbers 2022-07-12 11:42:59 +01:00
Stefan Rueger ddffabe86a Improve terminal write usage message 2022-07-12 11:40:40 +01:00
Stefan Rueger 0b2f38c67d Allow optional comma separators for data items in terminal write 2022-07-12 11:39:52 +01:00
Stefan Rueger 5c4cfa642a Parse terminal writes of string and character constants in C-style 2022-07-12 11:39:02 +01:00
Stefan Rueger 9fe6820236 Add double type for terminal write in anticipation of future avr-libc extension 2022-07-12 11:36:57 +01:00
Stefan Rueger feda75b60a Remove unnecessary bool is_float in terminal write 2022-07-12 11:35:27 +01:00
Stefan Rueger 51355d04fb Remodel logic of the size that integer items occupy in terminal write
Integers can be hexadecimal, decimal or octal. An optional case-insensitive
suffix specifies their size: HH: 8 bit, H/S: 16 bit, L: 32 bit, LL: 64 bit

An optional U suffix makes a number unsigned. Ordinary 0x hex numbers are
always treated as unsigned. +0x or -0x hex numbers are treated as signed
unless they have a U suffix. Unsigned integers cannot be larger than 2^64-1.

If n is an unsigned integer then -n is also a valid unsigned integer as in C.

Signed integers must fall into the [-2^63, 2^63-1] range or a correspondingly
smaller range when a suffix specifies a smaller type. Out of range signed
numbers trigger a warning.

Ordinary 0x hex numbers with n hex digits (counting leading zeros) use
the smallest size of 1, 2, 4 and 8 bytes that can accommodate any n-digit hex
number. If a suffix specifies a size explicitly the corresponding number of
least significant bytes are written. Otherwise, signed and unsigned integers
alike occupy the smallest of 1, 2, 4, or 8 bytes needed to accommodate them
in their respective representation.
2022-07-12 11:32:38 +01:00
Stefan Rueger 62d3eebd56 Fix 64-bit integer terminal write where high bit set
Using strtoll() can only return numbers in the range [-2^63, 2^63-1]. This
means that 0xffffFFFFffffFFFF (2^64-1) will be out of range and is written as
max LL. Actually, every 64-bit number with high-bit set will wrongly be
written as max LL.

This commit uses strtoull() instead to fix this, and checks for unsiged out-
of-range error. strtoull() also has the neat benefit that input with a minus
sign is treated like C unsigned numbers, ie, -u is also a valid unsigned
number if only u is one. In case the input is meant to be treated as signed,
it is therefore still OK to use strtoull() in the first instance only that in
this case a second check against the range of the signed domain is necessary.
2022-07-12 11:19:47 +01:00
Stefan Rueger 9afa56381e Remove unused component is_signed in terminal write 2022-07-12 11:19:05 +01:00
Stefan Rueger ff43e0544d Correct a parse message in terminal write 2022-07-12 11:18:15 +01:00
Stefan Rueger 177834ae7c Ensure enough memory is allocated for buf in terminal write 2022-07-12 11:16:16 +01:00
Stefan Rueger d3ad078577 Ensure terminal write fill mode ... always fills with last data item 2022-07-12 11:15:30 +01:00
Stefan Rueger 39a00bc71e Ensure +0x...f does not strip suffix f in terminal write 2022-07-12 11:14:41 +01:00
Stefan Rueger 360d7c502b Make suffix fully case insensitive (allow Hh, Ll, ...) in terminal write 2022-07-12 11:13:46 +01:00
Stefan Rueger d9450058c8 Cache strlen(argv[i]) in term.c cmd_write() and prevent negative array index 2022-07-12 11:12:20 +01:00
Jan Egil Ruud 69ee5da613 Improve error handling for devices that does not support HVUPDI. 2022-07-12 12:01:17 +02:00
Jan Egil Ruud 2478c18745 Do not let the hvupdi extended option take any configuration values. The hvupdi type is implied by the part configuration. 2022-07-11 15:26:41 +02:00
Jan Egil Ruud 173b4f9d0a Clean up and simplify hvupdi handling, and set default hvupdi_variant to -1. 2022-07-11 14:07:45 +02:00
Stefan Rueger ff8f519a34 Fix PICKit2 ATmega2560 flash paged flash read
The paged read in pickit2.c has two errors:
  - It drops load extended address commands unless a paged read happens at a
    64k byte boundary; this is invalid when reading files with holes
  - It wrongly assumed that flash memory is byte addressed

The fix is to carry out a load extended address command, if needed, at the
beginning of each paged flash read with the correct word address. Although the
pickit2_paged_load() has independent parameters page_size, addr and n_bytes,
AVRDUDE only ever calls paged read/write functions with page_size and n_bytes
both set to mem->page_size and addr aligned with a page boundary. Therefore, it
is sufficient to set the load extended address at the beginning of each page
read.
2022-07-10 23:41:44 +01:00
Stefan Rueger 215ea1af5c Merge branch 'partdesc' of github.com:stefanrueger/avrdude into partdesc 2022-07-07 18:34:26 +01:00
Stefan Rueger 9e2cea3ada Implement developer options -p */[*cdosSrwt] for part descriptions 2022-07-07 18:32:19 +01:00
Jan Egil Ruud 91310e6f50 Move hvupdi_support list to a new prog_parm_updi group, and initialize the list. 2022-07-07 12:23:05 +02:00
Ruud, Jan Egil 9e5ea25b9e Add HVUPDI_SUPPORT list for programmers. 2022-07-05 14:14:37 +02:00
Stefan Rueger 64ee4858fd Update 2nd debug message in avr.c with correct function name 2022-07-05 01:00:45 +01:00
Stefan Rueger d3b22fa3c6 Update debug message in avr.c with correct function name 2022-07-05 00:57:40 +01:00
Stefan Rueger 00ea21597e
Merge pull request #1001 from MCUdude/add-missing-bits-and-pieces
Add missing delays in avrdude.conf
2022-07-05 00:05:32 +01:00
Stefan Rueger 2b6ee8f4d1 Adapt whitespace to existing style in avrftdi.c 2022-07-04 23:54:02 +01:00
Stefan Rueger 7aad03cbcd Fix paged read for ATmega2560 et al for ft245r.c 2022-07-04 23:11:32 +01:00
Stefan Rueger a721e485cb Refactor paged read/write routines in ft245r.c 2022-07-04 23:04:36 +01:00
Stefan Rueger 237cb63211 Steamline avrftdi support for ATmega2560 et al 2022-07-04 12:30:37 +01:00
MCUdude d2bb964fc7 Attempt to fix EEPROM write issue #1009 2022-07-04 12:30:37 +01:00
Joerg Wunsch f22b81c00e Fix a number of logic errors in the previous commits
RSP3_FAIL_CRC_FAILURE is 0x43 rather than 0x47.

jtag3_errcode() must only be applied to a reason code, not
to any general status code.
2022-07-04 12:30:37 +01:00
Joerg Wunsch 8953967fc3 Replace internal knowledge in jtag3.c by a public API
In certain situations (CRC failure, device locked), that JTAG3
read functions need to return an indication to the caller that
it is OK to proceed, and allow erasing the device anyway.

Historically, the JTAG3 code passed the respective protocol
errors directly (and unexplained) up to the caller, leaving
the decision to the caller how to handle the situation.

Replace that by a more common return value API. New code should
prefer this API instead of any hardcoded return values.
2022-07-04 12:30:37 +01:00
Stefan Rueger ef785a617a Treat x bits in .conf SPI commands as 0 2022-07-04 12:30:37 +01:00
prchal 134509cc6f adding support for all Linux baud rates v.2
If optiboot can work at higher bauds, why not avrdude.
Versoin 2 of #985.
Linux uses the old-style bitmapped version of the Bxxxx macros.
2022-07-04 12:30:37 +01:00
MCUdude 963a1e54af Fix JTAG transaction close issue
Fixes issue #366
2022-07-04 12:30:37 +01:00
MCUdude b167e88422 Reduce programmer description string length
to less than 80 characters. #941 related
2022-07-04 12:30:37 +01:00
Stefan Rueger 3893a21164 Fix avrftdi support for ATmega2560 et al (load extended address) 2022-07-04 12:30:25 +01:00
MCUdude 6473a6d71a Add avrdude_message to verbose mode 2022-07-01 07:36:07 +02:00
MCUdude 30c1b31b8d Send 12V pulse to HV_UPDI_VARIANT_2 targets as well 2022-06-29 17:12:57 +02:00
Ruud, Jan Egil 65763b5700 Correct hvupdi_variant for AVR DD devices. 2022-06-29 17:12:57 +02:00
Ruud, Jan Egil 39008ac2c1 Add UPDI HV type to device description. 2022-06-29 17:12:57 +02:00
MCUdude 577856cf15 Use HV UPDI constants rather than arbitrary numbers 2022-06-29 17:12:57 +02:00
MCUdude 50220289bb Add high-voltage UPDI info to docs 2022-06-29 17:12:57 +02:00
MCUdude e068341716 Make sure "-x hvupdi" is only valid for Pickit4 and Powerdebugger 2022-06-29 17:12:57 +02:00
MCUdude f67c35744e add support for "-x hvupdi" that triggers HV UPDI 2022-06-29 17:12:57 +02:00
MCUdude ba98e48880 add "hvupdi_variant" property to avrdude.conf 2022-06-29 17:12:52 +02:00
Stefan Rueger 0240b361f5
Merge branch 'avrdudes:main' into partdesc 2022-06-28 22:53:22 +01:00
Stefan Rueger a21f3d20af
Merge branch 'avrdudes:main' into issue942 2022-06-28 22:38:47 +01:00
Jörg Wunsch 8cd6f357b1
Merge pull request #1013 from MCUdude/jtag3-eeprom-fix
JTAG3 UPDI EEPROM fix
2022-06-28 22:36:19 +02:00
Jörg Wunsch 7ec51a5185
Merge pull request #996 from dl8dtl/jtag3_retcode
Replace internal knowledge in jtag3.c by a public API

Supersedes #982
2022-06-28 22:21:50 +02:00
Stefan Rueger 09c168a186
Merge branch 'avrdudes:main' into issue942 2022-06-28 20:56:49 +01:00
Stefan Rueger d8a30aa8c4
Merge branch 'avrdudes:main' into partdesc 2022-06-28 20:44:34 +01:00
Stefan Rueger 3bd75e74c6 Move developer options into own source file and expand part description -p \*
-p \*/c  check address bits in SPI commands
  -p \*/d  description of core part features
  -p \*/o  opcodes for SPI programming parts and memories
  -p \*/s  show avrdude.conf entries of parts
  -p \*/ss show full avrdude.conf entry as tab separated table
  -p \*/w  wd_... constants for ISP parts
  -p \*/\* all of the above except -p \*/s
  -p \*    same as -p\*/\*
2022-06-28 20:34:31 +01:00
Jörg Wunsch 6d1c83e182
Merge pull request #993 from prchal/patch-1
adding support for all Linux baud rates
2022-06-26 22:59:49 +02:00
Jörg Wunsch 55dddc57cc
Merge pull request #979 from MCUdude/dragon-jtag-fix
Dragon JTAG fix: restart firmware after programming
2022-06-26 22:53:32 +02:00
Fabrice Fontaine 17509d2ef4 CMakeLists.txt: fix build without C++
Fix the following build failure without a C++ compiler:

CMake Error at CMakeLists.txt:24 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-06-26 21:35:42 +02:00
Stefan Rueger 0a7f2645c9 Merge branch 'partdesc' of github.com:stefanrueger/avrdude into partdesc 2022-06-26 15:15:37 +01:00
Stefan Rueger 317cc6d492 Add part type to -p \* .desc output 2022-06-26 15:10:19 +01:00
Stefan Rueger 40425ffac4
Merge branch 'avrdudes:main' into partdesc 2022-06-26 14:49:07 +01:00
Hans 8159c46013
Merge branch 'avrdudes:main' into hv-updi 2022-06-25 22:47:27 +02:00
MCUdude 89b0aa72e0 Attempt to fix EEPROM write issue #1009 2022-06-25 11:39:16 +02:00
Joerg Wunsch ae0e3e2f8e Fix a number of logic errors in the previous commits
RSP3_FAIL_CRC_FAILURE is 0x43 rather than 0x47.

jtag3_errcode() must only be applied to a reason code, not
to any general status code.
2022-06-22 23:33:53 +02:00
MCUdude 692c13ed98 Add missing chip erase delay for ATmega48/88/168/328PB 2022-06-19 19:40:31 +02:00
MCUdude aa211f7580 Add missing efuse write delay for ATmega169/A/P/PA and ATmega328P 2022-06-19 19:23:34 +02:00
MCUdude 3b0a2abc20 Reduce programmer description string length
to less than 80 characters. #941 related
2022-06-19 10:53:07 +02:00
Joerg Wunsch 3082630430 Replace internal knowledge in jtag3.c by a public API
In certain situations (CRC failure, device locked), that JTAG3
read functions need to return an indication to the caller that
it is OK to proceed, and allow erasing the device anyway.

Historically, the JTAG3 code passed the respective protocol
errors directly (and unexplained) up to the caller, leaving
the decision to the caller how to handle the situation.

Replace that by a more common return value API. New code should
prefer this API instead of any hardcoded return values.
2022-06-15 23:32:22 +02:00
Marius Greuel 3148b31e01
Merge pull request #972 from earies/cmake-libdir-fix
Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR
2022-06-08 21:53:22 +02:00
Marius Greuel fc9d640f0b
Merge pull request #945 from mariusgreuel/pr-micronucleus-macos-usb-issue
Fix micronucleus bootloader to check for unresponsive USB devices
2022-06-08 21:46:40 +02:00
prchal bd8c17b35f
adding support for all Linux baud rates v.2
If optiboot can work at higher bauds, why not avrdude.
Versoin 2 of #985.
Linux uses the old-style bitmapped version of the Bxxxx macros.
2022-06-07 11:50:03 +02:00
MCUdude bdb4128de3 Fix JTAG transaction close issue
Fixes issue #366
2022-05-30 19:22:20 +02:00
Stefan Rueger 952ad72fb9 Add -p \* to summarise properties of parts in conf 2022-05-24 16:56:11 +01:00
Ebben Aries 3b0d7e5d5d
Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR 2022-05-21 14:25:27 -06:00
Marius Greuel 053c2dcdd3 CMake: Include GCC specific options also for MSYS2 2022-05-11 20:57:14 +02:00
Marius Greuel 8b61c9dd8f CMake: Move MSVC compatibility shim into library 2022-05-11 20:56:05 +02:00
Marius Greuel 4b2bf38849 Add support for COM port discovery via USB VID/PID Add support for Leonardo USB bootloader auto-reset 2022-05-09 15:41:06 +02:00
Marius Greuel 9d6420e723 Correct endpoint direction for control messages of USBtinyISP devices 2022-05-09 15:41:06 +02:00
Marius Greuel bc9b67a153 Change Intel HEX line length from 32 to 16 to match line length of avr-objcopy 2022-05-09 15:41:06 +02:00
Marius Greuel 93b2a56c0e Change program URL to github.com 2022-05-09 15:41:06 +02:00
Subhaditya Nath b9a012cebb Fix .Dd macro in manpage
The correct format for .Dd according to mdoc(7) is -

	.Dd month day, year
2022-05-08 20:35:32 +05:30
Joerg Wunsch 9bc28d410e Post-7.0 changes
Update version date in configure.ac.
Update template in NEWS
2022-05-07 22:57:49 +02:00
Joerg Wunsch a2e456ca8a v7.0 release preparation 2022-05-07 22:20:31 +02:00
Joerg Wunsch 43ddea9102 Calibration memory of ATtiny43U is only 1 byte
Closes issue #921.
2022-05-05 22:58:45 +02:00
Marius Greuel 01a9e42d7d Fix typo in micronucleus message 2022-05-05 22:08:46 +02:00
Marius Greuel c64f2030a1 Improve micronucleus bootloader user experience for unresponsive USB devices 2022-05-05 21:42:27 +02:00
Marius Greuel 3bdf138721 Fix micronucleus bootloader to check for unresponsive USB devices 2022-05-05 20:45:47 +02:00
Joerg Wunsch a4c9fcdcd7 More fixes for PR #915 2022-05-02 22:51:22 +02:00
Jörg Wunsch ca16fc2ce6
Merge pull request #930 from cederom/cederom-programmer-avrftdi-ktlink
Added KT-LINK FT2232H interface with IO switching and voltage buffers.
2022-05-01 22:29:46 +02:00
Jörg Wunsch d7c59ca2f9
Merge pull request #931 from MCUdude/linuxspi-baud-fix
Fix linuxspi baud to clock period calculation
2022-05-01 22:26:23 +02:00
Joerg Wunsch 4bcd0eaa1d Fix a number of mistakes in avrdude.conf.in
Stefan Rueger found a lot of mistakes in this file.

Closes #915
2022-05-01 21:55:50 +02:00
Stefan Rueger 033b2ed796 Treat x bits in .conf SPI commands as 0 2022-04-29 00:37:28 +01:00
Stefan Rueger 580c37fbfe Describe -A in the man and .texi documentation 2022-04-29 00:14:45 +01:00
Stefan Rueger f47ec634f8 On verify always verify full input file 2022-04-28 17:53:10 +01:00
Stefan Rueger 52734bafc6 Add option -A to separately disable trailing-0xff removal 2022-04-28 17:29:06 +01:00
Stefan Rueger 52b20f4a28 Provide self-documenting API for disabling trailing-0xff removal 2022-04-28 17:26:09 +01:00
Stefan Rueger 2397984d2b Disable trailing-0xff removal when invoking arduino programmer 2022-04-27 18:54:13 +01:00
Joerg Wunsch 08ad5ea445 Fix broken texinfo
@ must be escaped as @@
2022-04-26 23:19:20 +02:00
Stefan Rueger e18d436f88 Move evaluating 'is flash' from caller to callee avr_mem_hiaddr() 2022-04-15 20:48:46 +01:00
Stefan Rueger ed38456f83 Piggy-back 'Do not remove trailing 0xff' onto option -D 2022-04-15 20:46:40 +01:00
MCUdude 6fceea8f71 Fix linuxspi default port
If no port is specified, Avrdude will try to use the default port specified in avrdude.conf. If not present, use port specified in linuxspi.c
2022-04-11 22:28:12 +02:00
MCUdude 9d025e6a70 Fix linuxspi baud to clock period calculation
#927 related
2022-04-10 23:36:53 +02:00
Tomasz 'CeDeROM' CEDRO b99a145b9f Added KT-LINK FT2232H interface with IO switching and voltage buffers.
Example TPI run: https://github.com/avrdudes/avrdude/issues/928

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2022-04-10 22:28:44 +02:00
MCUdude 1363c7fe76 Fix buffer overflow issue
when in terminal fill mode
2022-04-09 20:08:44 +02:00
MCUdude 08bd5fa938 Add string write to terminal example 2022-04-05 19:37:45 +02:00
MCUdude 17b67da03e Make sure memory can be filled with a string
... and not just the last character
2022-04-04 09:38:02 +02:00
Alexander Smirnov 3dc1e4e72b Wait and retry until deplayed udev permission rule applies after exporting gpio pin 2022-04-03 20:29:56 +01:00
MCUdude 795dd91575 Code cleanup + formatting 2022-04-01 22:23:55 +02:00
MCUdude 8f100f5df3 Initial support for string write 2022-04-01 21:57:53 +02:00
MCUdude f0f9059ade Tweak nexttok for better string handling
Now a string that starts and ends with a quote (") is combined into a single (argc) argument rather than being split where spaces used to be
2022-04-01 16:52:59 +02:00
Nav e069871c8e
Increased timeout passed to hid_read_timeout() - set to 10000 for consistency (#901) 2022-03-31 23:26:53 +02:00
Hans f22bc62b06
Mask out unused ATmega32U4 efuse bits (#909)
Closes #446
2022-03-31 23:13:57 +02:00
Hans d09a4e93a2
Add ATmega16U4 to avrdude.conf (#910)
Closes #447
2022-03-31 23:12:32 +02:00
Hans aa7ae7bb87
Add MacOS serial/parallel port note (#908)
Closes #510
2022-03-31 22:32:57 +02:00
Hans 1d0cbc2246
Add progressbar for read and write command (#912) 2022-03-31 22:21:49 +02:00
Joerg Wunsch 8697f6def7 Remove remnants of the old erase-cycle counter from examples 2022-03-21 06:38:28 +01:00
Joerg Wunsch 981a6f1f20 Restore the -u option as a dummy.
Closes #890
2022-03-20 21:50:45 +01:00
Jörg Wunsch 0c722bf288
Merge pull request #903 from dl8dtl/term-docs
Terminal mode documentation
2022-03-19 23:04:50 +01:00
Jörg Wunsch 28d1442fc8
Merge pull request #902 from MCUdude/terminal-fix
Minor terminal write improvements
2022-03-19 23:02:24 +01:00
Jörg Wunsch 75e4d06463
Merge pull request #899 from MCUdude/avrdude-conf-fix
Fix errors in Avrdude.conf

This also closes #897
2022-03-19 23:01:12 +01:00
Jörg Wunsch 99f191a0ca
Merge pull request #898 from dl8dtl/macos-nonstandard-baudrates
Macos nonstandard baudrates

closes #266
2022-03-19 22:57:37 +01:00
Joerg Wunsch 33bace0cee Provide an example for the second form of the "write" command
In terminal mode, there are two forms of "write", one that
explicitly mentions all data values, and a second one that
instead specifies a total range to write, where the last data
value given is replicated as needed.
2022-03-19 17:30:55 +01:00
Joerg Wunsch 0c912a201f Try making the cindex (concept index) meaningful
Rearrange existing @cindex entries, add a lot of new ones.
2022-03-19 00:03:17 +01:00
Joerg Wunsch 31feb9ff75 Link the concept index 2022-03-19 00:00:54 +01:00
Joerg Wunsch 29a01c1047 Terminal mode: fix documentation of second version of "write"
Right after start_addr, the next element is the number of bytes
to be written.
2022-03-18 23:42:32 +01:00
MCUdude 426ea1fa78 Add missing free()'s 2022-03-18 21:20:58 +01:00
MCUdude 6a5988ad64 Print write info message when in verbose mode 2022-03-18 21:19:36 +01:00
MCUdude dcf771424b Increase buffer size to prevent potential overflow 2022-03-18 19:17:17 +01:00
Joerg Wunsch 67b56d322b Update texinfo documentation for terminal-mode changes
This documents the recent changes that have been implemented in
terminal mode.
2022-03-17 23:13:52 +01:00
Joerg Wunsch 27d201acb1 Also tweak smallexample 2022-03-17 07:21:33 +01:00
Joerg Wunsch 9bc4a2463d Attempt to tweak CSS of the generated HTML docs a bit 2022-03-16 23:19:45 +01:00
Joerg Wunsch da1271642e Remove the pointer to the mailing list
It makes more sense to point people to Github issue trackers now,
even for questions.
2022-03-13 22:52:44 +01:00
Joerg Wunsch 416c465ec0 Bring the texinfo doc up to date
* remove copyright years; they are not meaningful anyway
* reflect the project move from Savannah to Github
2022-03-13 00:13:29 +01:00
MCUdude 41f524c1ba Use the same device signature on ATmega165 and ATmega165A 2022-03-08 13:17:01 +01:00
MCUdude 5ebb9047be Fix incorrect ATxmega128D4 flash page size 2022-03-08 12:50:17 +01:00
MCUdude fde7881611 Fix incorrect ATmega64M1 flash and eeprom size
#897 related
2022-03-08 12:34:06 +01:00
MCUdude 1c94c95f1c Fix target names not following the standard 2022-03-08 12:32:41 +01:00
Joerg Wunsch a4cbd5c6fc Append a newline to the nonstandard baudrate warning 2022-03-07 23:25:36 +01:00
Joerg Wunsch 87b39637ff Implement nonstandard baudrate handling on MacOS
Alas, MacOS doesn't handle nonstandard baud rates like other systems
in regular tcsetattr() calls. Instead, they invented a new ioctl
(IOSSIOSPEED). So, if we notice we are going to configure a
nonstandard rate on MacOS, issue that ioctl after configuring
everything else using tcsetattr().
2022-03-07 23:20:50 +01:00
Joerg Wunsch 34168759b0 Fix a one-bit error in ATmega165* signature read command. 2022-03-07 22:52:14 +01:00
Jörg Wunsch 0f4b5b223b
Merge pull request #894 from MCUdude/terminal
Improve terminal read functionality
2022-03-03 23:14:37 +01:00
Jörg Wunsch 0b82b5c573
Merge pull request #896 from MCUdude/terminal-write
Fix ugly terminal write bug
2022-03-03 23:12:47 +01:00
Jörg Wunsch 9355d67e0f
Merge pull request #893 from MCUdude/userrow-fix
Support both userrow and usersig names
2022-03-03 23:09:20 +01:00
MCUdude d9c52249a9 Restructure "write mode" code 2022-03-03 19:37:42 +01:00
MCUdude c7174d7678 Update description 2022-03-02 20:24:51 +01:00
MCUdude df6e2eea12 Fix terminal write bug
Wouldn't write data properly after an integer >= 2 bytes was written
2022-03-02 20:09:59 +01:00
Jan Egil Ruud 0c8b42524e For UPDI devices do not add offset when accessing flash. 2022-03-01 14:24:33 +01:00
MCUdude b688b1f601 Add support for read with ... "operator"
This means that you can use ... to read the "rest" of the memory.
$ read eeprom ...   will dump the entire memory
$ read eeorm 0x80 ...   will dump the memory from address 0x80 to the end address
2022-02-28 23:59:30 +01:00
MCUdude d89f695c31 Incread default read size to 256 bytes 2022-02-28 23:59:30 +01:00
MCUdude 1f2b570216 Support both userrow and usersig names 2022-02-28 19:46:47 +01:00
MCUdude 07ea8f5e09 Add userrow and usersig aliases 2022-02-21 22:36:06 +01:00
Joerg Wunsch 0269817217 Add a missing @end table
Has been slipped when adding some -x documentation before.
2022-02-21 22:01:05 +01:00
Jörg Wunsch 008f95f6ff
Merge pull request #880 from MCUdude/terminal-write
Avrdude terminal write improvements
2022-02-21 21:53:38 +01:00
MCUdude a73567893b Properly handle negative number sizes 2022-02-21 13:43:38 +01:00
MCUdude fa706f0d01 Handle data size warning better
Now it only outputs a warning when the size of the data the user input is actually ambiguous
2022-02-20 23:03:31 +01:00
MCUdude 3532c567ac Add suffix for 8-bit data
use [val]HH or [val]hh to force 8-bit writes to memory
2022-02-20 22:23:15 +01:00
MCUdude bb99a36a14 Formatting
Use enums for write mode, and change datatypes from int/long/char to int32_t/uint8_t where possible
2022-02-20 19:08:30 +01:00
MCUdude a9b756e5c7 Add struct initialization list 2022-02-20 12:46:53 +01:00
Dawid Buchwald cf67a76c23 Merge branch 'main' into ser_posix_cleanup 2022-02-20 12:37:19 +01:00
MCUdude 0e29b43bd0 Add support for 64-bit integers
Also, move everything data related into a struct, to keep tings a little more organized
2022-02-19 23:34:50 +01:00
MCUdude 4b9219edee Add support for suffixes for manually specifying data size
H/h/S/s: 16-bit, L/l: 32-bit, F/f: 32-bit float
2022-02-19 22:48:58 +01:00
Jörg Wunsch 3efd3b2052
Merge pull request #873 from MCUdude/add-arduino-programmers
Add missing USBtiny derived programmers
2022-02-19 21:51:31 +01:00
Dawid Buchwald 75ab3c418e Fixed warning with unsigned char 2022-02-19 21:18:03 +01:00
MCUdude 62f3b84eee Use union for simpler data representation
It is a bit hacky, but for this purpose it fits surprisingly well
2022-02-19 20:15:52 +01:00
Dawid Buchwald 066f54fbfa Cleanup of POSIX serial init code 2022-02-19 18:00:58 +01:00
Dawid Buchwald de19f203e0 Smallest possible fix for PL2303HX 2022-02-19 15:07:32 +01:00
Jörg Wunsch d054c68b19
Merge pull request #878 from MCUdude/fix-pkob-target-voltage
Fix Curiosity Nano target voltage
2022-02-18 23:01:49 +01:00
Jörg Wunsch c2fe68ef7d
Merge pull request #877 from MCUdude/jtag3-verbosity
Reduce jtag3 output verbosity
2022-02-18 22:38:40 +01:00
Hans c345985928
Merge branch 'avrdudes:main' into terminal-write 2022-02-18 22:09:42 +01:00
Joerg Wunsch c1ec836fbd PR #882 done 2022-02-18 21:37:27 +01:00
Marius Greuel 59ecd4cc65 Remove libhid support in ser_avrdoper.c in favor of libhidapi 2022-02-18 20:05:52 +01:00
Marius Greuel e31be88ce0 Add LIB_LIBHID to CMake project to fix MinGW build issue 2022-02-18 19:58:13 +01:00
MCUdude 6e7f38e81f Properly handle negative numbers
Now -3.141592 and -32768 are valid numbers that's stored correctly in memory
2022-02-18 09:58:16 +01:00
MCUdude 10e05eed21 Require single quotes when writing characters 2022-02-18 09:58:16 +01:00
MCUdude 551046052e Add support for writing floats 2022-02-18 09:58:16 +01:00
MCUdude 2a92b8cce4 Add support for memory "fill" with arbitrary data too
If you run the following command: $ write eeprom 0x00 0x10 A B C ...

It will write the following data to EEPROM:
|ABCCCCCCCCCCCCCC|
starting from address 0x00
2022-02-18 09:58:16 +01:00
MCUdude c007dc7d24 Add support for writing single characters
Now this is possible: write eeprom 0x00 a b c d e f 0x80 0x90 ! H E L L O
2022-02-18 09:58:16 +01:00
MCUdude 2589b17640 Add support for memory "fill" mode
Syntax: write <memtype> <start addr> <no. byte to write> <byte to write> ...
2022-02-18 09:58:13 +01:00
MCUdude 19e2cae053 Add Curiosity Nano to terminal list 2022-02-14 10:30:21 +01:00
MCUdude 932f68f24c Set target voltage even thoug not target is detected 2022-02-14 10:28:54 +01:00
MCUdude b1d34a510c Reduce jtag3 output verbosity 2022-02-13 19:23:48 +01:00
MCUdude f2bdcbe977 Add missing USBtiny derived programmers
ArduinoISP and the Arduino.org ISP are commercial versions of the USBtiny programmer with different USB VIDs/PIDs
2022-02-11 22:46:11 +01:00
Jörg Wunsch 76a17be4d0
Merge pull request #872 from MCUdude/jtag-string-formatting
Tweak programmer info formatting strings
2022-02-11 22:16:39 +01:00
MCUdude 80f1d96e07 Tweak programmer info formatting strings
Now all colons are on a straight line, just like #853 did to all jtag3 compatible programmers
2022-02-11 22:10:52 +01:00
Jörg Wunsch f2c73c2bb8
Merge pull request #853 from MCUdude/jtag3-clock-update
Print JTAG3 clocks after configuration + string formatting
2022-02-11 21:44:54 +01:00
MCUdude b581d14823 String formatting
Allign colons, only print clocks that are actually present (>0 kHz)
2022-02-11 21:35:07 +01:00
MCUdude 3fc39c47ad Print memory name alias together with the canonical name if present
in avrdude.conf. An example would be "avrdude: reading fuse0/wdtcfg memory:"
2022-02-11 21:10:05 +01:00
MCUdude d6ccf7a3ff Add memory alias names for megaAVR0/tinyAVR0,1,2/AVR-Dx/AVR-Ex fuses 2022-02-10 22:34:33 +01:00
Joerg Wunsch 452f673f38 Back out the last "alias" commit (search for existing alias).
It breaks the alias handling completely as the search happens
way too late. So instead, just keep any possibly duplicate
name as it won't be in our way anyway.
2022-02-10 21:26:05 +01:00
Jörg Wunsch d134dc8fff
Alias keyword (#868)
Implementation for an "alias" keyword.

By now, only applied inside memory descriptions.

* Make "mem_alias" a separate nonterminal.

The previous implementation attempt caused a syntax error in
yacc code, and separating mem_alias on the same level as
mem_spec appears to be the cleaner solution anyway.

* Maintain real memory aliases.

Instead of duplicating the aliased memory with a new name, maintain a
second list of memory aliases (per device) that contains a pointer to
the memory area it is aliased to. That way, a memory name can be
clearly distinguished between the canonical one and any aliases.

* Check p->mem_alias != NULL before touching it

* Add avr_find_memalias()

This takes a memory region as input, and searches whether an
alias can be found for it.

* We need to add a list structure for the mem_alias list, always.

By that means, mem_alias won't ever be NULL, so no need to check
later.

Also, in avr_dup_part(), duplicate the alias list.

* In a memory alias, actually remember the current name.

* In avr_dup_part(), adjust pointers of aliased memories

While walking the list of memories, for each entry, see if there is an
alias pointing to it. If so, allocate a duplicated one, and fix its
aliased_mem pointer to point to the duplicated memory region instead
of the original one.

* Add avr_locate_mem_noalias()

When looking whether any memory region has already been defined for
the current part while parsing the config file, only non-aliased names
must be considered. Otherwise, a newly defined alias would kick out
the memory definition it is being aliased to.

* When defining a mem_alias, drop any existing one of that name.

* Actually use avr_find_memalias() to find aliases

* Add declaration for avr_find_memalias()

* When defining a memory, also search for an existing alias

If the newly defined name has the same as an existing alias, the alias
can be removed.

Note that we do explicitly *not* remove any memory by the same name of
a later defined alias, as this might invalidate another alias'es
pointer. If someone defines that, the alias name just won't ever be
found by avr_locate_mem().
2022-02-10 20:39:19 +01:00
Jörg Wunsch ba314f23e9
Merge pull request #863 from MCUdude/jtag3-read-memory-alias
Add support for reading from more memory sections
2022-02-10 20:35:06 +01:00
MCUdude a43f220ef9 Add support for reading from more memory sections
It's now possible to read the following memories if present: osccal16, osccal20, tempsense, osc16err, osc20err
2022-02-07 21:51:35 +01:00
Jörg Wunsch b6a6c681df
Merge pull request #859 from dl8dtl/safemode-removal
Remove the "safemode" feature.
2022-02-05 22:03:12 +01:00
MCUdude 625027a807 Add HV UPDI pulse command 2022-02-05 14:44:13 +01:00
Joerg Wunsch 8c6c6a14ec Remove the "safemode" feature.
This feature has been designed with the sometimes quite flakey direct
(parallel or serial port attached) bitbang programming adapters in
mind that were quite common about two decades ago.

With parallel ports vanishing from modern PCs almost completely, and
the advent of various USB-attached low-cost programming devices,
this class of programmers disappeared almost completely.

Furthermore, the fuse combinations that were covered by the feature
are no longer around on all recent AVR devices, so for an ever
increasing number of devices, safemode already became meaningless and
was turned off anyway.

With the prospective version 7.x release, it's a good point in time to
introduce a major change like this one.
2022-01-31 20:44:32 +01:00
Yegor Yefremov 7ed3632902 CMake: use CMAKE_CURRENT_BINARY_DIR to locate avrdude.conf
With the split CMakeLists.txt infrastructure avrdude.conf
will be created in the build/src and not build folder. Hence,
fix its location in the install command.
2022-01-31 07:18:59 +01:00
Jörg Wunsch e0bc6a8bd6
Merge pull request #855 from MCUdude/fix-arduino-retry-attempts
Fix Arduino retry attempts
2022-01-30 10:45:24 +01:00
Joerg Wunsch b84e6862a7 Assign proper type to msg[] in errstr()
Obviously, the array ought to be of type char.

Closes Issue #856
2022-01-29 23:32:39 +01:00
MCUdude 7144a9f2ae Replace incorrect warning message
Was mistakenly added in PR #854.
2022-01-29 20:08:43 +01:00
MCUdude 28be45d8b6 Fix Ardino sync attempts
In order for the Arduino bootloader to re-sync with Avrdude, the microcontroller needs to be reset to start the bootloader again.
2022-01-29 19:53:42 +01:00
Jörg Wunsch 4ea4ff7fba
Merge pull request #850 from dl8dtl/usbasp-errstr
Fix libusb-1.0 error strings
2022-01-27 23:18:51 +01:00
Jörg Wunsch 7e7c4e630e
Merge pull request #854 from MCUdude/arduino-stk500
Set number of connection retry attempts for Arduino/STK500 programmer
2022-01-27 23:17:28 +01:00
Jörg Wunsch 39deb3a600
Merge pull request #852 from yegorich/cmake-split
CMake: split configuration in two files
2022-01-27 23:16:37 +01:00
Jörg Wunsch dd8c3ff830
Merge pull request #843 from mariusgreuel/pr-ftdi-syncbb
Fix receive buffer implementation in ftdi_syncbb programmer
2022-01-27 23:15:10 +01:00
MCUdude ad6eff0f76 Set number of Arduino/STK500 connection retry attempts
Using the extended parameter flag -x. Usage: . Default number of attempts is still 10 if not -x flag is specified
2022-01-25 09:40:24 +01:00
MCUdude 286c0f5e2a Don't print irrelevant information for the Arduino programmer 2022-01-24 22:16:31 +01:00
MCUdude f6bbaadfa6 Print clock info after the correct clock speeds has been set
The "new" clock speed set by the -B flag wasn't reflected in the output log
2022-01-23 22:45:54 +01:00
Yegor Yefremov acee6afa4e CMake: split configuration in two files
The main CMakeLists.txt file in the project's root directory takes
care of the main project settings like project name and version,
handling the options, finding dependencies, etc.

The src/CMakeLists.txt handles options that are necessary to build
libavrdude library and avrdude binary.
2022-01-23 21:22:07 +01:00
Joerg Wunsch 42a154dddf Fix libusb-1.0 error strings
Previously, all libusb-1.0 error strings have been translated
by libusb_to_errno() into an errno-like integer, only in order
to pass that one straight into strerror().

For unhandled libusb-1.0 error codes, ERANGE was returned, which
is just nonsense ("Result too large", bug #848).

Instead, use a single function errstr() now that either can
use strerror() on some well-defined errno-like code, or otherwise
just return a string that mentions the numeric value.
2022-01-21 23:13:56 +01:00
Joerg Wunsch 37b0659951 PR #816 merged
Copy over man page additions into texinfo file as well.
2022-01-21 21:56:07 +01:00
Jörg Wunsch cce7a934d6
Merge pull request #815 from MCUdude/add-memory-sections
Add more memory sections to read from
2022-01-21 21:49:29 +01:00
Jörg Wunsch 490558049e
Merge pull request #816 from andrewshadura/usbtiny-spi
Add SPI support to USBtiny
2022-01-21 21:40:00 +01:00
Jörg Wunsch 512cce405c
Merge pull request #829 from yegorich/cmake-install-liavrdude
CMake: add initial support for installing lib and include files
2022-01-21 21:37:21 +01:00