Commit Graph

637 Commits

Author SHA1 Message Date
MCUdude 577ee72db7 Fix Type 2 HV UPDI
Used on AVR-DD and AVR-Ex targets
2022-10-31 11:06:14 +01:00
Stefan Rueger 50046da923
Merge pull request #1151 from dbuchwald/serialupdi_page_erase
Implementation of SerialUPDI page erase operation
2022-10-29 11:02:17 +01:00
Stefan Rueger d87eb14dc9
Make -p variable partdesc global 2022-10-29 10:55:58 +01:00
Stefan Rueger 87df3216cb
Make fileio() and do_op() arguments const where possible 2022-10-29 10:48:47 +01:00
Stefan Rueger a1018999c4
Correct plural for message writing %d bytes in term.c 2022-10-26 08:42:03 +01:00
Stefan Rueger 418cf08e84
Change avrdude.conf.in comment on location of per-user config file 2022-10-25 18:13:28 +01:00
mcuee f2a413d2dc
Merge branch 'avrdudes:main' into Xplained_Pro_PDI 2022-10-24 07:57:55 +08:00
Stefan Rueger 3769332afd
Merge pull request #1142 from MCUdude/stk600-pdi
STK600 supports programming using PDI
2022-10-23 23:10:10 +01:00
Stefan Rueger ae5b460859
Merge pull request #1141 from stefanrueger/paged
Always use paged access for programmers that serve bootloaders
2022-10-23 22:33:31 +01:00
Stefan Rueger baaad71aa5
Support optiboot, optiboot_dx and optiboot_x bootloaders for -c arduino (#1140)
* If bootloaders are served, send word addresses for classic parts and
  byte addresses for newer parts, eg, UPDI and PDI
* Load ext addr for stk500v1 bootloaders after grazing 64k boundaries
* Fix bootloader stk500v1 EEPROM r/w for classic parts with page size 1
2022-10-23 22:32:29 +01:00
Stefan Rueger 16922842be
Improve -B bitclock documentation 2022-10-23 22:26:07 +01:00
Stefan Rueger 2c7083f001
Merge pull request #1139 from steelman/isp-clock-error-message
Mention -B in the error message and document -F better
2022-10-23 21:59:21 +01:00
Stefan Rueger 4f6bab6303
Merge pull request #1138 from MCUdude/pic-detect-mode-cherry
Detect PICkit4 and SNAP in PIC mode
2022-10-23 21:57:26 +01:00
Stefan Rueger 5b008a04cf
Revamp terminal output: progress bar, callback and stdout/stderr (#1132)
* Print parms output to stdout
* Flush terminal writes and other minor changes
* Prepare terminal for periodic calls to programmer to reset bootloader WDT
* Only show progress reports for memories > 32 bytes or on -vv
* Freeze progress bar on serious error
* Allow cached r/w byte routines to be used in pgm->read_byte and pgm->write_byte
2022-10-23 21:56:45 +01:00
steelman 34fa2faba5
Look for ~/.config/avrdude/avrduce.rc configuration file (#1131)
* Look for ~/.config/avrdude/config configuration file

Traditionally per-user configuration files have been placed
in user's home directory with their names beginnig with a dot
to hide them from some tools like ls(1). However, the number
of programs following this convention have grown over time
to the point where the number of hidden files becomes inconvenient to
some users. For this reason the XDG Base Directory Specification[1]
specifies an alternate place to store configuration files under
~/.config directory.

This patch enables avrdude to look for ~/.config/avrdude/config
configuration file, if ~/.avrduderc doesn't exist.

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.8.html

* Safely concatenate directories and configurations files and minor changes in docs

* Make stats variable available for WIN32 again in main.c

* Utilise full usr_config[] array space

* Check for xdg-style avrdude.rc file first before fallback ~/.avrduderc

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
2022-10-23 21:52:54 +01:00
Dawid Buchwald fa1c081a94 Implemented page erase operation for SerialUPDI 2022-10-23 15:06:06 +02:00
mcuee 4a5efa7635
Add xplainedpro_pdi programmer
This will fix https://github.com/avrdudes/avrdude/issues/1143.

Xplained Pro should be able to support PDI mode as per the documentation.

Reference: take note that the following document does not cover UPDI support.
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42096-Microcontrollers-Embedded-Debugger_User-Guide.pdf

Reference discussion:
* https://github.com/avrdudes/avrdude/pull/1139#issuecomment-1286760773
* https://github.com/avrdudes/avrdude/discussions/1019#discussioncomment-3569440
2022-10-23 14:24:57 +08:00
MCUdude 992e9666a3 STK600 supports programming using PDI 2022-10-22 12:51:03 +02:00
Łukasz Stelmach c890ff90eb Mention -B in the error message
One of possible problems of failed initialization is too hight frequency
of ISP clock. Mention using -B option as a possible solution.

Closes #1133
2022-10-21 02:33:34 +02:00
Stefan Rueger b9396bcd02
Always use paged access for programmers that serve bootloaders 2022-10-21 00:56:43 +01:00
Łukasz Stelmach 9977f1ed12 Document meaning of -F during initialization 2022-10-20 19:52:35 +02:00
MCUdude 72da5c73db Fix formatting and replace tabs with spaces 2022-10-20 12:39:11 +02:00
MCUdude 867d83c215 Print error message if no HID device is connected when using hidapi 2022-10-20 12:27:59 +02:00
MCUdude 14446950df Check for PICkit4 or SNAP in PIC mode 2022-10-20 12:19:10 +02:00
MCUdude b083416e3b Let Avrdude use the valid SNAP USB PID first 2022-10-20 12:19:10 +02:00
MCUdude 13817459e1 Add missing USB VID/PIDs 2022-10-20 12:19:10 +02:00
MCUdude c999083b8f Change message type from error to warning and add additional USB info 2022-10-20 12:18:42 +02:00
Stefan Rueger b864d7e73a
Update NEWS and resolve minor residual messaging issues 2022-10-17 16:39:45 +01:00
Stefan Rueger e172877724
Review and overhaul AVRDUDE's messaging system (#1126)
* Change avrdude_message(MSG_XYZ, ...) to msg_xyz(...)
* Define and use pmsg_xyz(...) instead of msg_xyz("%s: ...", progname, ...)
* Review and change avrdude_message() levels
   - Introduce new levels warning, error and ext_error
   - Distribute info level to info, warning, error, ext_error
   - Assign levels (more) consistently
   - Unify grammar, punctuation and style of messages
* Use imsg_xyz() to print indented messages
* Show function name in errors and warnings on -v
* Reduce effective verbosity level by number of -q above one
2022-10-17 15:44:55 +01:00
Stefan Rueger 2503ae03ce
Merge pull request #1125 from MCUdude/updi-lock-fix
Fix UPDI erase when target is locked
2022-10-17 14:17:32 +01:00
Stefan Rueger ff1d26ad18
Merge pull request #1122 from mariusgreuel/pr-teensy-warning
Suppress Teensy USB communication error message on reboot
2022-10-17 14:17:07 +01:00
Stefan Rueger 8e879cfae6
Merge pull request #1121 from stefanrueger/avr_cache
Use byte-wise read/write when page size is 1 in terminal cache
2022-10-17 14:16:43 +01:00
Dan Applegate 946b701b08
Fix writing of last word on DWORD TPI parts (#1115)
* Fix writing of last word on DWORD TPI parts

* Add n_word_writes AVRMEM config option

* TPI word chunk mode in avr_write_mem

* Simplify addition of n_words_write mem component to grammar

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
2022-10-17 14:15:50 +01:00
Stefan Rueger 08f4f6c63f
Merge pull request #1112 from MCUdude/jtag3-page-erase-updi
Fix jtag3_page_erase for targets with UPDI
2022-10-17 14:12:17 +01:00
MCUdude bfec594ffd Fix issue where locked UPDI devices couldn't be erased
Resolves issue #1124
2022-10-13 14:14:46 +02:00
Stefan Rueger 714c2fbf95
Rename variable for clarity in avrcache.c 2022-10-12 15:55:22 +01:00
Stefan Rueger 8a3864d263
Fall back on bytewise r/w if paged access fails for avr cache 2022-10-12 15:53:54 +01:00
Marius Greuel 86155bdf66 Suppress Teensy USB communication error message on reboot 2022-10-11 18:23:03 +02:00
Stefan Rueger 48919f59b3
Use byte-wise read/write when page size is 1 in terminal cache 2022-10-11 15:31:18 +01:00
Stefan Rueger e14e5d2f74
Update NEWS 2022-10-11 14:49:44 +01:00
Stefan Rueger 22362e9f08
Merge branch 'main' into pr-pointer-truncation 2022-10-11 14:43:19 +01:00
Stefan Rueger d3a3257cf7
Improve help message in terminal and provide new command pgerase (#1113) 2022-10-11 14:40:37 +01:00
Marius Greuel 9377acee0e Fix pointer truncation for Windows x64 2022-10-08 19:02:03 +02:00
MCUdude 1ca1be0447 Use avr_mem_is_flash_type() instead of checking m->desc directly 2022-10-06 20:59:32 +02:00
MCUdude d5e4ed9f89 Fix jtag3_page_erase for targets with UPDI
Very handy to have now that #1106 is merged
2022-10-05 23:52:05 +02:00
Stefan Rueger cd79f81747
Merge pull request #1109 from MCUdude/jtag-mki-targets
Add missing AVR variants the original JTAG ICE supports
2022-10-05 22:21:42 +01:00
Stefan Rueger f2fb3b45b4
Merge pull request #1108 from MCUdude/avr109-xmega
AVR109: support for prodsig read and usersig read/write
2022-10-05 22:20:16 +01:00
Stefan Rueger d74b17b9b4
Provide cached byte-wise read/write API (#1106)
* Provide cached byte-wise read/write API

int avr_read_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const
  AVRMEM *mem, unsigned long addr, unsigned char *value);

int avr_write_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const
 AVRMEM *mem, unsigned long addr, unsigned char data);

int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p);

int avr_chip_erase_cached(const PROGRAMMER *pgm, const AVRPART *p);

int avr_reset_cache(const PROGRAMMER *pgm, const AVRPART *p);

avr_read_byte_cached() and avr_write_byte_cached() use a cache if paged
routines are available and if the device memory is EEPROM or flash,
otherwise they fall back to pgm->read_byte() and pgm->write_byte(),
respectively. Byte-wise cached read always gets its data from the cache,
possibly after reading a page from the device memory. Byte-wise cached
write with an address in memory range only ever modifies the cache. Any
modifications are written to the device after calling avr_flush_cache() or
when attempting to read or write from a location outside the address range
of the device memory.

avr_flush_cache() synchronises pending writes to EEPROM and flash with the
device. With some programmer and part combinations, flash (and sometimes
EEPROM, too) looks like a NOR memory, ie, one can only write 0 bits, not 1
bits. When this is detected, either page erase is deployed (eg, with parts
that have PDI/UPDI interfaces), or if that is not available, both EEPROM
and flash caches are fully read in, a pgm->chip_erase() command is issued
and both EEPROM and flash are written back to the device. Hence, it can
take minutes to ensure that a single previously cleared bit is set and,
therefore, this routine should be called sparingly.

avr_chip_erase_cached() erases the chip and discards pending writes() to
flash or EEPROM. It presets the flash cache to all 0xff alleviating the
need to read from the device flash. However, if the programmer serves
bootloaders (pgm->prog_modes & PM_SPM) then the flash cache is reset
instead, necessitating flash memory be fetched from the device on first
read; the reason for this is that bootloaders emulate chip erase and they
won't overwrite themselves (some bootloaders, eg, optiboot ignore chip
erase commands altogether) making it truly unknowable what the flash
contents on device is after a chip erase. 

For EEPROM avr_chip_erase_cached() concludes that it has been deleted if a
previously cached EEPROM page that contained cleared bits now no longer
has these clear bits on the device. Only with this evidence is the EEPROM
cache preset to all 0xff otherwise the cache discards all pending writes
to EEPROM and is left unchanged otherwise.

Finally, avr_reset_cache() resets the cache without synchronising pending
writes() to the device.
2022-10-05 22:16:15 +01:00
Stefan Rueger c4cb242823
Merge pull request #1105 from MCUdude/power-debugger-features
Support for Power Debugger analog readings in terminal mode
2022-10-05 22:03:52 +01:00
Stefan Rueger bc9137854b
Merge pull request #1103 from s-wakaba/sunxi_linuxspi_support
saving errno of ioctl() call in a temporary variable to prevent overwrite
2022-10-05 22:02:42 +01:00
Stefan Rueger 83232bc7e1
Merge pull request #1102 from MCUdude/flip2-reset
Add support for Flip 2 reset on exit
2022-10-05 22:02:22 +01:00
Hans da275f8ef2 Adjust prog_modes on a few chip variants
Now variants of chips that the JTAG ICE supports will not cause a warning when used with the original JTAG ICE mkI.
Also, The ATmega165 isn't officially supported by the ICE mkI, so this should be properly tested with the ICE mkI first.
2022-10-05 19:24:40 +02:00
MCUdude 31c3db2617 Add support for prodsig read and usersig read/write
Currently only supported by the Xboot bootloader
2022-10-02 22:36:43 +02:00
MCUdude ffabab1fb2 Improve pgm->id detection handling 2022-10-02 11:48:30 +02:00
MCUdude 419fd35b72 Mention linuxspi and flip2 programmers
in the -E exitspecs section. linuxspi and flip2 supports "-E reset" and "-E noreset".
2022-10-01 22:12:37 +02:00
MCUdude e05aa16510 use pgm->id to identify Power Debugger instead of USB PID 2022-10-01 21:17:55 +02:00
MCUdude e39133daf5 Initial support for Power Debugger analog reading
Voltage and current though channel A and B
2022-10-01 21:17:01 +02:00
MCUdude 01ccab08b4 Improve exitspecs (-E) parsing
Use the same implementation as linuxspi does, instead of the one suggested in #733
2022-09-30 20:16:16 +02:00
MCUdude 521155c1c2 Improve punctuation in error message 2022-09-30 20:03:04 +02:00
MCUdude e1a317c670 Remove Flip 2 stub functions
Used when compiling without libusb. Print reasonable error instead
2022-09-27 19:35:25 +02:00
Shunichi Wakabayashi 2a64e78c7b bugfix: saving errno of ioctl() call in a temporary variable to prevent overwriting by following avrdude_message() call 2022-09-25 16:46:10 +09:00
MCUdude 80ca8a644e Add support for Flip 2 reset on exit
This makes it possible for the application to start immedeatly after the program has been loaded.
Simply use '-E reset' or '-E noreset'. Default is no reset.
Closes #733
2022-09-24 22:48:14 +02:00
MCUdude 62aa480876 Fix avr109 extended address
Closes #360 #454
2022-09-24 20:42:42 +02:00
Stefan Rueger 9a59941dfe
Merge pull request #1100 from s-wakaba/sunxi_linuxspi_support
add extended parameter "disable_no_sc" for linuxspi programmer
2022-09-24 13:23:38 +01:00
Stefan Rueger 94203eb441
Merge pull request #1099 from stefanrueger/prog_modes
Print compatible parts for programmer and vice versa using -c? or -p?
2022-09-24 13:23:12 +01:00
Stefan Rueger f172f05372
Merge pull request #1096 from mariusgreuel/pr-cmake-texinfo
CMake: Build docs
2022-09-24 13:22:55 +01:00
Stefan Rueger 7743051926
Merge pull request #1095 from mariusgreuel/pr-fix-multiline-configure
CMake: Fix dependency chain between avrdude.conf.in and avrdude.conf
2022-09-24 13:22:37 +01:00
Stefan Rueger db8b04f423
Merge pull request #1094 from papazoga/main
avrdude.conf.in: Adds digilent-hs2 dongle
2022-09-24 13:22:14 +01:00
Stefan Rueger 3b8ac76246
Merge pull request #1093 from stefanrueger/gemmaBoot
Create two bootloader programmers for gemmaBoot boards
2022-09-24 13:21:44 +01:00
Stefan Rueger fe991b8214
Merge pull request #917 from asmirnou/iss45256-sysfs-gpio
Fix permission denied error in linuxgpio programmer
2022-09-24 13:21:08 +01:00
Stefan Rueger f17a012325
Update documentation for linuxspi extended parameter disable_no_cs 2022-09-24 00:16:55 +01:00
Stefan Rueger 097c78098d
Change printf() to avrdude_message() in linuxgio.c 2022-09-23 23:28:47 +01:00
Stefan Rueger ca154f812f
Improve error messaging in linuxspi.c 2022-09-23 16:53:52 +01:00
Stefan Rueger aa789d4662
Change error messages in linuxspi.c to maintain single style 2022-09-22 10:39:31 +01:00
Stefan Rueger 93df07866a
Inform user of -x disable_no_spi when needed (without -v) 2022-09-22 10:31:59 +01:00
Stefan Rueger d8ff9bef6c
Improve error messaging when part or programmer are invalid 2022-09-21 15:38:05 +01:00
Stefan Rueger 9e836d7988
Ensure avrdude.conf (programmer, part) pairs allow max one programming mode 2022-09-21 12:12:06 +01:00
Stefan Rueger 4c29edbc41
Warn if a part shares multiple programming modes with a programmer 2022-09-21 12:10:24 +01:00
Stefan Rueger 0175ffd21f
Shorten more redundant programmer description for -c \? -p part 2022-09-20 22:03:40 +01:00
Stefan Rueger 505d53c2e1
Shorten redundant for bootloader description in -c ? -p part output 2022-09-20 21:55:29 +01:00
Stefan Rueger b04a83b1a2
Document conditional options -c ? -p part and -p ? -c programmer 2022-09-20 21:39:15 +01:00
Stefan Rueger 97c5ac312a
Shorten redundant programmer description for -c \? -p part 2022-09-20 21:37:49 +01:00
Stefan Rueger 4070ca9012
Distinguish different JTAG programming modes 2022-09-20 18:36:46 +01:00
Shunichi Wakabayashi be40d3b260 add extended parameter "disable_no_sc" for linuxspi programmer 2022-09-20 01:32:12 +09:00
Stefan Rueger 07f1f60020 Make cosmetic changes to avrdude.conf.in 2022-09-16 19:10:39 +01:00
Stefan Rueger fba2ac0330 Align = of -p? and -c? output 2022-09-16 19:09:35 +01:00
Stefan Rueger 7a76967851 Clarify desc lines for SPM programmers in avrdude.conf.in 2022-09-16 16:14:18 +01:00
Stefan Rueger 669796119a Add prog_modes lines for par programmers in avrdude.conf.in 2022-09-16 16:13:18 +01:00
Stefan Rueger f8a62cca34
Print compatible parts for programmer and vice versa using -c? or -p?
For example:
 $ avrdude -p m328p -c?
 $ avrdude -p? -c jtag2dw
2022-09-14 23:00:57 +01:00
Stefan Rueger 0d411f2879
Add prog_modes lines for programmers in avrdude.conf.in 2022-09-14 18:36:37 +01:00
Stefan Rueger ac8fbadff4
Add assignment injection code for -c*/si 2022-09-14 18:04:12 +01:00
Stefan Rueger 7087fd9f3e
Raise info level for overwriting mcuid to MSG_DEBUG 2022-09-11 23:08:48 +01:00
Stefan Rueger 168a8b92e9
Default mcuid without warning for parts known at compile time 2022-09-11 15:33:23 +01:00
Stefan Rueger a5f3885b50 Add and modify programmers for gemmaBoot in avrdude.conf.in 2022-09-07 09:56:28 +01:00
Marius Greuel 8ecae62f4a CMake: Add install commands for docs 2022-09-04 17:48:12 +02:00
Marius Greuel c633255c01 CMake: Add initial support for texinfo docs 2022-09-04 16:55:16 +02:00
Marius Greuel 07ed4746be CMake: Fix dependency chain between avrdude.conf.in and avrdude.conf 2022-09-04 16:19:01 +02:00
Stefan Rueger b99df388bd
Change comment for diligent-hs2 in avrdude.conf.in 2022-09-01 13:08:44 +01:00
Alex Papazoglou bf70b5fc8c avrdude.conf.in: Cosmetic changes
Corrected formatting using /s. Added a URL for the
reference manual.
2022-08-31 20:43:27 -07:00
Alex Papazoglou 4af49bb5fb avrdude.conf.in: Adds digilent-hs2 dongle
Adds support for Digilint JTAG HS2 in MPSSE mode.
2022-08-31 11:45:08 -07:00