Commit Graph

40 Commits

Author SHA1 Message Date
joerg_wunsch d32c587511 Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9507: Fix UPDI chip erase
* libavrdude.h (PROGRAMMER): add unlock method
* avr.c (avr_unlock): Generic unlock function
* jtag3.c: Implement unlock feature; avoid calling
jtag3_edbg_prepare() and jtag3_edbg_signoff() on XplainedMini
boards to work around a bug in early firmware versions;
implement "userrow" memory region
* main.c: Call avr_unlock() rather than avr_chip_erase() when
encountering a locked UPDI chip



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1417 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-16 21:17:04 +00:00
joerg_wunsch dd7ee6507b Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9507: Fix UPDI chip erase
* lexer.l (family_id): New keyword.
* config_gram.y: (Ditto)
* doc/avrdude.texi: Document new keyword
* avrdude.conf.in: Add family_id for avr8x devices
* avr.c: Pass error code up.
* jtag3.c: Pass error code from memory read up; implement
jtag3_read_sib()
* libavrdude.h: Add new items.
* main.c: Implement different chip erase handling required
for UPDI devices.

Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9506: Script to create device configuration stub from Atmel ATDF files
* avrdude.conf.in (ATtiny202, ATtiny204, ATtiny402, ATtiny404)
(ATtiny406, ATtiny804, ATtiny806, ATtiny807, ATtiny1604)
(ATtiny1606, ATtiny1607, ATtiny212, ATtiny214, ATtiny412)
(ATTiny414, ATtiny416, ATtiny417, ATtiny814, ATtiny816)
(ATtiny1614, ATtiny1616, ATtiny3214, ATtiny3216, ATtiny3217)
(ATmega3208, ATmega3209, ATmega4808, ATmega4809): New devices




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1405 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-09 23:29:31 +00:00
joerg_wunsch e9bf58c1cf Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9507: Fix UPDI chip erase
* jtag3.c (jtag3_chip_erase_updi): New function
* jtag3_private.h: More constants




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1403 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-12-30 00:05:54 +00:00
joerg_wunsch 27d0aebbbe Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9482: Add support for UPDI and AVR8X
* avrdude.conf.in (xplainedpro_updi): New programmer
* avrdude.conf.in (.avr8x, ATtiny1617, ATtiny817): New device
family and devices
* config_gram.y: add K_OCD_BASE and K_HAS_UPDI
* lexer.l: (Ditto.)
* doc/avrdude.texi: Document "has_updi" flag
* jtag3.c: Implement UPDI
* jtag3.h: (Ditto.)
* jtag3_private.h: (Ditto.)
* libavrdude.h: Add ocd_base value and AVRPART_HAS_UPDI flag
* pgm_type.c: Add jtagice3_updi




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1398 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-11-29 23:09:51 +00:00
joerg_wunsch 2bfcdee899 Back out rev 1385, it was committed accidentally.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1386 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-03-02 16:49:01 +00:00
joerg_wunsch ece76fba59 Support packet fragmentation and reassembly in hid_thread(), for
mEDBG devices.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1385 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-03-02 16:45:10 +00:00
joerg_wunsch 6927e1aa06 Use libhidapi as (optional) transport for CMSIS-DAP compliant
debuggers (JTAGICE3 with firmware 3+, AtmelICE, EDBG, mEDBG).



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1381 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-20 22:50:13 +00:00
joerg_wunsch a94e7b1325 patch #8435: Implementing mEDBG CMSIS-DAP protocol
* usb_libusb.c: Add endpoint IDs for Xplained Mini, correctly
transfer trailing ZLP when needed
* avrdude.conf.in (xplainedmini, xplainedmini_dw): New entries.
* jtag3.c (jtag3_edbg_send, jtag3_edbg_recv_frame): Implement
fragmentation needed for the 64-byte EP size of the Xplained Mini




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1369 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-15 19:58:45 +00:00
joerg_wunsch ccaf9e9549 bug #42908: no external reset at JTAGICE3
* jtag3.c (jtag3_initialize): Retry with external reset applied if
the first sign-on attempt fails.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1349 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-11-24 09:52:00 +00:00
joerg_wunsch 48c365e31c bug #43078: AVRDUDE crashes after sucessfully reading/writing eeprom
* jtag3.c (jtag3_edbg_recv_frame): Return correct length as
reported in the response packet, rather than full 512 byte which
are always reported by the CMSIS-DAP layer.  Miscalculations
based on the wrongly reported length caused heap corruption
elsewhere, so this is presumably also a fix for bug #43078.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1344 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-11-23 20:46:53 +00:00
joerg_wunsch 7248d0ad5e bug #37441: lockbits in ATxmega + avrdude = problem
* fileio.c: replace strmcp(..., "lock") by strncmp(..., "lock", 4)
where applicable



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1338 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-10-15 20:01:12 +00:00
awachtler bb48be1ac0 added verbose level in avrdude_message()
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1321 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-06-13 20:07:40 +00:00
joerg_wunsch 5c2c6eaa88 Join the former "public" header files (avr.h avrpart.h pindefs.h
serial.h fileio.h safemode.h update.h pgm_type.h config.h confwin.h
lists.h) into a single header that can be included by anyone wanting
to link against the library.

Adapt everything to cope with this situation.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1311 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-19 10:01:59 +00:00
awachtler 7b43620402 Exchange of fprintf(stderr, ...) with avrdude_message(...).
This change was made for the shared library, since library functions
should not write to std-streams directly. Instead avrdude_message()
has to be implemented by the library user. For the avrdude application
this function is implemented in main.c.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1305 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-18 08:41:46 +00:00
joerg_wunsch 8dcc336e04 In jtag3_recv, avoid memmov'ing more data than available
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1286 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-28 14:24:48 +00:00
joerg_wunsch c28f96597a For EDBG protocol, always use 512-byte block I/O. The lower layers
will split this according to the EP's maxsize.  This makes it work
over USB 1.1 connections (albeit very slowly, due to the interrupt
transfers used).


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1284 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-27 13:26:15 +00:00
joerg_wunsch 7999eaa25a Turn the usbpid parameter of the programmer into a list of PIDs. Make
the JTAGICE3 programmer handle a list of PIDs, by trying each of them
in sequence.  Use a single, central jtag3_open_common() function to
handle the common code of all jtag3_open_* functions.  Centralize all
USB VID/PID definitions in usbdevs.h.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1283 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-27 13:06:03 +00:00
joerg_wunsch b1c64fbe92 Implement the Atmel EDBG/CMSIS-DAP driver protocol for JTAGICE3
(running firmware 3.x) and XplainedPro boards.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1278 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-26 17:54:32 +00:00
joerg_wunsch 66e2a16c9c Change the second parameter of the ser_open method from "baud" into a
"union pinfo", so the USB parameters can be passed without hacks.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1276 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-21 13:44:11 +00:00
joerg_wunsch 7023e2345c * jtag3.c (jtag3_initialize): Fix a buffer overflow by limiting
the flash page cache size to at most "readsize".  For Xmegas with
a page size of 512 bytes, the maximum USB packet size was
overflowed, and subsequently, a memmove copied beyond the end of
the allocated buffer.
* jtag3.c (jtag3_read_byte): Add the correct offset also for the
various flash regions, so reading the apptable or boot regions
yields the correct data.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1237 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-17 15:06:35 +00:00
joerg_wunsch 3fcf8a6067 * jtag3.c (jtag3_write_byte): Do not attempt to start the paged
algorithm for EEPROM when being connected through debugWIRE.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1210 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-07 20:40:29 +00:00
joerg_wunsch 038807958e Extend the single-byte algorithm to all devices, both flash and
EEPROM.  (Flash cells must have been erased before though.)
* jtag3.c (jtag3_initialize): OCDEN no longer needs to be
considered; a session with "programming" purpose is sufficient
* jtag3.c (jtag3_write_byte): Use the paged algorithm for all
flash and EEPROM areas, not just Xmega.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1209 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-06 07:06:13 +00:00
joerg_wunsch 8daa7cecd4 Fix single-byte EEPROM updates on Xmega:
* jtag3_private.h (MTYPE_EEPROM_XMEGA): New define.
* jtag3.c (jtag3_write_byte): When updating flash or
EEPROM on Xmega devices, resort to jtag3_paged_write()
after filling and modifying the page cache.
* jtag3.c (jtag3_paged_write): use MTYPE_EEPROM_XMEGA
where appropriate.
* jtag3.c (jtag3_initialize): Open with debugging intent
for Xmega devices, so single-byte EEPROM updates will
work.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1208 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-05 21:18:01 +00:00
joerg_wunsch d3934de629 bug #39691 Buffer overrun when reading EEPROM byte with JTAGICE3
* jtag3.c (jtag3_initialize): initialize the eeprom_pagesize
private attribute so the page cache will actually be usable



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1202 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-03 11:58:31 +00:00
joerg_wunsch ce90fe7b74 bug #38580 Current svn head, xmega and fuses, all fuses tied to fuse0
* jtag3.c (jtag3_read_byte, jtag3_write_byte): Correctly apply the
relevant part of mem->offset as the address to operate on.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1201 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-03 11:32:47 +00:00
joerg_wunsch 12de7132f3 bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
* pickit.c (usb_open_device): Use %p rather than %X to print "handle"
which is a pointer
* jtag3.c (jtag3_initialize): Initialize "flashsize" to be sure it
proceeds with a valid value.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1197 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-02 20:30:09 +00:00
joerg_wunsch 1b8fc9897d Replace some stray calls to putchar() by putc(..., stderr).
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1131 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-01-08 21:02:01 +00:00
joerg_wunsch ac8b2858ad * usb_libusb.c (usbdev_open): Downgrade the max transfer size for
the main data endpoints when being forced so by the USB; this can
happen when attaching the JTAGICE3 to a USB 1.1 connection
* jtag3.c (jtag3_initialize): When detecting a downgraded max
transfer size on the JTAGICE3 (presumably, due to being connected
to USB 1.1 only), bail out as its firmware cannot properly handle
this (by now)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1129 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-01-02 10:16:37 +00:00
joerg_wunsch 05fd0beac1 * config_gram.y: Implement the "ocdrev" keyword
* avrpart.c: (Dito)
* avrpart.h: (Dito)
* lexer.l: (Dito)
* avrdude.conf.in: Add "ocdrev" key/value pairs, based
on the AS6 XML file information.
* jtag3.c: Use the ocdrev in the parameter block.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1124 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-12-04 13:59:37 +00:00
joerg_wunsch 1f7b134420 * jtag3.c: Make jtag3_command() public
* jtag3.h: (Dito.)
* jtag3_private.h: Add two new commands
* stk500v2.c: Implement the "MonCon disable" hack that
allows temporarily falling back to ISP when trying to
talk to a part that has debugWIRE enabled



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1123 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-12-03 21:03:06 +00:00
joerg_wunsch 3024312901 Enable interactive adjustment of the various
clock frequencies (JTAG Xmega, JTAG megaAVR, PDI Xmega)
through the set_sck_period() callback.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1121 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-12-03 16:52:23 +00:00
joerg_wunsch 707ddd2de9 Remove unused code that was left over from
cloning the jtagmkII.c implementation



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1120 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-12-03 16:09:34 +00:00
joerg_wunsch 97357595b6 * pgm_type.c: Add "jtagice3_isp" programmer hook
* avrdude.conf.in: Add "jtag3isp" programmer
* jtag3.c: jtag3_setparm() is now public
* jtag3.h: (Dito)
* stk500v2_private.h: Command 0x1D is CMD_SPI_MULTI only
for STK500v2, AVRISPmkII, and JTAGICEmkII; for JTAGICE3,
it's CMD_SET_SCK now; also add CMD_GET_SCK
* avrpart.c (avr_get_output_index): New function
* avrpart.h: (Dito)
* stk500v2.c: Implement the pasthrough programmer glue logic
for JTAGICE3 in ISP mode
* stk500v2.h: (Dito)
* avrdude.1: Document the JTAGICE3 support.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1119 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-12-03 15:52:38 +00:00
joerg_wunsch de55b22e86 Add a failure code for debugWIRE communication failures I
happened to run into.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1118 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-30 22:18:34 +00:00
joerg_wunsch 4e0801803f * jtag3.c (jtag3_read_byte, jtag3_write_byte): Remove the
m->offset from addr, JTAGICE3 doesn't need it anymore (similar
to JTAGICEmkII with 7+ firmware)
* jtag3.c (jtag3_read_byte): Allow for full-page reads of
EEPROM also for Xmega and debugWIRE, allow for signature
read in debugWIRE




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1117 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-30 12:51:07 +00:00
joerg_wunsch d8ad0fdb28 * jtag3_private.h: Add two more error detail codes I stumbled
across during development
* jtag3.c: (Dito.)
* usb_libusb.c: Reduce timeouts from 100 to 10 s, still long
enough, but not getting cold feet when something goes wrong.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1116 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-30 12:36:00 +00:00
joerg_wunsch fa86937e91 * jtag3.c: Handle events returned by the ICE
* usbdevs.h: Add defines that mark an event in return
from usb_recv_frame().
* usb_libusb.c: (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1115 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-29 21:43:54 +00:00
joerg_wunsch fca08c90ab Implement page erase functionality.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1114 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-29 16:20:48 +00:00
joerg_wunsch 8d9a00ddc5 * jtag3.c: Fill in the missing pieces for Xmega support (both,
PDI and JTAG).
* jtagmkII.c (jtagmkII_set_xmega_params): Use "fuse1" rather
than "fuse0" memory space to fill in the NVM offset from, as
there is no "fuse0" on some Xmega devices.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1111 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-29 13:31:11 +00:00
joerg_wunsch ed3033e396 First support for Atmel JTAGICE3. Guessed from USB sniffer
traces made by Knut Schwichtenberg, and by similarity to
JTAGICEmkII.

Still quite incomplete, just megaAVR/JTAG is done by now.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1109 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-28 22:39:01 +00:00