Commit Graph

2016 Commits

Author SHA1 Message Date
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
Stefan Rueger
affe4cb50a Merge pull request #1034 from stefanrueger/config_file
Cache config_file components in AVRPART and PROGRAMMER structures
2022-07-19 13:05:42 +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
Stefan Rueger
87401d341e Merge branch 'main' into main 2022-07-18 15:56:43 +01:00
Stefan Rueger
a5552f64cf Update NEWS 2022-07-18 14:38:37 +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
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
5690352676 Merge branch 'avrdudes:main' into main 2022-07-12 18:19:57 +01:00
Stefan Rueger
feb38b83ef Merge branch 'avrdudes:main' into terminal 2022-07-12 18:18:39 +01:00
Hans
dc6c10dc6c Merge pull request #3 from janegilruud/hv-updi
Clean up and simplify hvupdi handling, and set default hvupdi_variant
2022-07-12 19:09:07 +02:00
Stefan Rueger
c81f52ff10 Update NEWS 2022-07-12 15:52:37 +01:00
Stefan Rueger
09a95a3717 Merge pull request #936 from stefanrueger/issue918
Fix Issue #918: Enable avrdude to send full input file incl trailing 0xff
2022-07-12 15:34:17 +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
e867486f3f Merge pull request #1023 from stefanrueger/issue1004
Fix PICKit2 ATmega2560 flash paged flash read
2022-07-12 14:51:56 +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