Commit Graph

104 Commits

Author SHA1 Message Date
Dawid Buchwald b6e72dce4c Implemented basic serial code refactoring for upcoming SerialUPDI implementation
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serial_refactoring@1511 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:27 +01:00
Joerg Wunsch 10df0ff15a Submitted by Joseph Coffland:
patch #8957: Allow reading prodsig memory from stk500v2 on xmega devices
* stk500v2.c (stk600_xprog_read_byte, stk600_xprog_paged_load):
treat "prodsig" memory space as equivalent to "calibration"



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1469 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-11 20:59:25 +00:00
Joerg Wunsch 38e5aa33ea bug #60753: Patch #1436 breaks multiple programmer/device combinations on MacOS BigSur
* avr.c: compare page_size > 1 instead of != 0
* stk500v2.c: (Ditto.)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1452 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-06-27 20:26:05 +00:00
Joerg Wunsch 4278300d8e Fix some possibly uninitialized variables in stk500v2_display()
Submitted by Adrian Klieber
patch #9820: Fix some out-of-bounds/uninitialized issues



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1441 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:19:50 +00:00
Joerg Wunsch 34a1c8394c Fix handling of SCK parameter table in AVRISP2
Submitted by Adrian Klieber
patch #9820: Fix some out-of-bounds/uninitialized issues



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1440 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:15:30 +00:00
Joerg Wunsch 785b0cea55 patch #9819: Address several leaks in SVN rev 1429
Submitted by Adrian Klieber



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1435 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-14 22:34:45 +00:00
Joerg Wunsch 845abf1d08 Submitted by Axel Simon:
patch #9033: avrdoper backend uses libhidapi instead of libusb
* ser_avrdoper: Add libhidapi implementation
* stk500v2.c: Adapt #ifdefs for LIBHIDAPI
* avrdude.1: Document change
* doc/avrdude.texi: (Dito)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1414 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-14 23:12:06 +00:00
Joerg Wunsch f0c62a3ff8 Annual changelog rotation.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1393 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-03-05 18:21:08 +00:00
Joerg Wunsch 7e32be2599 Define DEBUG and DEBUGRECV unconditionally, as MSG_TRACE2 messages.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1392 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-09-14 06:17:59 +00:00
Joerg Wunsch d1af80102d bug #43626: Inconsistent timeouts in stk500v2
* stk500v2.c (stk500v2_recv): Add a reference to the bug report
but don't change anything, lest to break it somehow



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1342 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-11-19 17:23:14 +00:00
Joerg Wunsch 3d5beb40df bug #42267: jtag3isp fails to read lock and fuse bytes directly
after changing lock byte
* stk500v2.c (stk500isp_write_byte): As a workaround for broken
tool firmware, add 10 ms of delay before returning from any
single-byte write operation.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1337 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-10-07 15:21:14 +00:00
Joerg Wunsch b348d97620 * stk500v2.c: Use stk500isp_read_byte/stk500isp_write_byte for
every byte-wide access (rather than JTAGICE3 only).  This finally
obsoletes the use of the prehistoric SPI_MULTI command where
AVRDUDE used to assemble all the low-level ISP stuff by itself.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1336 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-10-06 22:15:29 +00:00
Rene Liebscher 8fd3870861 bug #42662 clang warnings under FreeBSD 10.x
* avrftdi.c: remove warnings
* buspirate.c: (Dito.)
* dfu.c: (Dito.)
* fileio.c: (Dito.)
* libavrdude.h: (Dito.)
* pickit2.c: (Dito.)
* safemode.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500v2.c: (Dito.)
* usb_libusb.c: (Dito.)
* usbasp.c: (Dito.)

* config_gram.y: fix problem when using parent part with usbpid lists
                 (existing list was extended not overwritten)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1328 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-07-16 20:02:01 +00:00
Axel Wachtler c6788bd795 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
Rene Liebscher 4ddd784940 bug #42516 spelling-error-in-binary
* stk500v2.c, avrftdi.c, usbasp.c: fixed spelling errors


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1319 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-06-11 07:17:54 +00:00
Joerg Wunsch d09bc2e1fb 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
Axel Wachtler eb5fcb581f 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 57903bdeb8 Replace all occurences of exit() in potential library code
by appropriate return values.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1301 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-16 15:52:25 +00:00
Joerg Wunsch 343330fddd 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 f80f51f6a9 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 5dbde0ca20 * stk500v2.c (stk500v2_set_sck_period): Revamp this to match the
description/pseudo-code in appnote AVR068.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1229 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-13 21:32:00 +00:00
Joerg Wunsch 6c78b35b8f Fix all "unused variable" warnings that were encountered.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1200 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-03 11:05:13 +00:00
Joerg Wunsch e2a78468d0 Submitted by Travis Griggs:
bug #38307: Can't write usersig of an xmega256a3
* stk500v2.c (stk600_xprog_page_erase): allow erasing the usersig space.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1199 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-02 21:10:44 +00:00
Joerg Wunsch db1cce8bf4 bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
* buspirate.c: Turn the "cmd" argument of the various methods into
a "const unsigned char *"; while doing this, declare all arrays being
passed as arguments to be pointers rather than arrays, as the latter
obfuscates the way arrays are being passed to a callee in C.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1196 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-02 20:22:53 +00:00
Joerg Wunsch 056b5f6e77 bug #39893: Verification failure with AVRISPmkII and Xmega
* stk500v2.c (stk600_xprog_page_erase): Fix argument that is
passed to stk600_xprog_memtype()



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1188 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-08-30 06:49:40 +00:00
Joerg Wunsch 46f7b6b470 Submitted by "Malte" and John McCorquodale:
patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
is enabled AND target has a very slow clock
* jtagmkII.c (jtagmkII_getsync): When leaving debugWIRE mode
temporarily, immediately retry with ISP, rather than leaving.
* stk500v2 (stk500v2_program_enable): Implemented similar logic
for the JTAGICE3.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1183 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-05-17 16:23:55 +00:00
Joerg Wunsch e94286da18 * usbdefs.h (USBDEV_BULK_EP_WRITE_STK600)
(USBDEV_BULK_EP_READ_STK600): new define values
* stk500v2.c (stk600_open): use the STK600 EP values,
as they are different from AVRISPmkII



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1126 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-12-18 10:45:23 +00:00
Joerg Wunsch 1daf387df5 * 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 2c540d02b6 * 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 1af820c0b9 Change all the USB details (endpoint numbers, max transfer size etc.)
to a per-programmer adjustable value.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1108 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-26 16:24:56 +00:00
Joerg Wunsch 147137a218 Replace outdated FSF postal address by a reference to
the GPL info on their website.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1107 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-20 14:03:50 +00:00
Joerg Wunsch ffeb38cf3e Xmega page erase implementation for XPROG (AVRISPmkII, STK600)
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1090 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-05-04 15:47:26 +00:00
Joerg Wunsch b9a38193a0 Xmega page erase implementation for JTAGICEmkII
* jtagmkII.c: Handle flash pages sizes > 256 bytes, implement
page_erase() method
* avrdude.conf.in: Change flash pagesize for all Xmega devices
to 512 bytes
* avr.c: Implement auto_erase, using page_erase if available
* avr.h: Remove unused parameters from avr_read(), replace
unused parameter in avr_write)() by auto_erase
* stk500v2.c: Handle flash page sizes > 256 bytes
* update.c (do_op): Handle new updateflags parameter
* main.c: Implement auto_erase as page_erase if possible
* update.h (enum updateflags): New enum
* pgm.h (struct programmer_t): Add page_erase method



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1089 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-05-04 10:02:30 +00:00
Joerg Wunsch f4db29d983 * stk500v2_private.h (struct pdata): add boot_start
* stk500v2.c: For the "flash" pseudo-memory of Xmega devices,
distinguish addresses between "application" and "boot" area.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1081 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-19 13:32:34 +00:00
Joerg Wunsch 0025747234 bug #30451: Accessing some Xmega memory sections gives not
supported error
* stk500v2.c: Handle all Xmega memory sections (except
"prodsig" which is not documented in AVR079)
* fileio.c: Treat the "boot", "application", and "apptable"
regions (which are actually subregions of "flash") all as
being flash, i.e. suppress trailing 0xFF bytes when reading
them
* avr.c: (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1075 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-03-29 14:32:18 +00:00
Rene Liebscher c1095de822 Parser does not need to know all programmer types now, new programmers
will update only the table in pgm_type.c.
  * config_gram.y, lexer.l: removed programmer type keywords,
    use now locate_programmer_type() function
  * pgm_type.[ch]: added new files for table of programmer types
  * main.c: allow list of programmer types by -c ?type
  * avrdude.conf.in: changed all type keywords to quoted strings
  * doc/avrdude.texi: changed description of type definition, list
    of valid types is now included from generated file
  * doc/Makefile.am: generate list of programmer types for doc
  * all programmers [hc]: add xxx_desc string for description of programmer


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1051 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-31 17:03:43 +00:00
Rene Liebscher d34978a124 Fixed following findings reported by cppcheck
* avr910.c:625 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
	* avr910.c:626 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
	* avr910.c:168 (information) The scope of the variable 'devtype_1st' can be reduced
	* avr910.c:169 (information) The scope of the variable 'dev_supported' can be reduced
	* avrftdi.c:647 (error) Using sizeof for array given as function argument returns the size of pointer.
	* stk500v2.c:3347 (error) Memory leak: b
	* stk500v2.c:3452 (error) Memory leak: b
	* usbasp.c:554 (error) Using sizeof for array given as function argument returns the size of pointer.
	* usbasp.c:485 (information) The scope of the variable 'dly' can be reduced

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1035 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-08 17:09:40 +00:00
Joerg Wunsch c3d58bcd7a * stk500v2.c (stk600_xprog_paged_load, stk600_xprog_paged_write):
Fix regression in the AVRISPmkII/STK600 TPI handling introduced
by the USBasp's TPI implementation which added a pagesize even for
the minor memory regions of TPI devices.  Also fix wrong offset
introduced by the memory tagging patch.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1009 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-09-15 13:04:36 +00:00
Joerg Wunsch d742827da1 Mega-commit to bring in memory tagging.
Each memory image byte is now tagged as it's being read from a file.
Only bytes read from a file will be written or verified (modulo page
granularity requirements).



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1007 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-09-14 21:49:42 +00:00
Joerg Wunsch 0926a2cbd7 In stk500v2_command(), treat warnings as errors rather than success.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1006 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-09-13 15:14:53 +00:00
Joerg Wunsch 768a8fc8bc bug #34027: avrdude AT90S1200 Problem (part 2 - stk500v2 and relatives)
* stk500v2.c (stk500v2_initialize): For the AT90S1200, release
/RESET for a moment before reinitializing, as this is required by
its programming protocol.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1004 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-30 07:19:21 +00:00
Joerg Wunsch 86432b91d9 Submitted by Brett Hagman:
Add support for the "Wiring" board/bootloader
* wiring.c: New file.
* wiring.h: (Ditto.)
* Makefile.am: Add new files.
* stk500v2_private.h: Reorganize so some functions and struct
pdata are globally known.
* stk500v2.c: (Ditto.)
* stk500v2.h: (Ditto.)
* lexer.l: Add new programmer keywords.
* config_gram.y: (Ditto.)
* avrdude.conf.in: Add "wiring" programmer entry.
* avrdude.1: Document the new programmer.
* doc/avrdude.texi: (Ditto.)
* AUTHORS: Add Brett Hagman.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@987 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-26 20:22:09 +00:00
Joerg Wunsch 1f8dc4dc52 bug #33114: Segfault after setting the DWEN fuse with Dragon
* jtagII.c (jtagmkII_getsync): Instead of exit()ing from
deep within the tree when detecting the "need debugWIRE"
situation, properly pass this up as a return code.
* jtagII_private.h (JTAGII_GETSYNC_FAIL_GRACEFUL): New constant.
* stk500v2.c (stk500v2_jtagmkII_open): Don't tell anything
anymore when receiving a JTAGII_GETSYNC_FAIL_GRACEFUL from
jtagmkII_getsync(); silently give up (all necessary has been
said already).



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@983 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-26 10:05:09 +00:00
Joerg Wunsch 8bb408b0ab bug #29636: AVRDude issues invalid CMD_CHECK_TARGET_CONNECTION
on the AVRISP-MKII
* stk500v2.c (stk500v2_program_enable): Rewrite the logic to
explain ISP activation failures.
* stk500v2_private.h: Fix the various STATUS_* constants;
AVR069 and AVR079 disagreed in their values, even though they
are apparently implementing the same logic behind.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@972 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-16 18:15:19 +00:00
Joerg Wunsch d02285b47e In stk500v2_command(), detect warning status codes.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@951 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-12-14 17:17:33 +00:00
Nils Springob 0c603e4791 * serial_open() calls will now return -1 on error (no call to exit())
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@948 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-10-22 14:29:56 +00:00
Joerg Wunsch f1bf228061 bug #30566: MinGW + Ubuntu 9.04
* stk500v2.c (stk500v2_open): use same condition to refer to the AVR
Doper support as used in the definition in ser_avrdoper.c.
(Thanks to Christian Starkjohann for the analysis of the problem.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@947 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-07-27 16:06:01 +00:00
Joerg Wunsch 77e0502890 Implement TPI mode for AVRISPmkII/STK600.
Add ATtiny4/5/9/10 to avrdude.conf.in.
Document TPI and new device support.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@916 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-15 16:36:13 +00:00
Joerg Wunsch 4b03544ff0 Update STK600 routing and socket card data from XML
file.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@911 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-13 12:52:38 +00:00
Joerg Wunsch a50fb8f9e6 Cleanup the open/close handling to avoid accessing
unallocated memory (in the atexit handler) in case of bailing out.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@910 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-13 12:44:54 +00:00