Commit Graph

374 Commits

Author SHA1 Message Date
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
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
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