Commit Graph

70 Commits

Author SHA1 Message Date
Stefan Rueger 74cbb51ef5
Clarify comment on copying usbsn 2023-01-02 17:10:15 +00:00
Stefan Rueger 0a883973a2
Move static usbsn into serdev structure, remove serno access function 2023-01-02 16:55:33 +00:00
Joerg Wunsch b6d50ef0a9 Extend the comment for the serial number function
Hint that it is actually a function pointer rather than a serial
number itself (in whatever form).
2023-01-01 22:36:50 +01:00
Joerg Wunsch 06e999b8c5 Check whether serial_serno is not NULL before calling it.
For devices connected through a real serial device rather than
USB, there is no transport-layer serial number available.

stk500v2.c (and jtag3.c) tried to always call this function.

Closes #1254
2023-01-01 22:23:44 +01:00
Stefan Rueger 217adc543b
Merge pull request #1233 from janegilruud/fix-pickit4-snap-jtag
#1052 Add JTAG support for PICkit4 and Snap.
2022-12-21 19:12:33 +00:00
Hans c991ae9739
Read programmer serial number from libusb or hidusb (#1223)
* Silence compiler warnings

* Fix a fall-through error in switch

* Slightly reformat programmer info printout
Now the target voltage is printed out along with the HW version, FW version and serial number, and they all allign nicely. When in ISP mode, the "SCK period" value is printed _after_ the target voltage readout, and _before_ the additional clocks the programmer holds, such as JTAG, PDI and UPDI clocks.

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
2022-12-21 19:11:31 +00:00
Jan Egil Ruud d1010fd46f #1052 Add JTAG support for PICkit4 and Snap. 2022-12-20 11:59:00 +01:00
MCUdude 30e90bdfd2 Add alternative USB PID for PICkit4/SNAP in PIC mode 2022-12-14 20:11:43 +01:00
Jan Egil Ruud f08f771ab4 #822 Fixed print_parms for TPI. 2022-12-13 15:07:14 +01:00
Jan Egil Ruud af43a7757d #822 Print Vtarget when using TPI. 2022-12-12 14:31:41 +01:00
Jan Egil Ruud bb808e8d5f Skip chaching when size of memory is 0. 2022-12-01 15:16:23 +01:00
Jan Egil Ruud e18b5c4fb0 Made the code a little prettier. 2022-12-01 00:01:29 +01:00
Jan Egil Ruud b643f0a1a0 #822 Fixed bug in TPI byte write for ATtiny20 and ATtiny40. 2022-11-30 23:49:20 +01:00
Jan Egil Ruud 95160e8801 Changed verbose level on TPI initialize notice. 2022-11-30 23:21:30 +01:00
Jan Egil Ruud 1eb6a06055 #822 Small refactoring and clean up. 2022-11-30 23:07:05 +01:00
Jan Egil Ruud cad296f780 Attempt to fix msvc builds. 2022-11-30 00:27:25 +01:00
Jan Egil Ruud 90bd24a902 #822 Added support for TPI page write. 2022-11-30 00:14:19 +01:00
Jan Egil Ruud 2f5566a8ed #822 Added support for TPI page load. 2022-11-29 20:34:05 +01:00
Jan Egil Ruud f9a2bd0327 Got added support for reading and writing fuses, and chiperase. 2022-11-23 14:25:14 +01:00
Jan Egil Ruud 5dc2545716 Cleaned and improved TPI send and receive. 2022-11-22 14:05:01 +01:00
Jan Egil Ruud 3afdd55089 Get rid of TPI magic numbers. 2022-11-22 13:23:57 +01:00
Jan Egil Ruud 32a6ca39e4 Cleaned up whitespace in jtag3.c so it at least is consistent within the file. 2022-11-22 13:05:14 +01:00
Jan Egil Ruud 10ccf0f515 Initial commit for jtag3 TPI support. Can read signature on ATtiny104 XPlained mini, but nothing else yet. 2022-11-21 21:18:13 +01:00
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 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
MCUdude 14446950df Check for PICkit4 or SNAP in PIC mode 2022-10-20 12:19:10 +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
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
MCUdude ffabab1fb2 Improve pgm->id detection handling 2022-10-02 11:48:30 +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
Stefan Rueger 4070ca9012
Distinguish different JTAG programming modes 2022-09-20 18:36:46 +01:00
Stefan Rueger b0198a319f
Offload the programming interface info from part->flags to part->prog_modes
flags now just hold parameters of the JTAG interface and some secondary
serial, parallel, pseudo parallel info. This separation brings clarity. It
used to be hard to augur whether a part has an ISP interface:

   (part->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI
    | AVRPART_HAS_UPDI)) == 0 && (part->flags & AVRPART_SERIALOK) != 0

or had HVSP or HVPP capability, for that matter. Now it is just, eg,

  part->prog_modes & PM_ISP
  part->prog_modes & PM_HVPP
2022-08-30 16:33:42 +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 6fa7400e4e
Merge pull request #1015 from MCUdude/hv-updi
Add support for high-voltage UPDI
2022-07-18 14:28:39 +01:00
MCUdude dde35018eb Exit if programmer can't send HV pulse to target 2022-07-13 23:49:14 +02: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
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
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 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 e068341716 Make sure "-x hvupdi" is only valid for Pickit4 and Powerdebugger 2022-06-29 17:12:57 +02:00