Commit Graph

79 Commits

Author SHA1 Message Date
joerg_wunsch f55a48ea3b Fix a bunch of warnings.
* avr910.c (avr910_paged_load): possible unitialized use of
rd_size
* jtagmkI.c (jtagmkI_initialize): pointer signedness mixup
* jtagmkII.c (jtagmkII_print_parms1): propagate const'ness
of parameter
* usbasp.c (usbasp_transmit): poiner signedness mixup


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@775 81a1dc3b-b13d-400b-aceb-764788c761c2
2008-07-25 21:14:43 +00:00
joerg_wunsch 7d70684811 main.c, pgm.c, pgm.h: Add setup and teardown hooks to the programmer
definition.  If present, call the setup hook immediately after finding
the respective programmer object, and schedule the teardown hook to be
called upon exit.  This allows the programmer implementation to
dynamically allocate private programmer data.

avr910.c, butterfly.c, jtagmkI.c, jtagmkII.c, stk500v2.c, usbasp.c,
usbtiny.c: Convert static programmer data into dynamically allocated
data.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@764 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-11-07 20:36:12 +00:00
joerg_wunsch 0c8bd41a10 main.c, pgm.c, pgm.h: Add the -x option to pass extended parameters to
the programmer backend.

jtagmkII.c: Implement the extended parameter jtagchain=
to support JTAG daisy-chains.

avrdude.1, doc/avrdude.texi: Document all of the above.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@761 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-11-06 19:42:16 +00:00
joerg_wunsch 817a1ce552 safemode.c: Obtain progname from avrdude.h rather than trying to roll our
own (duplicate) copy of it.

other files: Constify char pointers.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@725 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-01-30 13:41:54 +00:00
joerg_wunsch 1cae809b9b Something I always wanted to do: replace all those private "extern"
declarations in each file by a central header file "avrdude.h".


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@721 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-01-24 21:07:54 +00:00
joerg_wunsch 4652c6428a In jtagmkII_paged_write(), remove a debugging
usleep(1000000) that accidentally crept in in rev 1.19.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@702 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-12-11 16:48:52 +00:00
joerg_wunsch 31fa98b708 Make the code compile warning-free:
- declare a dummy "struct timezone" for some Win32 systems (MinGW)
- fix a few printf() argument types
- get rid off the prevailing "all filedescriptors are of type int"
  attitude

The last item required a large sweep across the code, in order to
replace all "int fd"s by "struct filedescriptor *fd"s, and pass
pointers (as we cannot pass a union directly).  In return, the
code is now supposed to be fully 64-bit safe, rather than relying
on a 64-bit pointer being converted to a (32-bit) int and back
to a pointer as we did previously.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@694 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-12-11 12:47:35 +00:00
joerg_wunsch 8bd117dccf Implement EEPROM access through debugWire.
* jtagmkII.c: Extend the jtagmkII_read_byte() and
jtagmkII_write_byte() methods to handle EEPROM through
debugWire.

* avrpart.h: Implement the "flash instruction" parameter.
* config_gram.y: (Ditto.)
* lexer.l: (Ditto.)
* avrdude.conf.in: (Ditto.)

* avrdude.1: Document the EEPROM access through dW.
* doc/avrdude.texi: (Ditto.)

* tools/get-dw-params.xsl: Extend to extract the flash
instruction field.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@693 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-11-23 07:07:06 +00:00
joerg_wunsch 4bbd40415d In jtagmkII_read_byte() and jtagmkII_write_byte(), return an error
upon failure now that the upper layers won't fall back to the cmd()
method anymore in that case.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@691 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-11-21 16:13:08 +00:00
joerg_wunsch 8ed8377442 Implement debugWire programming support. Several limitations are
imposed by debugWire itself, so effectively, only flash ROM can be
read and written.

Currently, the required changes to avrdude.conf.in are only present
for the ATtiny44.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@688 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-11-20 23:23:37 +00:00
joerg_wunsch 351f329ec8 Replace the fallback of avr_read_byte() and avr_write_byte() to
avr_read_byte_default() and avr_write_byte_default (resp.) by directly
calling the latter functions from within all programmers that don't
implement their own read_byte()/write_byte() methods.  In turn, make the
read_byte() and write_byte() methods mandatory, and the cmd() method
(direct ISP command) optional instead (it's effectively mandatory for
any programmer using avr_read_byte_default()/avr_write_byte_default()
though).  Remove all the pointless cmd() method stubs from those programmers
that don't need it.

Eliminate avr_read_byte() as it was now completely identical to
pgm->read_byte().


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@684 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-11-20 15:04:09 +00:00
joerg_wunsch c35b4481dc Implement and document HVSP and PP modes for the AVR Dragon.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@677 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-11-01 21:47:25 +00:00
joerg_wunsch 0e4819c0e7 Implement a flags field in struct serdev, and populate it with a flag
that indicates whether the underlying communication can dynamically
change its speed or not.  This flag is set for true serial
communication but clear for USB communication.  Don't try to adjust
the speed when talking over a communication channel that doesn't
support it.  (The Dragon does not even support the respective
parameter.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@676 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-10-27 08:45:47 +00:00
joerg_wunsch 2f798223d1 Add support for the AVR Dragon (JTAG and ISP mode).
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@675 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-10-26 21:14:10 +00:00
joerg_wunsch 9579e8e77a Translate numerical response codes to strings.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@650 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-07 19:57:59 +00:00
joerg_wunsch a4aa054d00 Fix a broken indentation.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@649 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-07 19:37:41 +00:00
joerg_wunsch abe6b26950 When failing to start in ISP mode, try debugWire instead. This
requires the user to eventually restart AVRDUE from scratch then.

jtagmkII_reset() had to get a second parameter in order to record
the reset mode.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@647 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-06 22:37:30 +00:00
joerg_wunsch f8796c29cc Add support for the JTAG ICE mkII in ISP mode.
* avrdude.conf.in (jtag2isp): New programmer entry.
* config_gram.y: Add K_JTAG_MKII_ISP.
* jtagmkII.c: Restructure and export some more functions.
* jtagmkII.h: Declare exported functions.
* jtagmkII_private.h: Prepare file to be included in stk500v2.c.
* lexer.l: Add jtagmkii_isp token.
* stk500v2.c: Implement glue to jtagmkII.c.
* stk500v2.h: Declare stk500v2_jtagmkII_initpgm().
* avrdude.1: Document the new programmer support.
* doc/avrdude.texi: (Ditto.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@643 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-06 20:06:07 +00:00
joerg_wunsch 108793bc7a Contributed by dcm@mit.edu: add support for the
AVRISP mkII device. (Savannah patch #4789.)
* serial.h: Declare usb_serdev_frame device descriptor.
* stk500v2.c: Implementation of the AVRISP mkII handling.
* usb_libusb.c: Add USB handling for short-frame delimited
AVRISP mkII USB protocol; add distinction of different
devices in usbdev_open().
* jtagmkII.c: Tell usbdev_open() to search for the JTAG ICE mkII.
* usbdevs.h: (New file.)
* Makefile.am: Add usbdevs.h, as well as some other forgotten
files "make distcheck" complained about.
* avrdude.conf.in: Add more aliases for the AVRISP mkII.
* avrdude.1: Document how to use the AVRISP mkII.
* doc/avrdude.texi: (Ditto.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@564 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-01-12 23:13:50 +00:00
joerg_wunsch 0599a70fd1 In jtagmkII_paged_write(), default the pages size to 256 early enough
so the buffer will then be allocated correctly.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@532 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-09-26 12:16:45 +00:00
joerg_wunsch cc09dd7878 * jtagmkII.c (jtagmkII_paged_load): return the number of bytes read.
This makes EEPROM block reads work again.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@498 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-09-16 15:52:28 +00:00
bdean 20f3be439c Eliminate compiler warnings. GCC 4.x elicits many signedness warnings
when passing unsigned char * when char * is in the prototype and vice
versa.  Clean these up along with a few others.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@491 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-08-30 01:30:05 +00:00
joerg_wunsch 2d236ed812 Implement and document a libusb-based USB transport for the JTAG ICE
mkII.

The serial transport methods have been moved out into a record of
function pointers for that purpose, defaulting to the actual serial
connection that natively applies to the hosting system.  Iff inside
the JTAG ICE mkII handler a port name starting with "usb" has been
detected, the record of function pointers is switched to USB.
Optionally, a serial number might be specified, so only the JTAG ICE
mkII matching the given serial number will be opened.  The match is
done right-to-left, so only the least significant bytes of the serial
number need to be given.

In order to make the change as least intrusive to existing drivers as
possible, the entire naming scheme of the serial_foo() function entry
points has been maintained as access macros that encapsulate these
into the respective indirect function calls via serdev->foo().


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@478 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-06-19 21:38:03 +00:00
joerg_wunsch 9049b590bd Add "efuse" sections to the ATmega164/324/644 definitions.
Iff enter_progmode failed with RSP_ILLEGAL_JTAG_ID, give the user a
hint that their JTAGEN fuse might be unset.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@476 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-06-14 21:44:34 +00:00
joerg_wunsch 09d754b9fd Fix a signedness bug when shifting bits; this caused the length field
of the packet to occasionally been misinterpreted as a negative
number.

When discarding a packet for being overly long, restart the state
machine instead of attempting to drop a preposterous amount of data.
It is unlikely in that case that preposterous amount of data would
ever arrive, so rather attempt to re-align the reading algorithm
(supposedly resulting in a timeout and retransmit).


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@472 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-27 12:15:28 +00:00
joerg_wunsch 69aff1ca91 Rename the BAUD_xxx baud rate defines to PAR_BAUD_xxx to avoid a name
clash with the Win32 API names for baud rates.

Reported by: Eric


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@462 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-11 20:48:05 +00:00
joerg_wunsch 6ba0f493b4 Quite some cleanup of the JTAG ICE mkII stuff.
. Implement the new EECRAddress field in the device descriptor that is
  required by the 4.x firmware; make an uneducated guess about what
  firmware requires what length of device descriptor -- perhaps Atmel
  can be convinced to publish an official matrix for that.

. Specify EECR in the config file where required.  Obviously, only
  locations that differ from the 0x3c default are mentioned in the
  XML files, so by now, this only affects the AT90CAN128 for us.

. After clarification with Atmel, EnablePageProgramming should really
  default to 1, and only cleared if specified by an XML parameter.  So
  far, only the XML files for the ATmega256x and ATmega406 do specify
  it at all, and they specify a 1, too.

. Drop the entire OCDEN fuse heuristic.  If OCDEN is unprogrammed at
  startup, issue a warning that single-byte EEPROM updates won't be
  possible.  Leave it to the user to program the fuse if desired.
  That way, we won't run into any issue of prematurely wearing out the
  hfuse EEPROM cell.  Interestingly enough, this also solved the
  problem of the target not restarting from scratch upon sign-off.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@461 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-11 20:06:23 +00:00
joerg_wunsch f827a94c0f Make the retrier in case of rx timeouts more robust, by increasing
the receive timeout once a timeout happened.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@458 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-11 16:58:12 +00:00
joerg_wunsch 9839579e66 Oops, more files I forgot to add during the last commit.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@453 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-10 19:53:56 +00:00