mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-16 10:41:07 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d083eb3a0 |
@@ -1,304 +1,236 @@
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Prepare for releasing version 5.8
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.4.
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Roger Wolff:
|
||||
bug #26527: bug in unicode conversion
|
||||
* ser_avrdoper.c (convertUniToAscii): when encountering a UTF-16
|
||||
character that cannot be converted to ASCII, increment the UTF-16
|
||||
pointer anyway when proceeding.
|
||||
* avrdude.conf.in: Fix AVR910 devcodes. It seems that the AVR109
|
||||
listing refers to "BOOT"-type code, while the standard codes are
|
||||
different (usually one below).
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkI.c (jtagmkI_send): Replace %zd format by %u since not all
|
||||
implementations do understand the C99 formatting options (sigh).
|
||||
* jtagmkII.c (jtagmkII_send): (Ditto.)
|
||||
* stk500v2.c (stk500v2_recv): (Ditto.)
|
||||
* avr.c (avr_read, avr_write): only use the paged_load and
|
||||
paged_write backend functions iff the memory area in question has
|
||||
a page_size != 0.
|
||||
This is supposed to fix bug #19234: avrdude-5.3.1 segfaults when
|
||||
stk500v1 tries to program an ATtiny15
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #26002: HVPP of EEPROM with AVR Dragon and ATmega8 Fails
|
||||
* avrdude.conf.in (ATmega8): add page size for EEPROM.
|
||||
* avr910.c: Fall back to avr_{read,write}_byte_default(). Fixes
|
||||
bug #18803: Fuse reading regression in avrdude 5.3.1 with avr910
|
||||
programmer
|
||||
|
||||
2009-07-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-15 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* stk500v2.c: Fix a serious memory corruption problem resulting
|
||||
out of the chaining of both, the stk500v2 and the jtagmkII
|
||||
programmers for some programming hardware (JTAG ICE mkII and AVR
|
||||
Dragon running in ISP, HVSP or PP mode), where both programmers
|
||||
have to maintain their private programmer data.
|
||||
* avrdude.conf.in: Rename the ATmega164 and ATmega324 into
|
||||
ATmega164P and ATmega324P, resp. Add an entry for the ATmega644P.
|
||||
Fixes bug #19769: ATmega164p not recognized
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Post-release (is pre-release...)
|
||||
* ser_posix.c (ser_send): Don't select() on the output fd before
|
||||
trying to write something to the serial line. That kind of
|
||||
polling isn't very useful anyway, and it seems it breaks for the
|
||||
Linux CP210x USB<->RS-232 bridge driver which is certainly a bug
|
||||
in the driver, but we can just avoid that bug alltogether.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Prepare for releasing version 5.7
|
||||
* avrdude.conf.in: Fix the STK500v2 ISP delay parameter for
|
||||
ATmega640/1280/1281/2560/2561. Atmel has changed the XML
|
||||
files after the initial release.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* main.c: Add my name to the copyright output when being verbose.
|
||||
* safemode.c: -Oops - bug in verbose output. Fixed.
|
||||
-Fixed handling of cases where programmer cannot read fuses (AVR910)
|
||||
* main.c: -Also fixing handling of cases where programmer cannot
|
||||
read fuses
|
||||
This should close one or more bugs (18803, 19570)
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
Contributed by Shaun Jackman <sjackman@gmail.com>
|
||||
bug #21798: Fix both XSLT scripts
|
||||
* tools/get-dw-params.xsl (format-hex): Add the parameter count.
|
||||
* tools/get-hv-params.xsl (format_cstack): Ditto.
|
||||
* safemode.c: Added verbose output from safemode routines.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-03-25 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
bug #21922: ATmega163 still not working in version 5.5
|
||||
* avrdude.conf.in (atmega163): fill in stk500v2 parameters, correct
|
||||
some flash programming parameters as well.
|
||||
* stk500generic.c: Forgot to close the serial port before trying to
|
||||
open it again, caused problems on Windows machines.
|
||||
Closes bug #19411
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-02-26 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #22206: avrdude: ser_setspeed(): tcsetattr() failed
|
||||
* ser_posix.c (ser_setspeed): Don't pass TCSAFLUSH to tcsetattr() as
|
||||
it apparently fails to work on Solaris. After reading the
|
||||
documentation again, it seems TCSAFLUSH and TCSANOW are indeed
|
||||
mutually exclusive.
|
||||
* avrdude.conf.in: Add the AT90PWM2/3B devices.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-02-02 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
bug #22234: WINDOWS version: HOWTO: Specify Serial Ports Larger than COM9
|
||||
* ser_win32.c (ser_open): prepend \\.\ to any COM port name, so it is
|
||||
safe to be used for COM ports above 9.
|
||||
* usbasp.c: Changed return value of function usbasp_initialize to stop
|
||||
avrdude on communication errors between programmer and target.
|
||||
Closes bug #18581: safemode destroys fuse bits
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-02-01 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #26408: Crash in stk500v2_open()
|
||||
* stk500generic.c: Implement setup and teardown hooks, calling in turn
|
||||
the respective hooks of the stk500v2 implementation.
|
||||
* config_gram.y: Remove duplicate definition of token K_WRITEPAGE
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #26130: Avrdude doesn't display it's version.
|
||||
* main.c (usage): add a version number display to the default usage
|
||||
message.
|
||||
* butterfly.c: Implement ATmega256x support for butterfly/avr109.
|
||||
|
||||
2009-07-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #26412: avrdude segfaults when called with a programmer that does not
|
||||
support it
|
||||
* main.c: do not call pgm->perform_osccal() unless it is != 0.
|
||||
* configure.ac: Fix subdir handling. Now finally, "make
|
||||
distcheck" will include the documentation into the tarball even if
|
||||
the configure had been run without the --enable-doc.
|
||||
|
||||
2009-06-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Zoltan Laday:
|
||||
patch #6825: xmega problems with JTAGICEmkII
|
||||
* jtagmkII.c: Many fixes for Xmega devices.
|
||||
* jtagmkII_private.h: Add various new constants required for
|
||||
Xmega devices.
|
||||
* avrdude.conf.in: New devices: ATXMEGA64A1, ATXMEGA192A1,
|
||||
ATXMEGA256A1, ATXMEGA64A3, ATXMEGA128A3, ATXMEGA192A3,
|
||||
ATXMEGA256A3, ATXMEGA256A3B, ATXMEGA16A4, ATXMEGA32A4,
|
||||
ATXMEGA64A4, ATXMEGA128A4
|
||||
* avr.c (avr_read, avr_write): Add more names for (Xmega)
|
||||
memory areas that require paged operation.
|
||||
|
||||
2009-06-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk600_xprog_write_byte): Handle writing fuse bytes.
|
||||
|
||||
2009-04-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Carl Hamilton:
|
||||
* update.c (parse_op): correctly \0-terminate buf after filling
|
||||
it, before it is potentially used as the source of a call to
|
||||
strlen or strcpy.
|
||||
|
||||
2009-04-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* doc/avrdude.texi: Merge the -P 0xXXX option description from
|
||||
avrdude.1.
|
||||
|
||||
2009-04-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: declare AM_PROG_CC_C_O to avoid the warning
|
||||
"compiling `config_gram.c' with per-target flags
|
||||
requires `AM_PROG_CC_C_O' in `configure.ac'"
|
||||
|
||||
2009-03-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #25971: "error writing to <stdout>" with multiple -U params.
|
||||
* fileio.c: Do not close the input/output stream when working on an
|
||||
stdio stream.
|
||||
|
||||
2009-02-28 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
Based on patch #6484 commited by Jurgis Brigmanis:
|
||||
* usbasp.c: added software control for ISP speed
|
||||
* usbasp.h: (Ditto.)
|
||||
|
||||
2009-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avr910.c (avr910_read_byte_flash): Eliminate a static variable that
|
||||
hasn't been in use for 5 years.
|
||||
|
||||
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Post-release 5.6.
|
||||
|
||||
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Prepare for releasing version 5.6.
|
||||
|
||||
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Ed Okerson:
|
||||
* jtagmkII.c (jtagmkII_read_byte): Fix signature reading of
|
||||
Xmega.
|
||||
|
||||
2009-02-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Mikael Hermansson:
|
||||
* avrdude.conf.in (ATxmega256A3): new device.
|
||||
* stk500v2 (stk500v2_initialize): Enable the AVRISPmkII as a
|
||||
PDI-capable device for ATxmega parts.
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Lars Immisch:
|
||||
patch #6750: Arduino support - new programmer-id
|
||||
* arduino.c: New file, inherits stk500.c.
|
||||
* arduino.h: New file.
|
||||
* Makefile.am: Add arduino.c and arduino.h.
|
||||
* config_gram.y: Add arduino keyword.
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.conf.in: (Ditto.)
|
||||
* avrdude.1: Document the new programmer type.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c: Turn all non-const static data into instance data.
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am: Move term.[ch] from the library into the CLI
|
||||
application section, as it is not useful for anything else but
|
||||
the CLI frontend.
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega1284P): new device.
|
||||
|
||||
2009-02-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
More fixes for Solaris, including fixes for the Sunpro compiler:
|
||||
* avr.h: Remove stray semicolon.
|
||||
* configure.ac: Add check for predefined types uint_t and ulong_t.
|
||||
* confwin.c: Include "avrdude.h" on top to avoid empty translation
|
||||
unit warning.
|
||||
* ppwin.c: (Ditto.)
|
||||
* ser_win32.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* jtagmkII.c (jtagmkII_recv): remove unreachable "return".
|
||||
* stk500.c (stk500_initialize): (Ditto.)
|
||||
* par.c: Test for both, __sun__ and __sun to see whether we are
|
||||
being compiled on Solaris.
|
||||
* ppi.c: (Ditto.)
|
||||
* stk500v2.c: Implement the DEBUG and DEBUGRECV macros in a way
|
||||
that is compatible with the ISO C99 standard.
|
||||
* usbtiny.c: Only typedef uint_t and ulong_t if they have not
|
||||
been found already by the autoconf checks.
|
||||
|
||||
2009-02-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22204: Solaris10/11 Undefiniertes Symbol gethostbyname socket
|
||||
connect
|
||||
* configure.ac: Add checks for gethostent() and socket().
|
||||
While being here, remove some old cruft left from ancient days.
|
||||
|
||||
2009-02-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* lexer.l: Bump the %p size so AT&T lex will continue to work.
|
||||
|
||||
2009-02-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
(Partially) submitted by John Voltz:
|
||||
bug #20004: AVRDUDE update (-U) operations do not close files
|
||||
* fileio.c (fmt_autodetect, fileio): fclose() files.
|
||||
|
||||
2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbtiny.c: Replace all but one (very unlikely to trigger) exit(1)
|
||||
by return -1.
|
||||
|
||||
2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Dick Streefland:
|
||||
patch #6749: make reading from the USBtinyISP programmer more robust
|
||||
* usbtiny.c: Add code to retry failed communication attempts.
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Nick Hibma:
|
||||
bug #22271: usb_reset in usb_libusb.c not necessary in FreeBSD 6.x
|
||||
* usb_libusb.c (usbdev_close): Do not call usb_reset() on FreeBSD.
|
||||
It is not necessary there.
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Andrew O. Shadoura:
|
||||
bug #25156: add direct SPI transfer mode
|
||||
* bitbang.c: Implement direct SPI transfers.
|
||||
* bitbang.h: (Ditto.)
|
||||
* safemode.c: Obtain progname from avrdude.h rather than trying to
|
||||
roll our own (duplicate) copy of it.
|
||||
* avr910.c: Constify char pointers.
|
||||
* avrpart.c: (Ditto.)
|
||||
* avrpart.h: (Ditto.)
|
||||
* butterfly.c: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config.h: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* term.c: Add the "spi" and "pgm" commands.
|
||||
* avrdude.1: Document the changes.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
* serbb_posix.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* stk500.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Limor ("Lady Ada"):
|
||||
bug #24749: add support for '328p
|
||||
* avrdude.conf.in (ATmega328P): new device support.
|
||||
* avrpart.c: More backend/library abstraction and generalization:
|
||||
turn the list_parts() and list_programmers() functions into
|
||||
general list iteration functions that call a caller-supplied
|
||||
callback for each element. Implement list_parts() and
|
||||
list_programmers() as private functions in main.c based on that
|
||||
approach.
|
||||
* avrpart.h: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-25 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by "Womo":
|
||||
bug #25241: AT90USB162, AT90USB82 device support patch for avrdude-5.5
|
||||
(also: bug #21745: AT90USBxx2 support)
|
||||
* avrdude.conf.in (AT90USB162, AT90USB82): new device support.
|
||||
* Makefile.am: Rearrange everything so it is now built into a
|
||||
libavrdude.a library, and link main.c against that library.
|
||||
* configure.ac: Add AC_PROG_RANLIB as we are building a library
|
||||
now.
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Evangelos Arkalis:
|
||||
patch #6069: Atmel AT89ISP Cable
|
||||
* avrdude.conf.in (89isp): new programmer support.
|
||||
Major code cleanup.
|
||||
- Make all internal functions "static".
|
||||
- Make sure each module's header and implementation file match.
|
||||
- Remove all library-like functionality from main.c, so only
|
||||
the actual frontend remains in main.c.
|
||||
- Add C++ brackets to all header files.
|
||||
* avr.c: (Ditto.)
|
||||
* avr.h: (Ditto.)
|
||||
* avr910.c: (Ditto.)
|
||||
* avr910.h: (Ditto.)
|
||||
* avrdude.h: (Ditto.)
|
||||
* avrpart.c: (Ditto.)
|
||||
* avrpart.h: (Ditto.)
|
||||
* bitbang.h: (Ditto.)
|
||||
* butterfly.h: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config.h: (Ditto.)
|
||||
* confwin.h: (Ditto.)
|
||||
* crc16.c: (Ditto.)
|
||||
* crc16.h: (Ditto.)
|
||||
* fileio.c: (Ditto.)
|
||||
* fileio.h: (Ditto.)
|
||||
* jtagmkI.h: (Ditto.)
|
||||
* jtagmkII.h: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* lists.h: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* par.h: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* ppi.c: (Ditto.)
|
||||
* ppi.h: (Ditto.)
|
||||
* safemode.h: (Ditto.)
|
||||
* serbb.h: (Ditto.)
|
||||
* serial.h: (Ditto.)
|
||||
* stk500.h: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* stk500v2.h: (Ditto.)
|
||||
* term.c: (Ditto.)
|
||||
* term.h: (Ditto.)
|
||||
* usbasp.h: (Ditto.)
|
||||
* update.c: New file.
|
||||
* update.h: New file.
|
||||
* Makefile.am: Include update.c and update.h.
|
||||
|
||||
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Bob Paddock:
|
||||
patch #6748: ATTiny88 Config
|
||||
* avrdude.conf.in (ATtiny88): new device support.
|
||||
Move all "extern" declarations into a centreal header file.
|
||||
* Makefile.am: Add new avrdude.h.
|
||||
* avrdude.h: New file.
|
||||
* avr.c: Replace private extern decl's by #include "avrdude.h".
|
||||
* avr910.c: (Ditto.)
|
||||
* avrpart.c: (Ditto.)
|
||||
* bitbang.c: (Ditto.)
|
||||
* butterfly.c: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config_gram.y: (Ditto.)
|
||||
* fileio.c: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* ppi.c: (Ditto.)
|
||||
* ppiwin.c: (Ditto.)
|
||||
* ser_avrdoper.c: (Ditto.)
|
||||
* ser_posix.c: (Ditto.)
|
||||
* ser_win32.c: (Ditto.)
|
||||
* serbb_posix.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* stk500.c: (Ditto.)
|
||||
* stk500generic.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* term.c: (Ditto.)
|
||||
* usb_libusb.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
|
||||
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-13 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Mark Litwack:
|
||||
patch #6261: avrdude won't use dragon/debugwire to write a file
|
||||
to eeprom
|
||||
* jtagmkII.c (jtagmkII_paged_write): when in debugWire mode,
|
||||
implement a paged write to EEPROM as a series of byte writes.
|
||||
* avrdude.conf.in (ATmega8): Bump the delay values for flash
|
||||
and EEPROM, based on the current Atmel XML file.
|
||||
|
||||
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-12 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Janos Sallai:
|
||||
patch #6542: paged_load fails on the MIB510 programming board
|
||||
* stk500.c: Add a workaround for the different signon sequence on
|
||||
MIB510 programmers.
|
||||
* configure.ac: Improve the detection of the Win32 HID library,
|
||||
and the presence of the header ddk/hidsdi.h. It now works
|
||||
correctly under Cygwin and several flavours of MinGW.
|
||||
* Makefile.am: Add new LIBHID pattern.
|
||||
|
||||
2009-02-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
2007-01-11 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Add the ATmega128RFA1.
|
||||
* avrdude.1: document the addition of ATmega128RFA1.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
* butterfly.c (butterfly_initialize): when sending the 'T'
|
||||
command (which is ignored by current AVR109 bootloaders),
|
||||
send the first reply from the list of supported device
|
||||
codes back rather than using avrdude.conf's idea about
|
||||
an AVR910 device code. Apparently, this solves disagreements
|
||||
between different versions of at least the ATmega8 AVR910
|
||||
device code.
|
||||
Closes bug #18727: Writing flash failed
|
||||
|
||||
2007-01-07 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Reported by Till Harbaum:
|
||||
* avrdude.conf.in (ATtiny25/45/85): Change HVSP reset from
|
||||
500 microseconds to 1 ms, matching the most recent Atmel XML
|
||||
specs.
|
||||
|
||||
@@ -1,364 +0,0 @@
|
||||
2007-11-08 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Partially revert the line buffered output change,
|
||||
and turn stderr into unbuffered output while producing the
|
||||
progress report.
|
||||
|
||||
2007-11-07 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* main.c: 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.
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* avr910.c: Convert static programmer data into dynamically
|
||||
allocated data.
|
||||
* butterfly.c: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
* usbtiny.c: (Ditto.)
|
||||
|
||||
2007-11-06 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* butterfly.c: Remove the no_show_func_info() calls, as Brian
|
||||
promised some 4 years ago.
|
||||
|
||||
2007-11-06 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Add the -x option to pass extended parameters to
|
||||
the programmer backend.
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* jtagmkII.c: Implement the extended parameter jtagchain=
|
||||
to support JTAG daisy-chains.
|
||||
* avrdude.1: Document all of the above.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2007-10-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version for post-release.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.5.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <bikenomad@gmail.com>:
|
||||
patch #5007: Patch for line-buffering of stdout and stderr
|
||||
* main.c: call setvbuf() for stdout and stderr.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <graceindustries@gmail.com>:
|
||||
patch #5953: Add AT90CAN64 and AT90CAN32 to avrdude.conf
|
||||
* avrdude.conf.in: Add entry for AT90CAN64 and AT90CAN32.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Wolfgang Moser:
|
||||
patch #6121: ISP support for the C2N232I device (serial port
|
||||
bitbanging)
|
||||
* avrdude.conf.in: Add entry for c2n232i.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <karl.yerkes@gmail.com>:
|
||||
patch #6141: accept binary format immediate values
|
||||
* fileio.c: Detect a 0b prefix, and call strtoul() differently
|
||||
in that case.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21076: -vvvv serial receive prints are empty in Win32 build
|
||||
* ser_win32.c (ser_recv): Drop the essentially unused variable
|
||||
"len", and use the variable "read" in order to track how many
|
||||
bytes have just been read in.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21145: atmega329p not recognized
|
||||
* avrdude.conf.in: Add definitions for the ATmega329P/3290P.
|
||||
Same as ATmega329/3290 except of the different signature.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21152: Unable to program atmega324p with avrdude 5.4 and AVRISP
|
||||
using default configuration file.
|
||||
* avrdude.conf.in: Uncomment the (bogus) stk500_devcode lines for
|
||||
the ATmega164P, ATmega324P, ATmega644, and ATmega644P definitions.
|
||||
This only affects users of STK500v1 firmware.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <ladyada@gmail.com>:
|
||||
Patch #6233: Add support for USBtinyISP programmer
|
||||
* usbtiny.c: New file.
|
||||
* usbtiny.h: (Ditto.)
|
||||
* Makefile.am: Include usbtiny into the build.
|
||||
* avrdude.conf.in: (Ditto.)
|
||||
* config_gram.y: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.1: Document the usbtiny support.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* doc/avrdude.texi: Sort list of supported programmers into
|
||||
alphabetical order, add all missing programmers.
|
||||
|
||||
2007-07-24 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
* usbasp.c: Added long addresses to support devices with more
|
||||
than 64kB flash. Closes bug #20558: Long address problem with
|
||||
USBasp.
|
||||
|
||||
2007-06-27 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add ChangeLog-2004-2006.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version for post-release.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.4.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Fix AVR910 devcodes. It seems that the AVR109
|
||||
listing refers to "BOOT"-type code, while the standard codes are
|
||||
different (usually one below).
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avr.c (avr_read, avr_write): only use the paged_load and
|
||||
paged_write backend functions iff the memory area in question has
|
||||
a page_size != 0.
|
||||
This is supposed to fix bug #19234: avrdude-5.3.1 segfaults when
|
||||
stk500v1 tries to program an ATtiny15
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avr910.c: Fall back to avr_{read,write}_byte_default(). Fixes
|
||||
bug #18803: Fuse reading regression in avrdude 5.3.1 with avr910
|
||||
programmer
|
||||
|
||||
2007-05-15 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* avrdude.conf.in: Rename the ATmega164 and ATmega324 into
|
||||
ATmega164P and ATmega324P, resp. Add an entry for the ATmega644P.
|
||||
Fixes bug #19769: ATmega164p not recognized
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* ser_posix.c (ser_send): Don't select() on the output fd before
|
||||
trying to write something to the serial line. That kind of
|
||||
polling isn't very useful anyway, and it seems it breaks for the
|
||||
Linux CP210x USB<->RS-232 bridge driver which is certainly a bug
|
||||
in the driver, but we can just avoid that bug alltogether.
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Fix the STK500v2 ISP delay parameter for
|
||||
ATmega640/1280/1281/2560/2561. Atmel has changed the XML
|
||||
files after the initial release.
|
||||
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* safemode.c: -Oops - bug in verbose output. Fixed.
|
||||
-Fixed handling of cases where programmer cannot read fuses (AVR910)
|
||||
* main.c: -Also fixing handling of cases where programmer cannot
|
||||
read fuses
|
||||
This should close one or more bugs (18803, 19570)
|
||||
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* safemode.c: Added verbose output from safemode routines.
|
||||
|
||||
2007-03-25 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* stk500generic.c: Forgot to close the serial port before trying to
|
||||
open it again, caused problems on Windows machines.
|
||||
Closes bug #19411
|
||||
|
||||
2007-02-26 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Add the AT90PWM2/3B devices.
|
||||
|
||||
2007-02-02 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
* usbasp.c: Changed return value of function usbasp_initialize to stop
|
||||
avrdude on communication errors between programmer and target.
|
||||
Closes bug #18581: safemode destroys fuse bits
|
||||
|
||||
2007-02-01 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* config_gram.y: Remove duplicate definition of token K_WRITEPAGE
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* butterfly.c: Implement ATmega256x support for butterfly/avr109.
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Fix subdir handling. Now finally, "make
|
||||
distcheck" will include the documentation into the tarball even if
|
||||
the configure had been run without the --enable-doc.
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* safemode.c: Obtain progname from avrdude.h rather than trying to
|
||||
roll our own (duplicate) copy of it.
|
||||
* avr910.c: Constify char pointers.
|
||||
* avrpart.c: (Ditto.)
|
||||
* avrpart.h: (Ditto.)
|
||||
* butterfly.c: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config.h: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* serbb_posix.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* stk500.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
|
||||
2007-01-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrpart.c: More backend/library abstraction and generalization:
|
||||
turn the list_parts() and list_programmers() functions into
|
||||
general list iteration functions that call a caller-supplied
|
||||
callback for each element. Implement list_parts() and
|
||||
list_programmers() as private functions in main.c based on that
|
||||
approach.
|
||||
* avrpart.h: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
|
||||
2007-01-25 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am: Rearrange everything so it is now built into a
|
||||
libavrdude.a library, and link main.c against that library.
|
||||
* configure.ac: Add AC_PROG_RANLIB as we are building a library
|
||||
now.
|
||||
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Major code cleanup.
|
||||
- Make all internal functions "static".
|
||||
- Make sure each module's header and implementation file match.
|
||||
- Remove all library-like functionality from main.c, so only
|
||||
the actual frontend remains in main.c.
|
||||
- Add C++ brackets to all header files.
|
||||
* avr.c: (Ditto.)
|
||||
* avr.h: (Ditto.)
|
||||
* avr910.c: (Ditto.)
|
||||
* avr910.h: (Ditto.)
|
||||
* avrdude.h: (Ditto.)
|
||||
* avrpart.c: (Ditto.)
|
||||
* avrpart.h: (Ditto.)
|
||||
* bitbang.h: (Ditto.)
|
||||
* butterfly.h: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config.h: (Ditto.)
|
||||
* confwin.h: (Ditto.)
|
||||
* crc16.c: (Ditto.)
|
||||
* crc16.h: (Ditto.)
|
||||
* fileio.c: (Ditto.)
|
||||
* fileio.h: (Ditto.)
|
||||
* jtagmkI.h: (Ditto.)
|
||||
* jtagmkII.h: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* lists.h: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* par.h: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* ppi.c: (Ditto.)
|
||||
* ppi.h: (Ditto.)
|
||||
* safemode.h: (Ditto.)
|
||||
* serbb.h: (Ditto.)
|
||||
* serial.h: (Ditto.)
|
||||
* stk500.h: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* stk500v2.h: (Ditto.)
|
||||
* term.c: (Ditto.)
|
||||
* term.h: (Ditto.)
|
||||
* usbasp.h: (Ditto.)
|
||||
* update.c: New file.
|
||||
* update.h: New file.
|
||||
* Makefile.am: Include update.c and update.h.
|
||||
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Move all "extern" declarations into a centreal header file.
|
||||
* Makefile.am: Add new avrdude.h.
|
||||
* avrdude.h: New file.
|
||||
* avr.c: Replace private extern decl's by #include "avrdude.h".
|
||||
* avr910.c: (Ditto.)
|
||||
* avrpart.c: (Ditto.)
|
||||
* bitbang.c: (Ditto.)
|
||||
* butterfly.c: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config_gram.y: (Ditto.)
|
||||
* fileio.c: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* ppi.c: (Ditto.)
|
||||
* ppiwin.c: (Ditto.)
|
||||
* ser_avrdoper.c: (Ditto.)
|
||||
* ser_posix.c: (Ditto.)
|
||||
* ser_win32.c: (Ditto.)
|
||||
* serbb_posix.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* stk500.c: (Ditto.)
|
||||
* stk500generic.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* term.c: (Ditto.)
|
||||
* usb_libusb.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
|
||||
2007-01-13 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega8): Bump the delay values for flash
|
||||
and EEPROM, based on the current Atmel XML file.
|
||||
|
||||
2007-01-12 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Improve the detection of the Win32 HID library,
|
||||
and the presence of the header ddk/hidsdi.h. It now works
|
||||
correctly under Cygwin and several flavours of MinGW.
|
||||
* Makefile.am: Add new LIBHID pattern.
|
||||
|
||||
2007-01-11 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* butterfly.c (butterfly_initialize): when sending the 'T'
|
||||
command (which is ignored by current AVR109 bootloaders),
|
||||
send the first reply from the list of supported device
|
||||
codes back rather than using avrdude.conf's idea about
|
||||
an AVR910 device code. Apparently, this solves disagreements
|
||||
between different versions of at least the ATmega8 AVR910
|
||||
device code.
|
||||
Closes bug #18727: Writing flash failed
|
||||
|
||||
2007-01-07 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Reported by Till Harbaum:
|
||||
* avrdude.conf.in (ATtiny25/45/85): Change HVSP reset from
|
||||
500 microseconds to 1 ms, matching the most recent Atmel XML
|
||||
specs.
|
||||
@@ -1,185 +0,0 @@
|
||||
2008-11-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.h: Change the prototype for usleep() to be more Cygwin-
|
||||
friendly.
|
||||
* ppiwin.c: (Ditto.)
|
||||
|
||||
2008-11-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by limor <limor@ladyada.net>
|
||||
* usbtiny.c (usbtiny_cmd): Replace sizeof() by a fixed constant
|
||||
4 for the result array, because otherwise it would take the size
|
||||
of a pointer which miserably fails on 64-bit machines.
|
||||
|
||||
2008-11-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #6609: Using PCI parallel port cards on Windows
|
||||
* ppiwin.c (ppi_open): If the port parameter passed from the
|
||||
-p option is neither lpt1/2/3, try interpreting it directly as
|
||||
a base address.
|
||||
* avrdude.1: Document the change.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22882: Erase Cycle Counter does not work for stk500v2
|
||||
* stk500v2.c (stk500v2_chip_erase,stk500hv_chip_erase): Return
|
||||
the expected 0 for success rather than a protocol-dependant
|
||||
number.
|
||||
|
||||
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22883: Chip Erase performed even with no-write flag (-n)
|
||||
* main.c: Do not erase the chip if both, -e and -n options have
|
||||
been specified.
|
||||
|
||||
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #24589: AT90USB64* have wrong signature
|
||||
* avrdude.conf.in: Uncomment the correct, and delete the wrong
|
||||
signature for AT90USB646/647. Alas, the datasheet has never been
|
||||
corrected for years.
|
||||
|
||||
2008-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: Fix a serious memory corruption that happened when
|
||||
using the JTAG ICE mkII (or AVR Dragon) in ISP mode. The wrong
|
||||
set of per-programmer private data had been allocated (stk500v2
|
||||
vs. jtagmkII) which was too small to hold the actual data.
|
||||
* jtagmkII.h: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
|
||||
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: Implement Xmega JTAG support.
|
||||
* jtagmkII_private.h: Add EMULATOR_MODE_JTAG_XMEGA.
|
||||
|
||||
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Remember whether the device initialization worked, and
|
||||
allow to continue with -F if it failed yet do not attempt to
|
||||
perform anything on the device itself. That way, -tF could be
|
||||
specified for programmers like the STK500/STK600 even without a
|
||||
device connected, just in order to allow changing parameters on
|
||||
the programmer itself.
|
||||
* avrdude.1: Document that possible use of the -F option.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk600_xprog_paged_write): Fix a fatal miscalculation
|
||||
of the number of bytes to be written which caused a malloc chunk
|
||||
corruption.
|
||||
|
||||
2008-07-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
First implementation of ATxmega support. By now, only the
|
||||
PDI mode of the STK600 is supported. Single-byte EEPROM
|
||||
(and flash) updates do not work yet.
|
||||
* avr.c: "boot" memory is a candidate memory region for paged
|
||||
operations, besides "flash" and "eeprom".
|
||||
* avrdude.conf.in: add ATxmega128A1 and ATxmega128A1revD
|
||||
* avrpart.h: add the AVRPART_HAS_PDI flag (used to distinguish
|
||||
ATxmega parts from classic AVRs), the nvm_base part field, and
|
||||
the offset field for a memory region.
|
||||
* config_gram.y: add "has_pdi", "nvm_base", and "offset"
|
||||
* lexer.l: (Ditto.)
|
||||
* main.c: disable auto_erase for ATxmega parts
|
||||
* stk500v2.c: implement the XPROG functionality, and divert to
|
||||
this for ATxmega parts
|
||||
* avrdude.1: Document the changes.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
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): pointer signedness mixup
|
||||
* ser_avrdoper.c (usbGetReport): remove useless pointer deref
|
||||
|
||||
2008-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Ville Voipio:
|
||||
patch #6501: New autotools support for avrdude
|
||||
* Makefile.am: add @WINDOWS_DIRS@ to SUBDIR
|
||||
* bootstrap: allow for autconf-2.61 and automake-1.10, too
|
||||
* configure.ac: fix @WINDOWS_DIRS@ recursion, replace
|
||||
AC_PROG_CC by AM_PROG_CC_C_O, for esoteric reasons
|
||||
|
||||
2008-06-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Janos Sallai <janos.sallai@vanderbilt.edu>:
|
||||
patch #6074: added support for crossbow's MIB510 programmer
|
||||
* avrdude.conf.in: Add entry for mib510.
|
||||
* stk500.c: Add special hooks to handle the MIB510 programmer.
|
||||
It mostly talks STK500v1 protocol but has a special hello and
|
||||
goodbye sequence, and uses a fixed block size of 256 bytes.
|
||||
* doc/avrdude.texi: Document support for mib510.
|
||||
|
||||
2008-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Klaus Leidinger <klaus@mikrocontroller-projekte.de>:
|
||||
* main.c: Realign verbose messages.
|
||||
* avrpart.c: (Ditto.)
|
||||
* avr910.c: Print the device code selected in verbose mode.
|
||||
* butterfly.c: (Ditto.)
|
||||
|
||||
2008-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Klaus Leidinger <klaus@mikrocontroller-projekte.de>:
|
||||
Add check for buffermode feature, and use it if present. Can be
|
||||
turned off using -x no_blockmode.
|
||||
* avr910.c: Implement buffermode test and usage.
|
||||
* avrdude.1: Document -x no_blockmode.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-03-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usb_libusb.c: #undef interface for Win32
|
||||
|
||||
2008-03-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avr910.c: Add support for the -x devcode option.
|
||||
* avrdude.1: Document -x devcode for avr910.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-03-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Add initial support for the Atmel STK600, for
|
||||
"classic" AVRs (AT90, ATtiny, ATmega) in both,
|
||||
ISP and high-voltage programming modes.
|
||||
* Makefile.am: Add -lm.
|
||||
* avrdude.conf.in: Add stk600, stk600pp, and stk600hvsp.
|
||||
* config_gram.y: Add support for the stk600* keywords.
|
||||
* lexer.l: (Ditto.)
|
||||
* pgm.h: Add the "chan" parameter to set_varef().
|
||||
* stk500.c: (Ditto.)
|
||||
* serial.h: Add USB endpoint support to struct filedescriptor.
|
||||
* stk500v2.c: Implement the meat of the STK600 support.
|
||||
* stk500v2.h: Add new prototypes for stk600*() programmers.
|
||||
* stk500v2_private.h: Add new constants used in the STK600.
|
||||
* term.c: Add AREF channel support.
|
||||
* usb_libusb.c: Automatically determine the correct write
|
||||
endpoint ID, the STK600 uses 0x83 while all other tools use
|
||||
0x82. Propagate the EP to use through struct filedescriptor.
|
||||
* usbdevs.h: Add the STK600 USB product ID.
|
||||
* tools/get-stk600-cards.xsl: XSL transformation for
|
||||
targetboards.xml to obtain the list of socket and routing
|
||||
card IDs, to be used in stk500v2.c (for displaying the
|
||||
names).
|
||||
* tools/get-stk600-devices.xsl: XSL transformation for
|
||||
targetboards.xml to obtain the table of socket/routing cards
|
||||
and their respective AVR device support for doc/avrdude.texi.
|
||||
* avrdude.1: Document all the STK600 stuff.
|
||||
* doc/avrdude.texi: Ditto. Added a new chapter for
|
||||
Programmer Specific Information.
|
||||
|
||||
2008-01-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk500v2_recv): Make length computation unsigned so
|
||||
it cannot accidentally become negative.
|
||||
|
||||
@@ -26,7 +26,6 @@ EXTRA_DIST = \
|
||||
ChangeLog-2001 \
|
||||
ChangeLog-2002 \
|
||||
ChangeLog-2003 \
|
||||
ChangeLog-2004-2006 \
|
||||
avrdude.1 \
|
||||
avrdude.spec \
|
||||
bootstrap
|
||||
@@ -40,7 +39,6 @@ CLEANFILES = \
|
||||
#DIST_SUBDIRS = doc windows
|
||||
|
||||
SUBDIRS = @SUBDIRS_AC@
|
||||
SUBDIRS += @WINDOWS_DIRS@
|
||||
DIST_SUBDIRS = @DIST_SUBDIRS_AC@
|
||||
|
||||
AM_YFLAGS = -d
|
||||
@@ -53,7 +51,7 @@ avrdude_CFLAGS = @ENABLE_WARNINGS@
|
||||
|
||||
libavrdude_a_CFLAGS = @ENABLE_WARNINGS@
|
||||
|
||||
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB@ @LIBHID@ -lm
|
||||
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB@ @LIBHID@
|
||||
|
||||
bin_PROGRAMS = avrdude
|
||||
|
||||
@@ -77,8 +75,6 @@ dist-hook:
|
||||
libavrdude_a_SOURCES = \
|
||||
config_gram.y \
|
||||
lexer.l \
|
||||
arduino.h \
|
||||
arduino.c \
|
||||
avr.c \
|
||||
avr.h \
|
||||
avr910.c \
|
||||
@@ -135,19 +131,17 @@ libavrdude_a_SOURCES = \
|
||||
stk500v2_private.h \
|
||||
stk500generic.c \
|
||||
stk500generic.h \
|
||||
term.c \
|
||||
term.h \
|
||||
usbasp.c \
|
||||
usbasp.h \
|
||||
usbdevs.h \
|
||||
usb_libusb.c \
|
||||
usbtiny.h \
|
||||
usbtiny.c \
|
||||
update.h \
|
||||
update.c
|
||||
|
||||
avrdude_SOURCES = \
|
||||
main.c \
|
||||
term.c \
|
||||
term.h
|
||||
main.c
|
||||
|
||||
man_MANS = avrdude.1
|
||||
|
||||
|
||||
85
avrdude/NEWS
85
avrdude/NEWS
@@ -5,91 +5,6 @@ Approximate change log for AVRDUDE by version.
|
||||
(For more detailed changes, see the ChangeLog file.)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Version 5.8:
|
||||
|
||||
* Bugfixes; most importantly, fix a serious memory corruption for
|
||||
that JTAG ICE mkII and AVR Dragon in ISP/HVSP/PP mode.
|
||||
|
||||
Version 5.7:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
- ATXMEGA64A1
|
||||
- ATXMEGA192A1
|
||||
- ATXMEGA256A1
|
||||
- ATXMEGA64A3
|
||||
- ATXMEGA128A3
|
||||
- ATXMEGA192A3
|
||||
- ATXMEGA256A3
|
||||
- ATXMEGA256A3B
|
||||
- ATXMEGA16A4
|
||||
- ATXMEGA32A4
|
||||
- ATXMEGA64A4
|
||||
- ATXMEGA128A4
|
||||
|
||||
* Major Xmega fixes for the JTAG ICE mkII (patch #6825)
|
||||
|
||||
* Bugfixes.
|
||||
|
||||
Version 5.6:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
- AT90USB82
|
||||
- AT90USB162
|
||||
- ATtiny88
|
||||
- ATmega328P
|
||||
- ATmega1284P
|
||||
- ATmega128RFA1
|
||||
- ATxmega128A1 rev D
|
||||
- ATxmega128A1
|
||||
- ATxmega256A3
|
||||
|
||||
* New programmers supported:
|
||||
|
||||
- AT89ISP cable (patch #6069)
|
||||
- Arduino
|
||||
|
||||
* Add support for the -x option to pass extended parameters to the
|
||||
programmer backend.
|
||||
|
||||
* Add support for JTAG daisy-chains, using the -x daisychain=
|
||||
option.
|
||||
|
||||
* Add support for the Atmel STK600 for "classic" AVRs (AT90, ATtiny,
|
||||
ATmega), using either ISP or high-voltage programming modes.
|
||||
|
||||
* Add support for the -x devcode extended parameter to the avr910
|
||||
programmer, to allow overriding the device code sent to the
|
||||
programmer.
|
||||
|
||||
* Add support for the Crossbow MIB510 programmer (patch #6074, #6542).
|
||||
|
||||
* Add support to bootstrap with GNU autoconf 2.61, and automake 1.10,
|
||||
respectively.
|
||||
|
||||
* Add support for ATxmega128A1 (including the revision D engineering
|
||||
samples) for STK600 and AVRISPmkII tools using PDI
|
||||
|
||||
* The option combination -tF now enters terminal mode even if the
|
||||
device initialization failed, so the user can modify programmer
|
||||
parameters (like Vtarget).
|
||||
|
||||
* Add preliminary support for ATxmega128A1 for the JTAG ICE mkII using
|
||||
JTAG.
|
||||
|
||||
* Add support for direct SPI transfers (bug #25156).
|
||||
|
||||
* Bugfixes.
|
||||
|
||||
Version 5.5:
|
||||
|
||||
* Add support for the USBtinyISP programmer (patch #6233)
|
||||
|
||||
* Add support for the C2N232I serial bitbang programmer (patch #6121)
|
||||
|
||||
* Bugfixes.
|
||||
|
||||
Version 5.4:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2009 Lars Immisch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* avrdude interface for Arduino programmer
|
||||
*
|
||||
* The Arduino programmer is mostly a STK500v1, just the signature bytes
|
||||
* are read differently.
|
||||
*/
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "pgm.h"
|
||||
#include "stk500_private.h"
|
||||
#include "stk500.h"
|
||||
#include "serial.h"
|
||||
|
||||
/* read signature bytes - arduino version */
|
||||
static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
|
||||
/* Signature byte reads are always 3 bytes. */
|
||||
|
||||
if (m->size < 3) {
|
||||
fprintf(stderr, "%s: memsize too small for sig byte read", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf[0] = Cmnd_STK_READ_SIGN;
|
||||
buf[1] = Sync_CRC_EOP;
|
||||
|
||||
serial_send(&pgm->fd, buf, 2);
|
||||
|
||||
if (serial_recv(&pgm->fd, buf, 5) < 0)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
fprintf(stderr, "%s: stk500_cmd(): programmer is out of sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
} else if (buf[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
"\n%s: arduino_read_sig_bytes(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -2;
|
||||
}
|
||||
if (buf[4] != Resp_STK_OK) {
|
||||
fprintf(stderr,
|
||||
"\n%s: arduino_read_sig_bytes(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_OK, buf[4]);
|
||||
return -3;
|
||||
}
|
||||
|
||||
m->buf[0] = buf[1];
|
||||
m->buf[1] = buf[2];
|
||||
m->buf[2] = buf[3];
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
void arduino_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
/* This is mostly a STK500; just the signature is read
|
||||
differently than on real STK500v1 */
|
||||
stk500_initpgm(pgm);
|
||||
|
||||
strcpy(pgm->type, "Arduino");
|
||||
pgm->read_sig_bytes = arduino_read_sig_bytes;
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2009 Lars Immisch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef arduino_h__
|
||||
#define arduino_h__
|
||||
|
||||
void arduino_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -171,13 +171,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
*/
|
||||
memset(buf, 0xff, size);
|
||||
|
||||
if ((strcmp(mem->desc, "eeprom")==0) ||
|
||||
(strcmp(mem->desc, "flash")==0) ||
|
||||
(strcmp(mem->desc, "application")==0) ||
|
||||
(strcmp(mem->desc, "apptable")==0) ||
|
||||
(strcmp(mem->desc, "boot")==0) ||
|
||||
(strcmp(mem->desc, "usersig")==0) ||
|
||||
(strcmp(mem->desc, "prodsig")==0)) {
|
||||
if ((strcmp(mem->desc, "flash")==0) || (strcmp(mem->desc, "eeprom")==0)) {
|
||||
if (pgm->paged_load != NULL && mem->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode read, perhaps more
|
||||
@@ -574,12 +568,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
progbuf, wsize);
|
||||
}
|
||||
|
||||
if ((strcmp(m->desc, "application")==0) ||
|
||||
(strcmp(m->desc, "apptable")==0) ||
|
||||
(strcmp(m->desc, "boot")==0) ||
|
||||
(strcmp(m->desc, "flash")==0) ||
|
||||
(strcmp(m->desc, "prodsig")==0) ||
|
||||
(strcmp(m->desc, "usersig")==0)) {
|
||||
if ((strcmp(m->desc, "flash")==0) || (strcmp(m->desc, "eeprom")==0)) {
|
||||
if (pgm->paged_write != NULL && m->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode write, perhaps more
|
||||
|
||||
@@ -61,7 +61,7 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size);
|
||||
|
||||
int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles);
|
||||
|
||||
int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles);
|
||||
int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles);;
|
||||
|
||||
int avr_mem_hiaddr(AVRMEM * mem);
|
||||
|
||||
|
||||
381
avrdude/avr910.c
381
avrdude/avr910.c
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
|
||||
* Copyright 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright 2008 Klaus Leidinger <klaus@mikrocontroller-projekte.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -32,7 +30,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -43,36 +40,7 @@
|
||||
#include "avr910.h"
|
||||
#include "serial.h"
|
||||
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
char has_auto_incr_addr;
|
||||
unsigned char devcode;
|
||||
unsigned int buffersize;
|
||||
unsigned char test_blockmode;
|
||||
unsigned char use_blockmode;
|
||||
};
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
|
||||
static void avr910_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
PDATA(pgm)->test_blockmode = 1;
|
||||
}
|
||||
|
||||
static void avr910_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
static char has_auto_incr_addr;
|
||||
|
||||
|
||||
static int avr910_send(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
@@ -196,83 +164,50 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
/* See if programmer supports autoincrement of address. */
|
||||
|
||||
avr910_send(pgm, "a", 1);
|
||||
avr910_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
|
||||
if (PDATA(pgm)->has_auto_incr_addr == 'Y')
|
||||
avr910_recv(pgm, &has_auto_incr_addr, 1);
|
||||
if (has_auto_incr_addr == 'Y')
|
||||
fprintf(stderr, "Programmer supports auto addr increment.\n");
|
||||
|
||||
/* Check support for buffered memory access, ignore if not available */
|
||||
/* Get list of devices that the programmer supports. */
|
||||
|
||||
if (PDATA(pgm)->test_blockmode == 1) {
|
||||
avr910_send(pgm, "b", 1);
|
||||
avr910_send(pgm, "t", 1);
|
||||
fprintf(stderr, "\nProgrammer supports the following devices:\n");
|
||||
devtype_1st = 0;
|
||||
while (1) {
|
||||
avr910_recv(pgm, &c, 1);
|
||||
if (c == 'Y') {
|
||||
avr910_recv(pgm, &c, 1);
|
||||
PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
|
||||
avr910_recv(pgm, &c, 1);
|
||||
PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
|
||||
fprintf(stderr,
|
||||
"Programmer supports buffered memory access with "
|
||||
"buffersize = %u bytes.\n",
|
||||
PDATA(pgm)->buffersize);
|
||||
PDATA(pgm)->use_blockmode = 1;
|
||||
} else {
|
||||
PDATA(pgm)->use_blockmode = 0;
|
||||
}
|
||||
} else {
|
||||
PDATA(pgm)->use_blockmode = 0;
|
||||
if (devtype_1st == 0)
|
||||
devtype_1st = c;
|
||||
if (c == 0)
|
||||
break;
|
||||
part = locate_part_by_avr910_devcode(part_list, c);
|
||||
|
||||
fprintf(stderr, " Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)");
|
||||
|
||||
/* FIXME: Need to lookup devcode and report the device. */
|
||||
|
||||
if (p->avr910_devcode == c)
|
||||
dev_supported = 1;
|
||||
};
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
if (!dev_supported) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: selected device is not supported by programmer: %s\n",
|
||||
progname, ovsigck? "warning": "error", p->id);
|
||||
if (!ovsigck)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (PDATA(pgm)->devcode == 0) {
|
||||
/* Tell the programmer which part we selected.
|
||||
If the user forced the selection, use the first device
|
||||
type that is supported by the programmer. */
|
||||
|
||||
/* Get list of devices that the programmer supports. */
|
||||
|
||||
avr910_send(pgm, "t", 1);
|
||||
fprintf(stderr, "\nProgrammer supports the following devices:\n");
|
||||
devtype_1st = 0;
|
||||
while (1) {
|
||||
avr910_recv(pgm, &c, 1);
|
||||
if (devtype_1st == 0)
|
||||
devtype_1st = c;
|
||||
if (c == 0)
|
||||
break;
|
||||
part = locate_part_by_avr910_devcode(part_list, c);
|
||||
|
||||
fprintf(stderr, " Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)");
|
||||
|
||||
/* FIXME: Need to lookup devcode and report the device. */
|
||||
|
||||
if (p->avr910_devcode == c)
|
||||
dev_supported = 1;
|
||||
};
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
if (!dev_supported) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: selected device is not supported by programmer: %s\n",
|
||||
progname, ovsigck? "warning": "error", p->id);
|
||||
if (!ovsigck)
|
||||
exit(1);
|
||||
}
|
||||
/* If the user forced the selection, use the first device
|
||||
type that is supported by the programmer. */
|
||||
buf[1] = ovsigck? devtype_1st: p->avr910_devcode;
|
||||
} else {
|
||||
/* devcode overridden by -x devcode= option */
|
||||
buf[1] = (char)(PDATA(pgm)->devcode);
|
||||
}
|
||||
|
||||
/* Tell the programmer which part we selected. */
|
||||
buf[0] = 'T';
|
||||
/* buf[1] has been set up above */
|
||||
buf[1] = ovsigck? devtype_1st: p->avr910_devcode;
|
||||
|
||||
avr910_send(pgm, buf, 2);
|
||||
avr910_vfy_cmd_sent(pgm, "select device");
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr,
|
||||
"%s: avr910_devcode selected: 0x%02x\n",
|
||||
progname, (unsigned)buf[1]);
|
||||
|
||||
avr910_enter_prog_mode(pgm);
|
||||
|
||||
return 0;
|
||||
@@ -324,55 +259,6 @@ static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
}
|
||||
|
||||
|
||||
static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms)
|
||||
{
|
||||
LNODEID ln;
|
||||
const char *extended_param;
|
||||
int rv = 0;
|
||||
|
||||
for (ln = lfirst(extparms); ln; ln = lnext(ln)) {
|
||||
extended_param = ldata(ln);
|
||||
|
||||
if (strncmp(extended_param, "devcode=", strlen("devcode=")) == 0) {
|
||||
int devcode;
|
||||
if (sscanf(extended_param, "devcode=%i", &devcode) != 1 ||
|
||||
devcode <= 0 || devcode > 255) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(): invalid devcode '%s'\n",
|
||||
progname, extended_param);
|
||||
rv = -1;
|
||||
continue;
|
||||
}
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(): devcode overwritten as 0x%02x\n",
|
||||
progname, devcode);
|
||||
}
|
||||
PDATA(pgm)->devcode = devcode;
|
||||
|
||||
continue;
|
||||
}
|
||||
if (strncmp(extended_param, "no_blockmode", strlen("no_blockmode")) == 0) {
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(-x): no testing for Blockmode\n",
|
||||
progname);
|
||||
}
|
||||
PDATA(pgm)->test_blockmode = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(): invalid extended parameter '%s'\n",
|
||||
progname, extended_param);
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int avr910_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
/*
|
||||
@@ -457,20 +343,33 @@ static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned long addr, unsigned char * value)
|
||||
{
|
||||
char buf[2];
|
||||
static int cached = 0;
|
||||
static unsigned char cvalue;
|
||||
static unsigned long caddr;
|
||||
|
||||
avr910_set_addr(pgm, addr >> 1);
|
||||
|
||||
avr910_send(pgm, "R", 1);
|
||||
|
||||
/* Read back the program mem word (MSB first) */
|
||||
avr910_recv(pgm, buf, sizeof(buf));
|
||||
|
||||
if ((addr & 0x01) == 0) {
|
||||
*value = buf[1];
|
||||
if (cached && ((caddr + 1) == addr)) {
|
||||
*value = cvalue;
|
||||
cached = 0;
|
||||
}
|
||||
else {
|
||||
*value = buf[0];
|
||||
char buf[2];
|
||||
|
||||
avr910_set_addr(pgm, addr >> 1);
|
||||
|
||||
avr910_send(pgm, "R", 1);
|
||||
|
||||
/* Read back the program mem word (MSB first) */
|
||||
avr910_recv(pgm, buf, sizeof(buf));
|
||||
|
||||
if ((addr & 0x01) == 0) {
|
||||
*value = buf[1];
|
||||
// cached = 1;
|
||||
cvalue = buf[0];
|
||||
caddr = addr;
|
||||
}
|
||||
else {
|
||||
*value = buf[0];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -543,7 +442,7 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
page_addr = addr;
|
||||
page_bytes = page_size;
|
||||
}
|
||||
else if ((PDATA(pgm)->has_auto_incr_addr != 'Y') && ((addr & 0x01) == 0)) {
|
||||
else if ((has_auto_incr_addr != 'Y') && ((addr & 0x01) == 0)) {
|
||||
avr910_set_addr(pgm, addr>>1);
|
||||
}
|
||||
|
||||
@@ -583,7 +482,7 @@ static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
|
||||
|
||||
addr++;
|
||||
|
||||
if (PDATA(pgm)->has_auto_incr_addr != 'Y') {
|
||||
if (has_auto_incr_addr != 'Y') {
|
||||
avr910_set_addr(pgm, addr);
|
||||
}
|
||||
|
||||
@@ -597,55 +496,15 @@ static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
|
||||
static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
{
|
||||
int rval = 0;
|
||||
if (PDATA(pgm)->use_blockmode == 0) {
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
rval = avr910_paged_write_flash(pgm, p, m, page_size, n_bytes);
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
rval = avr910_paged_write_eeprom(pgm, p, m, page_size, n_bytes);
|
||||
} else {
|
||||
rval = -2;
|
||||
}
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return avr910_paged_write_flash(pgm, p, m, page_size, n_bytes);
|
||||
}
|
||||
|
||||
if (PDATA(pgm)->use_blockmode == 1) {
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr = n_bytes;
|
||||
char *cmd;
|
||||
unsigned int blocksize = PDATA(pgm)->buffersize;
|
||||
|
||||
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
|
||||
rval = -2;
|
||||
|
||||
if (m->desc[0] == 'e')
|
||||
blocksize = 1; /* Write to eeprom single bytes only */
|
||||
avr910_set_addr(pgm, addr);
|
||||
|
||||
cmd = malloc(4 + blocksize);
|
||||
if (!cmd) rval = -1;
|
||||
cmd[0] = 'B';
|
||||
cmd[3] = toupper(m->desc[0]);
|
||||
|
||||
while (addr < max_addr) {
|
||||
if ((max_addr - addr) < blocksize) {
|
||||
blocksize = max_addr - addr;
|
||||
};
|
||||
memcpy(&cmd[4], &m->buf[addr], blocksize);
|
||||
cmd[1] = (blocksize >> 8) & 0xff;
|
||||
cmd[2] = blocksize & 0xff;
|
||||
|
||||
avr910_send(pgm, cmd, 4 + blocksize);
|
||||
avr910_vfy_cmd_sent(pgm, "write block");
|
||||
|
||||
addr += blocksize;
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
} /* while */
|
||||
free(cmd);
|
||||
|
||||
rval = addr;
|
||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
return avr910_paged_write_eeprom(pgm, p, m, page_size, n_bytes);
|
||||
}
|
||||
else {
|
||||
return -2;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
@@ -653,90 +512,50 @@ static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
{
|
||||
char cmd;
|
||||
int rd_size = 1;
|
||||
int rd_size;
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr;
|
||||
char buf[2];
|
||||
int rval=0;
|
||||
|
||||
if (PDATA(pgm)->use_blockmode == 0) {
|
||||
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd = 'R';
|
||||
rd_size = 2; /* read two bytes per addr */
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd = 'd';
|
||||
rd_size = 1;
|
||||
} else {
|
||||
rval = -2;
|
||||
}
|
||||
|
||||
max_addr = n_bytes/rd_size;
|
||||
|
||||
avr910_set_addr(pgm, addr);
|
||||
|
||||
while (addr < max_addr) {
|
||||
avr910_send(pgm, &cmd, 1);
|
||||
if (cmd == 'R') {
|
||||
/* The 'R' command returns two bytes, MSB first, we need to put the data
|
||||
into the memory buffer LSB first. */
|
||||
avr910_recv(pgm, buf, 2);
|
||||
m->buf[addr*2] = buf[1]; /* LSB */
|
||||
m->buf[addr*2+1] = buf[0]; /* MSB */
|
||||
}
|
||||
else {
|
||||
avr910_recv(pgm, (char *)&m->buf[addr], 1);
|
||||
}
|
||||
|
||||
addr++;
|
||||
|
||||
if (PDATA(pgm)->has_auto_incr_addr != 'Y') {
|
||||
avr910_set_addr(pgm, addr);
|
||||
}
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
}
|
||||
|
||||
rval = addr * rd_size;
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd = 'R';
|
||||
rd_size = 2; /* read two bytes per addr */
|
||||
}
|
||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd = 'd';
|
||||
rd_size = 1;
|
||||
}
|
||||
else {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (PDATA(pgm)->use_blockmode == 1) {
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr = n_bytes;
|
||||
int rd_size = 1;
|
||||
max_addr = n_bytes/rd_size;
|
||||
|
||||
/* check parameter syntax: only "flash" or "eeprom" is allowed */
|
||||
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
|
||||
rval = -2;
|
||||
avr910_set_addr(pgm, addr);
|
||||
|
||||
/* use buffered mode */
|
||||
char cmd[4];
|
||||
int blocksize = PDATA(pgm)->buffersize;
|
||||
|
||||
cmd[0] = 'g';
|
||||
cmd[3] = toupper(m->desc[0]);
|
||||
|
||||
avr910_set_addr(pgm, addr);
|
||||
|
||||
while (addr < max_addr) {
|
||||
if ((max_addr - addr) < blocksize) {
|
||||
blocksize = max_addr - addr;
|
||||
};
|
||||
cmd[1] = (blocksize >> 8) & 0xff;
|
||||
cmd[2] = blocksize & 0xff;
|
||||
|
||||
avr910_send(pgm, cmd, 4);
|
||||
avr910_recv(pgm, (char *)&m->buf[addr], blocksize);
|
||||
|
||||
addr += blocksize;
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
while (addr < max_addr) {
|
||||
avr910_send(pgm, &cmd, 1);
|
||||
if (cmd == 'R') {
|
||||
/* The 'R' command returns two bytes, MSB first, we need to put the data
|
||||
into the memory buffer LSB first. */
|
||||
avr910_recv(pgm, buf, 2);
|
||||
m->buf[addr*2] = buf[1]; /* LSB */
|
||||
m->buf[addr*2+1] = buf[0]; /* MSB */
|
||||
}
|
||||
else {
|
||||
avr910_recv(pgm, (char *)&m->buf[addr], 1);
|
||||
}
|
||||
|
||||
rval = addr * rd_size;
|
||||
addr++;
|
||||
|
||||
if (has_auto_incr_addr != 'Y') {
|
||||
avr910_set_addr(pgm, addr);
|
||||
}
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
}
|
||||
|
||||
return rval;
|
||||
return addr * rd_size;
|
||||
}
|
||||
|
||||
/* Signature byte reads are always 3 bytes. */
|
||||
@@ -789,8 +608,4 @@ void avr910_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_load = avr910_paged_load;
|
||||
|
||||
pgm->read_sig_bytes = avr910_read_sig_bytes;
|
||||
|
||||
pgm->parseextparams = avr910_parseextparms;
|
||||
pgm->setup = avr910_setup;
|
||||
pgm->teardown = avr910_teardown;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\"
|
||||
.\" avrdude - A Downloader/Uploader for AVR device programmers
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005 - 2009 Joerg Wunsch
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005, 2006 Joerg Wunsch
|
||||
.\"
|
||||
.\" This program is free software; you can redistribute it and/or modify
|
||||
.\" it under the terms of the GNU General Public License as published by
|
||||
@@ -19,7 +19,7 @@
|
||||
.\"
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd DATE November 5, 2008
|
||||
.Dd DATE October 26, 2006
|
||||
.Os
|
||||
.Dt AVRDUDE 1
|
||||
.Sh NAME
|
||||
@@ -48,7 +48,6 @@
|
||||
.Op Fl u
|
||||
.Op Fl U Ar memtype:op:filename:filefmt
|
||||
.Op Fl v
|
||||
.Op Fl x Ar extended_param
|
||||
.Op Fl V
|
||||
.Op Fl y
|
||||
.Op Fl Y
|
||||
@@ -59,7 +58,6 @@ microcontrollers.
|
||||
.Nm Avrdude
|
||||
supports Atmel's STK500 programmer,
|
||||
Atmel's AVRISP and AVRISP mkII devices,
|
||||
Atmel's STK600,
|
||||
Atmel's JTAG ICE (both mkI and mkII, the latter also in ISP mode),
|
||||
programmers complying to AppNote AVR910 and AVR109 (including the Butterfly),
|
||||
as well as a simple hard-wired
|
||||
@@ -107,13 +105,6 @@ Using firmware version 2, high-voltage programming is also supported,
|
||||
both parallel and serial
|
||||
(programmer types stk500pp and stk500hvsp).
|
||||
.Pp
|
||||
The Arduino (which is very similar to the STK500 1.x) is supported via
|
||||
its own programmer type specification ``arduino''.
|
||||
.Pp
|
||||
Atmel's STK600 programmer is supported in ISP and high-voltage
|
||||
programming modes, and connects through the USB.
|
||||
For ATxmega devices, the STK600 is supported in PDI mode.
|
||||
.Pp
|
||||
The simple serial programmer described in Atmel's application note
|
||||
AVR910, and the bootloader described in Atmel's application note
|
||||
AVR109 (which is also used by the AVR Butterfly evaluation board), are
|
||||
@@ -136,11 +127,11 @@ frequency, so the
|
||||
.Fl B Ar bitclock
|
||||
option might be required to achieve a stable ISP communication.
|
||||
.Pp
|
||||
The USBasp ISP and USBtinyISP adapters are also supported, provided
|
||||
The USBasp ISP adapter is also supported, provided
|
||||
.Nm avrdude
|
||||
has been compiled with libusb support.
|
||||
They both feature simple firwmare-only USB implementations, running on
|
||||
an ATmega8 (or ATmega88), or ATtiny2313, respectively.
|
||||
It features a simple firwmare-only USB implementation, running on
|
||||
an ATmega8 (or ATmega88).
|
||||
.Pp
|
||||
Input files can be provided, and output files can be written in
|
||||
different file formats, such as raw binary files containing the data
|
||||
@@ -169,7 +160,7 @@ been code-protected previously, of course) and store the data in a
|
||||
file. Finally, a ``terminal'' mode is available that allows one to
|
||||
interactively communicate with the MCU, and to display or program
|
||||
individual memory cells.
|
||||
On the STK500 and STK600 programmer, several operational parameters (target supply
|
||||
On the STK500 programmer, several operational parameters (target supply
|
||||
voltage, target Aref voltage, master clock) can be examined and changed
|
||||
from within terminal mode as well.
|
||||
.Ss Options
|
||||
@@ -206,8 +197,6 @@ m103 ATmega103
|
||||
m128 ATmega128
|
||||
m1280 ATmega1280
|
||||
m1281 ATmega1281
|
||||
m1284p ATmega1284P
|
||||
m128rfa1 ATmega128RFA1
|
||||
m16 ATmega16
|
||||
m161 ATmega161
|
||||
m162 ATmega162
|
||||
@@ -238,8 +227,6 @@ t25 ATtiny25
|
||||
t26 ATtiny26
|
||||
t45 ATtiny45
|
||||
t85 ATtiny85
|
||||
x128a1 ATxmega128A1
|
||||
x128a1d ATxmega128A1revD
|
||||
.TE
|
||||
.Bl -tag -width "(**) "
|
||||
.It "(*)"
|
||||
@@ -294,18 +281,11 @@ option with flash memory is specified,
|
||||
will perform a chip erase before starting any of the programming
|
||||
operations, since it generally is a mistake to program the flash
|
||||
without performing an erase first. This option disables that.
|
||||
Auto erase is not used for ATxmega devices as these devices can
|
||||
use page erase before writing each page so no explicit chip erase
|
||||
is required.
|
||||
Note however that any page not affected by the current operation
|
||||
will retain its previous contents.
|
||||
.It Fl e
|
||||
Causes a chip erase to be executed. This will reset the contents of the
|
||||
flash ROM and EEPROM to the value
|
||||
.Ql 0xff ,
|
||||
and clear all lock bits.
|
||||
Except for ATxmega devices which can use page erase,
|
||||
it is basically a prerequisite command before the flash ROM can be
|
||||
and is basically a prerequisite command before the flash ROM can be
|
||||
reprogrammed again. The only exception would be if the new
|
||||
contents would exclusively cause bits to be programmed from the value
|
||||
.Ql 1
|
||||
@@ -372,12 +352,6 @@ reasonable before continuing. Since it can happen from time to time
|
||||
that a device has a broken (erased or overwritten) device signature
|
||||
but is otherwise operating normally, this options is provided to
|
||||
override the check.
|
||||
Also, for programmers like the Atmel STK500 and STK600 which can
|
||||
adjust parameters local to the programming tool (independent of an
|
||||
actual connection to a target controller), this option can be used
|
||||
together with
|
||||
.Fl t
|
||||
to continue in terminal mode.
|
||||
.It Fl i Ar delay
|
||||
For bitbang-type programmers, delay for approximately
|
||||
.Ar delay
|
||||
@@ -418,14 +392,6 @@ serial port, the
|
||||
port is the default. If you need to use a different parallel or
|
||||
serial port, use this option to specify the alternate port name.
|
||||
.Pp
|
||||
On Win32 operating systems, the parallel ports are referred to as lpt1
|
||||
through lpt3, referring to the addresses 0x378, 0x278, and 0x3BC,
|
||||
respectively. If the parallel port can be accessed through a different
|
||||
address, this address can be specified directly, using the common C
|
||||
language notation (i. e., hexadecimal values are prefixed by
|
||||
.Ql 0x
|
||||
).
|
||||
.Pp
|
||||
For the JTAG ICE mkII, if
|
||||
.Nm
|
||||
has been configured with libusb support,
|
||||
@@ -612,13 +578,6 @@ does not have a colon in it.
|
||||
Enable verbose output.
|
||||
.It Fl V
|
||||
Disable automatic verify check when uploading data.
|
||||
.It Fl x Ar extended_param
|
||||
Pass
|
||||
.Ar extended_param
|
||||
to the chosen programmer implementation as an extended parameter.
|
||||
The interpretation of the extended parameter depends on the
|
||||
programmer itself.
|
||||
See below for a list of programmers accepting extended parameters.
|
||||
.It Fl y
|
||||
Tells
|
||||
.Nm
|
||||
@@ -683,38 +642,26 @@ feature of an AVR part that is not directly supported by
|
||||
.Nm ,
|
||||
this command allows you to use it, even though
|
||||
.Nm
|
||||
does not implement the command. When using direct SPI mode, up to 3 bytes
|
||||
can be omitted.
|
||||
does not implement the command.
|
||||
.It Ar sig
|
||||
Display the device signature bytes.
|
||||
.It Ar spi
|
||||
Enter direct SPI mode. The
|
||||
.Em pgmled
|
||||
pin acts as slave select.
|
||||
.Em Only supported on parallel bitbang programmers.
|
||||
.It Ar part
|
||||
Display the current part settings and parameters. Includes chip
|
||||
specific information including all memory types supported by the
|
||||
device, read/write timing, etc.
|
||||
.It Ar pgm
|
||||
Return to programming mode (from direct SPI mode).
|
||||
.It Ar vtarg voltage
|
||||
Set the target's supply voltage to
|
||||
.Ar voltage
|
||||
Volts.
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.It Ar varef Oo Ar channel Oc Ar voltage
|
||||
.Em Only supported on the STK500 programmer.
|
||||
.It Ar varef voltage
|
||||
Set the adjustable voltage source to
|
||||
.Ar voltage
|
||||
Volts.
|
||||
This voltage is normally used to drive the target's
|
||||
.Em Aref
|
||||
input on the STK500.
|
||||
On the Atmel STK600, two reference voltages are available, which
|
||||
can be selected by the optional
|
||||
.Ar channel
|
||||
argument (either 0 or 1).
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.Em Only supported on the STK500 programmer.
|
||||
.It Ar fosc freq Ns Op M Ns \&| Ns k
|
||||
Set the master oscillator to
|
||||
.Ar freq
|
||||
@@ -724,12 +671,12 @@ An optional trailing letter
|
||||
multiplies by 1E6, a trailing letter
|
||||
.Ar \&k
|
||||
by 1E3.
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.Em Only supported on the STK500 programmer.
|
||||
.It Ar fosc off
|
||||
Turn the master oscillator off.
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.Em Only supported on the STK500 programmer.
|
||||
.It Ar sck period
|
||||
.Em STK500 and STK600 programmer only:
|
||||
.Em STK500 programmer only:
|
||||
Set the SCK clock period to
|
||||
.Ar period
|
||||
microseconds.
|
||||
@@ -744,7 +691,7 @@ software signs off from the JTAG ICE.
|
||||
This parameter can also be used on the JTAG ICE mkII to specify the
|
||||
ISP clock period when operating the ICE in ISP mode.
|
||||
.It Ar parms
|
||||
.Em STK500 and STK600 programmer only:
|
||||
.Em STK500 programmer only:
|
||||
Display the current voltage and master oscillator parameters.
|
||||
.Pp
|
||||
.Em JTAG ICE only:
|
||||
@@ -797,52 +744,6 @@ be accessed using normal ISP programming.
|
||||
This sequence is automatically initiated by using the JTAG ICE mkII
|
||||
or AVR Dragon in ISP mode, when they detect that ISP mode cannot be
|
||||
entered.
|
||||
.Ss Programmers accepting extended parameters
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar JTAG ICE mkII
|
||||
.It Ar AVR Dragon
|
||||
When using the JTAG ICE mkII or AVR Dragon in JTAG mode, the
|
||||
following extended parameter is accepted:
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar jtagchain=UB,UA,BB,BA
|
||||
Setup the JTAG scan chain for
|
||||
.Ar UB
|
||||
units before,
|
||||
.Ar UA
|
||||
units after,
|
||||
.Ar BB
|
||||
bits before, and
|
||||
.Ar BA
|
||||
bits after the target AVR, respectively.
|
||||
Each AVR unit within the chain shifts by 4 bits.
|
||||
Other JTAG units might require a different bit shift count.
|
||||
.El
|
||||
.It Ar AVR910
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar devcode=VALUE
|
||||
Override the device code selection by using
|
||||
.Ar VALUE
|
||||
as the device code.
|
||||
The programmer is not queried for the list of supported
|
||||
device codes, and the specified
|
||||
.Ar VALUE
|
||||
is not verified but used directly within the
|
||||
.Ql T
|
||||
command sent to the programmer.
|
||||
.Ar VALUE
|
||||
can be specified using the conventional number notation of the
|
||||
C programming language.
|
||||
.El
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar no_blockmode
|
||||
Disables the default checking for block transfer capability.
|
||||
Use
|
||||
.Ar no_blockmode
|
||||
only if your
|
||||
.Ar AVR910
|
||||
programmer creates errors during initial sequence.
|
||||
.El
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -offset indent -width /dev/ppi0XXX
|
||||
.It Pa /dev/ppi0
|
||||
@@ -914,8 +815,8 @@ Page-mode programming the EEPROM through JTAG (i.e. through an
|
||||
.Fl U
|
||||
option) requires a prior chip erase.
|
||||
This is an inherent feature of the way JTAG EEPROM programming works.
|
||||
This also applies to the STK500 and STK600 in parallel programming mode.
|
||||
This also applies to the STK500 in parallel programming mode.
|
||||
.Pp
|
||||
The USBasp and USBtinyISP drivers do not offer any option to distinguish multiple
|
||||
The USBasp driver does not offer any option to distinguish multiple
|
||||
devices connected simultaneously, so effectively only a single device
|
||||
is supported.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ extern "C" {
|
||||
#define ANTIWARP 3
|
||||
#define usleep(us) Sleep(us/1000*ANTIWARP)
|
||||
*/
|
||||
int usleep(unsigned int us);
|
||||
void usleep(unsigned long us);
|
||||
|
||||
#if !defined(HAVE_GETTIMEOFDAY)
|
||||
struct timezone;
|
||||
|
||||
@@ -488,22 +488,22 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
|
||||
AVRMEM * m;
|
||||
|
||||
fprintf(f,
|
||||
"%sAVR Part : %s\n"
|
||||
"%sChip Erase delay : %d us\n"
|
||||
"%sPAGEL : P%02X\n"
|
||||
"%sBS2 : P%02X\n"
|
||||
"%sRESET disposition : %s\n"
|
||||
"%sRETRY pulse : %s\n"
|
||||
"%sserial program mode : %s\n"
|
||||
"%sparallel program mode : %s\n"
|
||||
"%sTimeout : %d\n"
|
||||
"%sStabDelay : %d\n"
|
||||
"%sCmdexeDelay : %d\n"
|
||||
"%sSyncLoops : %d\n"
|
||||
"%sByteDelay : %d\n"
|
||||
"%sPollIndex : %d\n"
|
||||
"%sPollValue : 0x%02x\n"
|
||||
"%sMemory Detail :\n\n",
|
||||
"%sAVR Part : %s\n"
|
||||
"%sChip Erase delay : %d us\n"
|
||||
"%sPAGEL : P%02X\n"
|
||||
"%sBS2 : P%02X\n"
|
||||
"%sRESET disposition : %s\n"
|
||||
"%sRETRY pulse : %s\n"
|
||||
"%sserial program mode : %s\n"
|
||||
"%sparallel program mode : %s\n"
|
||||
"%sTimeout : %d\n"
|
||||
"%sStabDelay : %d\n"
|
||||
"%sCmdexeDelay : %d\n"
|
||||
"%sSyncLoops : %d\n"
|
||||
"%sByteDelay : %d\n"
|
||||
"%sPollIndex : %d\n"
|
||||
"%sPollValue : 0x%02x\n"
|
||||
"%sMemory Detail :\n\n",
|
||||
prefix, p->desc,
|
||||
prefix, p->chip_erase_delay,
|
||||
prefix, p->pagel,
|
||||
|
||||
@@ -88,7 +88,6 @@ typedef struct opcode {
|
||||
#define AVRPART_ALLOWFULLPAGEBITSTREAM 0x0010 /* JTAG ICE mkII param. */
|
||||
#define AVRPART_ENABLEPAGEPROGRAMMING 0x0020 /* JTAG ICE mkII param. */
|
||||
#define AVRPART_HAS_DW 0x0040 /* part has a debugWire i/f */
|
||||
#define AVRPART_HAS_PDI 0x0080 /* part has PDI i/f rather than ISP (ATxmega) */
|
||||
|
||||
#define AVR_DESCLEN 64
|
||||
#define AVR_IDLEN 32
|
||||
@@ -148,7 +147,6 @@ typedef struct avrpart {
|
||||
unsigned char rampz; /* JTAG ICE mkII XML file parameter */
|
||||
unsigned char spmcr; /* JTAG ICE mkII XML file parameter */
|
||||
unsigned short eecr; /* JTAC ICE mkII XML file parameter */
|
||||
unsigned int nvm_base; /* Base address of NVM controller in ATxmega devices */
|
||||
|
||||
OPCODE * op[AVR_OP_MAX]; /* opcodes */
|
||||
|
||||
@@ -164,7 +162,6 @@ typedef struct avrmem {
|
||||
int size; /* total memory size in bytes */
|
||||
int page_size; /* size of memory page (if page addressed) */
|
||||
int num_pages; /* number of pages (if page addressed) */
|
||||
unsigned int offset; /* offset in IO memory (ATxmega) */
|
||||
int min_write_delay; /* microseconds */
|
||||
int max_write_delay; /* microseconds */
|
||||
int pwroff_after_write; /* after this memory type is written to,
|
||||
|
||||
@@ -225,39 +225,6 @@ int bitbang_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* transmit bytes via SPI and return the results; 'cmd' and
|
||||
* 'res' must point to data buffers
|
||||
*/
|
||||
int bitbang_spi(PROGRAMMER * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_LED_PGM], 0);
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
res[i] = bitbang_txrx(pgm, cmd[i]);
|
||||
}
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_LED_PGM], 1);
|
||||
|
||||
if(verbose >= 2)
|
||||
{
|
||||
fprintf(stderr, "bitbang_cmd(): [ ");
|
||||
for(i = 0; i < count; i++)
|
||||
fprintf(stderr, "%02X ", cmd[i]);
|
||||
fprintf(stderr, "] [ ");
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
fprintf(stderr, "%02X ", res[i]);
|
||||
}
|
||||
fprintf(stderr, "]\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* issue the 'chip erase' command to the AVR device
|
||||
|
||||
@@ -39,8 +39,6 @@ int bitbang_pgm_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_vfy_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_cmd (PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4]);
|
||||
int bitbang_spi (PROGRAMMER * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int count);
|
||||
int bitbang_chip_erase (PROGRAMMER * pgm, AVRPART * p);
|
||||
int bitbang_program_enable (PROGRAMMER * pgm, AVRPART * p);
|
||||
void bitbang_powerup (PROGRAMMER * pgm);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#! /bin/sh
|
||||
|
||||
# autoconf-2.59 or 2.61 is known to work
|
||||
# autoconf-2.59 is required
|
||||
|
||||
: ${AUTOHEADER="autoheader${AC_VER}"}
|
||||
: ${AUTOCONF="autoconf${AC_VER}"}
|
||||
|
||||
# automake-1.9.x or 1.10 is known to work
|
||||
# automake-1.9.x is required
|
||||
|
||||
: ${ACLOCAL="aclocal${AM_VER}"}
|
||||
: ${AUTOMAKE="automake${AM_VER}"}
|
||||
@@ -14,20 +14,22 @@
|
||||
|
||||
AUTOCONF_VER=`(${AUTOCONF} --version 2>/dev/null | head -n 1 | \
|
||||
cut -d ' ' -f 4) 2>/dev/null`
|
||||
if [ "$AUTOCONF_VER" != "2.59" -a "$AUTOCONF_VER" != "2.61" ]
|
||||
if [ "$AUTOCONF_VER" != "2.59" ]
|
||||
then
|
||||
echo "Warning: This program is tested with autoconf version 2.59 and 2.61."
|
||||
echo "You need to use autoconf version 2.59."
|
||||
echo "You are using `${AUTOCONF} --version | head -n 1`."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify automake version
|
||||
|
||||
AUTOMAKE_VER=`(${AUTOMAKE} --version | head -n 1 | \
|
||||
cut -d ' ' -f 4 | cut -d '.' -f -2) 2>/dev/null`
|
||||
if [ "$AUTOMAKE_VER" != "1.9" -a "$AUTOMAKE_VER" != "1.10" ]
|
||||
if [ "$AUTOMAKE_VER" != "1.9" ]
|
||||
then
|
||||
echo "Warning: This program is tested with automake version 1.9 and 1.10."
|
||||
echo "You need to use automake version 1.9."
|
||||
echo "You are using `${AUTOMAKE} --version | head -n 1`."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
|
||||
* Copyright (C) 2005, 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright (C) 2005 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -50,35 +50,23 @@
|
||||
#include "butterfly.h"
|
||||
#include "serial.h"
|
||||
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
char has_auto_incr_addr;
|
||||
unsigned int buffersize;
|
||||
};
|
||||
static char has_auto_incr_addr;
|
||||
static unsigned buffersize = 0;
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
/* These two defines are only for debugging. Will remove them once it starts
|
||||
working. */
|
||||
|
||||
static void butterfly_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: butterfly_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
}
|
||||
#define show_func_info() \
|
||||
fprintf(stderr, "%s: line %d: called %s()\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__)
|
||||
|
||||
#define no_show_func_info()
|
||||
|
||||
static void butterfly_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
static int butterfly_send(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return serial_send(&pgm->fd, (unsigned char *)buf, len);
|
||||
}
|
||||
|
||||
@@ -87,6 +75,8 @@ static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
{
|
||||
int rv;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
rv = serial_recv(&pgm->fd, (unsigned char *)buf, len);
|
||||
if (rv < 0) {
|
||||
fprintf(stderr,
|
||||
@@ -100,6 +90,8 @@ static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
|
||||
static int butterfly_drain(PROGRAMMER * pgm, int display)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return serial_drain(&pgm->fd, display);
|
||||
}
|
||||
|
||||
@@ -119,6 +111,8 @@ static void butterfly_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
|
||||
|
||||
static int butterfly_rdy_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -127,6 +121,8 @@ static int butterfly_rdy_led(PROGRAMMER * pgm, int value)
|
||||
|
||||
static int butterfly_err_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -135,6 +131,8 @@ static int butterfly_err_led(PROGRAMMER * pgm, int value)
|
||||
|
||||
static int butterfly_pgm_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -143,6 +141,8 @@ static int butterfly_pgm_led(PROGRAMMER * pgm, int value)
|
||||
|
||||
static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -154,6 +154,8 @@ static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
|
||||
*/
|
||||
static int butterfly_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
butterfly_send(pgm, "e", 1);
|
||||
butterfly_vfy_cmd_sent(pgm, "chip erase");
|
||||
|
||||
@@ -180,6 +182,8 @@ static void butterfly_leave_prog_mode(PROGRAMMER * pgm)
|
||||
*/
|
||||
static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -189,6 +193,8 @@ static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
*/
|
||||
static void butterfly_powerup(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return;
|
||||
@@ -200,6 +206,8 @@ static void butterfly_powerup(PROGRAMMER * pgm)
|
||||
*/
|
||||
static void butterfly_powerdown(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return;
|
||||
@@ -218,6 +226,8 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
char type;
|
||||
char c, devtype_1st;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
/*
|
||||
* Send some ESC to activate butterfly bootloader. This is not needed
|
||||
* for plain avr109 bootloaders but does not harm there either.
|
||||
@@ -269,8 +279,8 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
/* See if programmer supports autoincrement of address. */
|
||||
|
||||
butterfly_send(pgm, "a", 1);
|
||||
butterfly_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
|
||||
if (PDATA(pgm)->has_auto_incr_addr == 'Y')
|
||||
butterfly_recv(pgm, &has_auto_incr_addr, 1);
|
||||
if (has_auto_incr_addr == 'Y')
|
||||
fprintf(stderr, "Programmer supports auto addr increment.\n");
|
||||
|
||||
/* Check support for buffered memory access, abort if not available */
|
||||
@@ -284,12 +294,12 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
exit(1);
|
||||
};
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
|
||||
buffersize = (unsigned int)(unsigned char)c<<8;
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
|
||||
buffersize += (unsigned int)(unsigned char)c;
|
||||
fprintf(stderr,
|
||||
"Programmer supports buffered memory access with buffersize=%i bytes.\n",
|
||||
PDATA(pgm)->buffersize);
|
||||
buffersize);
|
||||
|
||||
/* Get list of devices that the programmer supports. */
|
||||
|
||||
@@ -321,11 +331,6 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
butterfly_send(pgm, buf, 2);
|
||||
butterfly_vfy_cmd_sent(pgm, "select device");
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr,
|
||||
"%s: devcode selected: 0x%02x\n",
|
||||
progname, (unsigned)buf[1]);
|
||||
|
||||
butterfly_enter_prog_mode(pgm);
|
||||
|
||||
return 0;
|
||||
@@ -335,6 +340,8 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
static void butterfly_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
butterfly_leave_prog_mode(pgm);
|
||||
|
||||
return;
|
||||
@@ -343,12 +350,16 @@ static void butterfly_disable(PROGRAMMER * pgm)
|
||||
|
||||
static void butterfly_enable(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static int butterfly_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
/*
|
||||
* If baudrate was not specified use 19200 Baud
|
||||
@@ -369,6 +380,8 @@ static int butterfly_open(PROGRAMMER * pgm, char * port)
|
||||
|
||||
static void butterfly_close(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* "exit programmer" */
|
||||
butterfly_send(pgm, "E", 1);
|
||||
butterfly_vfy_cmd_sent(pgm, "exit bootloader");
|
||||
@@ -380,6 +393,8 @@ static void butterfly_close(PROGRAMMER * pgm)
|
||||
|
||||
static void butterfly_display(PROGRAMMER * pgm, const char * p)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -419,6 +434,8 @@ static int butterfly_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int size;
|
||||
int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
if ((strcmp(m->desc, "flash") == 0) || (strcmp(m->desc, "eeprom") == 0))
|
||||
{
|
||||
cmd[0] = 'B';
|
||||
@@ -511,6 +528,8 @@ static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
{
|
||||
char cmd;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return butterfly_read_byte_flash(pgm, p, m, addr, value);
|
||||
}
|
||||
@@ -548,7 +567,7 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr = n_bytes;
|
||||
char *cmd;
|
||||
unsigned int blocksize = PDATA(pgm)->buffersize;
|
||||
unsigned int blocksize = buffersize;
|
||||
int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
|
||||
|
||||
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
|
||||
@@ -610,7 +629,7 @@ static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
{ /* use buffered mode */
|
||||
char cmd[4];
|
||||
int blocksize = PDATA(pgm)->buffersize;
|
||||
int blocksize = buffersize;
|
||||
|
||||
cmd[0] = 'g';
|
||||
cmd[3] = toupper(m->desc[0]);
|
||||
@@ -645,6 +664,8 @@ static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
||||
{
|
||||
unsigned char tmp;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
if (m->size < 3) {
|
||||
fprintf(stderr, "%s: memsize too small for sig byte read", progname);
|
||||
return -1;
|
||||
@@ -663,6 +684,8 @@ static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
||||
|
||||
void butterfly_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
strcpy(pgm->type, "avr910");
|
||||
|
||||
/*
|
||||
@@ -693,7 +716,4 @@ void butterfly_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_load = butterfly_paged_load;
|
||||
|
||||
pgm->read_sig_bytes = butterfly_read_sig_bytes;
|
||||
|
||||
pgm->setup = butterfly_setup;
|
||||
pgm->teardown = butterfly_teardown;
|
||||
}
|
||||
|
||||
@@ -37,13 +37,11 @@
|
||||
#include "ppi.h"
|
||||
#include "pgm.h"
|
||||
#include "stk500.h"
|
||||
#include "arduino.h"
|
||||
#include "stk500v2.h"
|
||||
#include "stk500generic.h"
|
||||
#include "avr910.h"
|
||||
#include "butterfly.h"
|
||||
#include "usbasp.h"
|
||||
#include "usbtiny.h"
|
||||
#include "avr.h"
|
||||
#include "jtagmkI.h"
|
||||
#include "jtagmkII.h"
|
||||
@@ -80,7 +78,6 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_PAGE_SIZE
|
||||
%token K_PAGED
|
||||
|
||||
%token K_ARDUINO
|
||||
%token K_BAUDRATE
|
||||
%token K_BS2
|
||||
%token K_BUFF
|
||||
@@ -113,8 +110,6 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_MISO
|
||||
%token K_MOSI
|
||||
%token K_NUM_PAGES
|
||||
%token K_NVM_BASE
|
||||
%token K_OFFSET
|
||||
%token K_PAGEL
|
||||
%token K_PAR
|
||||
%token K_PARALLEL
|
||||
@@ -139,12 +134,8 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_STK500PP
|
||||
%token K_STK500V2
|
||||
%token K_STK500GENERIC
|
||||
%token K_STK600
|
||||
%token K_STK600HVSP
|
||||
%token K_STK600PP
|
||||
%token K_AVR910
|
||||
%token K_USBASP
|
||||
%token K_USBTINY
|
||||
%token K_BUTTERFLY
|
||||
%token K_TYPE
|
||||
%token K_VCC
|
||||
@@ -205,7 +196,6 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_ENABLEPAGEPROGRAMMING /* ? yes for mega256*, mega406 */
|
||||
%token K_HAS_JTAG /* MCU has JTAG i/f. */
|
||||
%token K_HAS_DW /* MCU has debugWire i/f. */
|
||||
%token K_HAS_PDI /* MCU has PDI i/f rather than ISP (ATxmega). */
|
||||
%token K_IDR /* address of OCD register in IO space */
|
||||
%token K_RAMPZ /* address of RAMPZ reg. in IO space */
|
||||
%token K_SPMCR /* address of SPMC[S]R in memory space */
|
||||
@@ -419,30 +409,6 @@ prog_parm :
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_ARDUINO {
|
||||
{
|
||||
arduino_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK600 {
|
||||
{
|
||||
stk600_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK600HVSP {
|
||||
{
|
||||
stk600hvsp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK600PP {
|
||||
{
|
||||
stk600pp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_AVR910 {
|
||||
{
|
||||
avr910_initpgm(current_prog);
|
||||
@@ -455,12 +421,6 @@ prog_parm :
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_USBTINY {
|
||||
{
|
||||
usbtiny_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_BUTTERFLY {
|
||||
{
|
||||
butterfly_initpgm(current_prog);
|
||||
@@ -1039,16 +999,6 @@ part_parm :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_HAS_PDI TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
current_part->flags |= AVRPART_HAS_PDI;
|
||||
else if ($3->primary == K_NO)
|
||||
current_part->flags &= ~AVRPART_HAS_PDI;
|
||||
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_ALLOWFULLPAGEBITSTREAM TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
@@ -1093,12 +1043,6 @@ part_parm :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_NVM_BASE TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_part->nvm_base = $3->value.number;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_SERIAL TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
@@ -1216,12 +1160,6 @@ mem_spec :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_OFFSET TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_mem->offset = $3->value.number;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_MIN_WRITE_DELAY TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_mem->min_write_delay = $3->value.number;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT(avrdude, 5.8, avrdude-dev@nongnu.org)
|
||||
AC_INIT(avrdude, 5.4, avrdude-dev@nongnu.org)
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
@@ -38,18 +38,13 @@ AM_CONFIG_HEADER(ac_cfg.h)
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_YACC
|
||||
AC_PROG_LEX
|
||||
AM_PROG_LEX
|
||||
AC_PROG_RANLIB
|
||||
|
||||
dnl Makefile.am:77: compiling `config_gram.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac'
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([termcap], [tputs])
|
||||
AC_CHECK_LIB([ncurses], [tputs])
|
||||
AC_CHECK_LIB([readline], [readline])
|
||||
AC_SEARCH_LIBS([gethostent], [nsl])
|
||||
AC_SEARCH_LIBS([setsockopt], [socket])
|
||||
AH_TEMPLATE([HAVE_LIBUSB],
|
||||
[Define if USB support is enabled via libusb])
|
||||
AC_CHECK_LIB([usb], [usb_get_string_simple], [have_libusb=yes])
|
||||
@@ -67,6 +62,7 @@ fi
|
||||
AC_SUBST(LIBUSB, $LIBUSB)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([limits.h stdlib.h string.h])
|
||||
AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h])
|
||||
AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include <windows.h>
|
||||
@@ -77,6 +73,8 @@ AC_C_CONST
|
||||
AC_HEADER_TIME
|
||||
|
||||
# Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday])
|
||||
|
||||
AC_MSG_CHECKING([for a Win32 HID libray])
|
||||
@@ -121,13 +119,6 @@ fi
|
||||
LIBS="${SAVED_LIBS}"
|
||||
AC_SUBST(LIBHID, $LIBHID)
|
||||
|
||||
# Check for types
|
||||
|
||||
# Solaris has uint_t and ulong_t typedefs in <sys/types.h>, avoid
|
||||
# the redeclaration in usbtiny.c.
|
||||
AC_CHECK_TYPES([uint_t], [], [], [#include <sys/types.h>])
|
||||
AC_CHECK_TYPES([ulong_t], [], [], [#include <sys/types.h>])
|
||||
|
||||
# Checks for misc stuff.
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
@@ -175,9 +166,9 @@ AC_ARG_ENABLE(
|
||||
DIST_SUBDIRS_AC='doc windows'
|
||||
|
||||
if test "$enabled_doc" = "yes"; then
|
||||
SUBDIRS_AC='doc'
|
||||
SUBDIRS_AC='doc @WINDOWS_DIRS@'
|
||||
else
|
||||
SUBDIRS_AC=''
|
||||
SUBDIRS_AC='@WINDOWS_DIRS@'
|
||||
fi
|
||||
|
||||
AC_SUBST(DOC_INST_DIR, $DOC_INST_DIR)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ For avrdude version @value{VERSION}, @value{UPDATED}.
|
||||
|
||||
Copyright @copyright{} 2003, 2005 Brian Dean
|
||||
|
||||
Copyright @copyright{} 2006 - 2009 J@"org Wunsch
|
||||
Copyright @copyright{} 2006 J@"org Wunsch
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
@@ -67,7 +67,7 @@ Use @uref{http://savannah.nongnu.org/bugs/?group=avrdude} to report bugs.
|
||||
|
||||
Copyright @copyright{} 2003,2005 Brian S. Dean
|
||||
|
||||
Copyright @copyright{} 2006 - 2008 J@"org Wunsch
|
||||
Copyright @copyright{} 2006 J@"org Wunsch
|
||||
@sp 2
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
@@ -113,7 +113,6 @@ Copyright @copyright{} 2006 J@"org Wunsch
|
||||
* Command Line Options::
|
||||
* Terminal Mode Operation::
|
||||
* Configuration File::
|
||||
* Programmer Specific Information::
|
||||
* Platform Dependent Information::
|
||||
* Troubleshooting::
|
||||
@end menu
|
||||
@@ -144,7 +143,6 @@ programming fuse/lock bits, etc.
|
||||
|
||||
AVRDUDE supports the following basic programmer types: Atmel's STK500,
|
||||
Atmel's AVRISP and AVRISP mkII devices,
|
||||
Atmel's STK600,
|
||||
Atmel's JTAG ICE (both mkI and mkII, the latter also in ISP mode), appnote
|
||||
avr910, appnote avr109 (including the AVR Butterfly),
|
||||
serial bit-bang adapters,
|
||||
@@ -166,10 +164,7 @@ emulated on top of USB is likely to not work at all, or to work
|
||||
abysmally slow.
|
||||
|
||||
The STK500, JTAG ICE, avr910, and avr109/butterfly use the serial port to communicate with the PC.
|
||||
The STK600, JTAG ICE mkII, AVRISP mkII, USBasp, and USBtinyISP
|
||||
programmers communicate through the USB, using @code{libusb} as a
|
||||
platform abstraction layer.
|
||||
The STK500, STK600, JTAG ICE, and avr910 contain on-board logic to control the programming of the target
|
||||
The STK500, JTAG ICE, and avr910 contain on-board logic to control the programming of the target
|
||||
device.
|
||||
The avr109 bootloader implements a protocol similar to avr910, but is
|
||||
actually implemented in the boot area of the target's flash ROM, as
|
||||
@@ -190,10 +185,8 @@ by AVRDUDE.
|
||||
For the JTAG ICE mkII, JTAG, debugWire and ISP mode are supported.
|
||||
See below for the limitations of debugWire.
|
||||
|
||||
The Arduino (which is very similar to the STK500 1.x) is supported via
|
||||
its own programmer type specification ``arduino''.
|
||||
|
||||
The AVR Dragon is supported in all modes (ISP, JTAG, HVSP, PP, debugWire).
|
||||
(High-voltage programming is not yet supported.)
|
||||
When used in JTAG and debugWire mode, the AVR Dragon behaves similar to a
|
||||
JTAG ICE mkII, so all device-specific comments for that device
|
||||
will apply as well.
|
||||
@@ -204,10 +197,10 @@ In particular, the Dragon starts out with a rather fast ISP clock
|
||||
frequency, so the @code{-B @var{bitclock}}
|
||||
option might be required to achieve a stable ISP communication.
|
||||
|
||||
The USBasp ISP and USBtinyISP adapters are also supported, provided AVRDUDE
|
||||
The USBasp ISP adapter is also supported, provided AVRDUDE
|
||||
has been compiled with libusb support.
|
||||
They both feature simple firwmare-only USB implementations, running on
|
||||
an ATmega8 (or ATmega88), or ATtiny2313, respectively.
|
||||
It features a simple firwmare-only USB implementation, running on
|
||||
an ATmega8 (or ATmega88).
|
||||
|
||||
|
||||
@menu
|
||||
@@ -251,14 +244,13 @@ Roth.
|
||||
|
||||
@menu
|
||||
* Option Descriptions::
|
||||
* Programmers accepting extended parameters::
|
||||
* Example Command Line Invocations::
|
||||
@end menu
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Option Descriptions, Programmers accepting extended parameters, Command Line Options, Command Line Options
|
||||
@node Option Descriptions, Example Command Line Invocations, Command Line Options, Command Line Options
|
||||
@section Option Descriptions
|
||||
|
||||
@noindent
|
||||
@@ -300,8 +292,6 @@ Currently, the following MCU types are understood:
|
||||
@item @code{m128} @tab ATmega128
|
||||
@item @code{m1280} @tab ATmega1280
|
||||
@item @code{m1281} @tab ATmega1281
|
||||
@item @code{m1284p} @tab ATmega1284P
|
||||
@item @code{m128rfa1} @tab ATmega128RFA1
|
||||
@item @code{m16} @tab ATmega16
|
||||
@item @code{m161} @tab ATmega161
|
||||
@item @code{m162} @tab ATmega162
|
||||
@@ -332,8 +322,6 @@ Currently, the following MCU types are understood:
|
||||
@item @code{t26} @tab ATtiny26
|
||||
@item @code{t45} @tab ATtiny45
|
||||
@item @code{t85} @tab ATtiny85
|
||||
@item @code{x128a1} @tab ATxmega128A1
|
||||
@item @code{x128a1d} @tab ATxmega128A1revD
|
||||
@end multitable
|
||||
|
||||
(*) The AT90S2323 and ATtiny22 use the same algorithm.
|
||||
@@ -375,11 +363,6 @@ ABCmini Board, aka Dick Smith HOTCHIP
|
||||
@item @code{alf} @tab
|
||||
Nightshade ALF-PgmAVR,@*
|
||||
@url{http://nightshade.homeip.net/}
|
||||
@item @code{arduino}
|
||||
Arduino board, protocol similar to STK500 1.x
|
||||
@item @code{atisp} @tab
|
||||
AT-ISP V1.1 programming cable for AVR-SDK1 from,@*
|
||||
@url{http://micro-research.co.th/}
|
||||
@item @code{avr109} @tab
|
||||
Atmel AppNote AVR109 Boot Loader
|
||||
@item @code{avr910} @tab
|
||||
@@ -388,30 +371,21 @@ Atmel Low Cost Serial Programmer
|
||||
Atmel AppNote AVR911 AVROSP (an alias for avr109)
|
||||
@item @code{avrisp} @tab
|
||||
Atmel AVR ISP (an alias for stk500)
|
||||
@item @code{avrisp2} @tab
|
||||
Atmel AVR ISP mkII (alias for stk500v2)
|
||||
@item @code{avrispmkII} @tab
|
||||
Atmel AVR ISP mkII (alias for stk500v2)
|
||||
@item @code{avrispv2} @tab
|
||||
Atmel AVR ISP, running a version 2.x firmware (an alias for stk500v2)
|
||||
@item @code{avrispmkII} @tab
|
||||
Atmel AVR ISP mkII (alias for stk500v2)
|
||||
@item @code{avrispmk2} @tab
|
||||
Atmel AVR ISP mkII (alias for stk500v2)
|
||||
@item @code{bascom} @tab
|
||||
Bascom SAMPLE programming cable
|
||||
@item @code{blaster} @tab
|
||||
Altera ByteBlaster
|
||||
@item @code{bsd} @tab
|
||||
Brian Dean's Programmer,@*
|
||||
@url{http://www.bsdhome.com/avrdude/}
|
||||
@item @code{butterfly} @tab
|
||||
Atmel Butterfly Development Board
|
||||
@item @code{c2n232i} @tab
|
||||
C2N232I, reset=dtr sck=!rts mosi=!txd miso=!cts,@*
|
||||
@url{http://www.ktverkko.fi/~msmakela/8bit/c2n232/hardware/index.en.html}
|
||||
@item @code{dapa} @tab
|
||||
Direct AVR Parallel Access cable
|
||||
@item @code{dasa} @tab
|
||||
serial port banging, reset=rts sck=dtr mosi=txd miso=cts
|
||||
@item @code{dasa3} @tab
|
||||
serial port banging, reset=!dtr sck=rts mosi=txd miso=cts
|
||||
@item @code{dt006} @tab
|
||||
Dontronics DT006
|
||||
@item @code{dragon_dw} @tab
|
||||
AVR Dragon in debugWire mode
|
||||
@item @code{dragon_hvsp} @tab
|
||||
@@ -422,36 +396,26 @@ AVR Dragon in ISP mode
|
||||
AVR Dragon in JTAG mode
|
||||
@item @code{dragon_pp} @tab
|
||||
AVR Dragon in (high-voltage) parallel programming mode
|
||||
@item @code{dt006} @tab
|
||||
Dontronics DT006
|
||||
@item @code{ere-isp-avr} @tab
|
||||
ERE ISP-AVR,@*
|
||||
@url{http://www.ere.co.th/download/sch050713.pdf}
|
||||
@item @code{frank-stk200}@tab
|
||||
Frank's STK200 clone,@*
|
||||
@url{http://electropol.free.fr/spip/spip.php?article15}
|
||||
@item @code{futurlec} @tab
|
||||
Futurlec.com programming cable
|
||||
@item @code{jtag1} @tab
|
||||
@item @code{frank-stk200} @tab
|
||||
Frank's STK200 clone, @url{http://electropol.free.fr/spip/spip.php?article15}
|
||||
@item @code{jtagmkI} @tab
|
||||
Atmel JTAG ICE mkI, running at 115200 Bd
|
||||
@item @code{jtag1} @tab
|
||||
@emph{Same as before.}
|
||||
@item @code{jtag1slow} @tab
|
||||
Atmel JTAG ICE mkI, running at 19200 Bd
|
||||
@item @code{jtag2slow} @tab
|
||||
@item @code{jtagmkII} @tab
|
||||
Atmel JTAG ICE mkII (default speed 19200 Bd)
|
||||
@item @code{jtag2} @tab
|
||||
Atmel JTAG ICE mkII, running at 115200 Bd
|
||||
@item @code{jtag2slow} @tab
|
||||
@emph{Same as before.}
|
||||
@item @code{jtag2fast} @tab
|
||||
Atmel JTAG ICE mkII, running at 115200 Bd
|
||||
@item @code{jtag2} @tab
|
||||
@emph{Same as before.}
|
||||
@item @code{jtag2isp} @tab
|
||||
Atmel JTAG ICE mkII in ISP mode.
|
||||
@item @code{jtag2dw} @tab
|
||||
Atmel JTAG ICE mkII in debugWire mode.
|
||||
@item @code{jtagmkI} @tab
|
||||
Atmel JTAG ICE mkI, running at 115200 Bd
|
||||
@item @code{jtagmkII} @tab
|
||||
Atmel JTAG ICE mkII (default speed 19200 Bd)
|
||||
@item @code{mib510} @tab
|
||||
Crossbow MIB510 programming board
|
||||
@item @code{pavr} @tab
|
||||
Jason Kyle's pAVR Serial Programmer
|
||||
@item @code{picoweb} @tab
|
||||
@@ -459,39 +423,20 @@ Picoweb Programming Cable,@*
|
||||
@url{http://www.picoweb.net/}
|
||||
@item @code{pony-stk200} @tab
|
||||
Pony Prog STK200
|
||||
@item @code{ponyser} @tab
|
||||
design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts
|
||||
@item @code{siprog} @tab
|
||||
Lancos SI-Prog,@*
|
||||
@url{http://www.lancos.com/siprogsch.html}
|
||||
@item @code{sp12} @tab
|
||||
Steve Bolt's Programmer
|
||||
@item @code{stk200} @tab
|
||||
STK200
|
||||
@item @code{stk500} @tab
|
||||
Atmel STK500, probing for either version 1.x or 2.x firmware
|
||||
@item @code{stk500v1} @tab
|
||||
Atmel STK500, running a version 1.x firmware
|
||||
@item @code{stk500hvsp} @tab
|
||||
Atmel STK500 in high-voltage serial programming mode(version 2.x firmware only)
|
||||
@item @code{stk500pp} @tab
|
||||
Atmel STK500 in parallel programming mode (version 2.xfirmware only)
|
||||
@item @code{stk500v1} @tab
|
||||
Atmel STK500, running a version 1.x firmware
|
||||
@item @code{stk500v2} @tab
|
||||
Atmel STK500, running a version 2.x firmware
|
||||
@item @code{stk600} @tab
|
||||
Atmel STK600 in ISP mode, or in PDI mode for ATxmega devices
|
||||
@item @code{stk600hvsp} @tab
|
||||
Atmel STK600 in high-voltage serial programming mode
|
||||
@item @code{stk600pp} @tab
|
||||
Atmel STK600 in parallel programming mode
|
||||
@item @code{usbasp} @tab
|
||||
USBasp,@*
|
||||
@url{http://www.fischl.de/usbasp/}
|
||||
@item @code{usbtiny} @tab
|
||||
USBtiny simple USB programmer,@*
|
||||
@url{http://www.ladyada.net/make/usbtinyisp/}
|
||||
@item @code{xil} @tab
|
||||
Xilinx JTAG cable
|
||||
@end multitable
|
||||
|
||||
|
||||
@@ -510,18 +455,13 @@ the method of searching for the configuration file for Windows.
|
||||
Disable auto erase for flash. When the -U option with flash memory is
|
||||
specified, avrdude will perform a chip erase before starting any of the
|
||||
programming operations, since it generally is a mistake to program the flash
|
||||
without performing an erase first. This option disables that.
|
||||
Auto erase is not used for ATxmega devices as these devices can
|
||||
use page erase before writing each page so no explicit chip erase
|
||||
is required.
|
||||
Note however that any page not affected by the current operation
|
||||
will retain its previous contents.
|
||||
without performing an erase first. This option disables that. However, to
|
||||
remain backward compatible, the -i, and -m options automatically disable the
|
||||
auto erase feature.
|
||||
|
||||
@item -e
|
||||
Causes a chip erase to be executed. This will reset the contents of the
|
||||
flash ROM and EEPROM to the value `0xff', and clear all lock bits.
|
||||
Except for ATxmega devices which can use page erase,
|
||||
it is basically a
|
||||
flash ROM and EEPROM to the value `0xff', and is basically a
|
||||
prerequisite command before the flash ROM can be reprogrammed again.
|
||||
The only exception would be if the new contents would exclusively cause
|
||||
bits to be programmed from the value `1' to `0'. Note that in order
|
||||
@@ -570,10 +510,6 @@ the part is reasonable before continuing. Since it can happen from time
|
||||
to time that a device has a broken (erased or overwritten) device
|
||||
signature but is otherwise operating normally, this options is provided
|
||||
to override the check.
|
||||
Also, for programmers like the Atmel STK500 and STK600 which can
|
||||
adjust parameters local to the programming tool (independent of an
|
||||
actual connection to a target controller), this option can be used
|
||||
together with @option{-t} to continue in terminal mode.
|
||||
|
||||
@item -i @var{delay}
|
||||
For bitbang-type programmers, delay for approximately
|
||||
@@ -611,12 +547,6 @@ used. See Appendix A, Platform Dependent Information, to find out the
|
||||
default port names for your platform. If you need to use a different
|
||||
parallel or serial port, use this option to specify the alternate port name.
|
||||
|
||||
On Win32 operating systems, the parallel ports are referred to as lpt1
|
||||
through lpt3, referring to the addresses 0x378, 0x278, and 0x3BC,
|
||||
respectively. If the parallel port can be accessed through a different
|
||||
address, this address can be specified directly, using the common C
|
||||
language notation (i. e., hexadecimal values are prefixed by @var{0x}).
|
||||
|
||||
For the JTAG ICE mkII, if AVRDUDE has been built with libusb support,
|
||||
@var{port} may alternatively be specified as
|
||||
@code{usb}[:@var{serialno}]. In that case, the JTAG ICE mkII will be
|
||||
@@ -784,12 +714,6 @@ Enable verbose output.
|
||||
@item -V
|
||||
Disable automatic verify check when uploading data.
|
||||
|
||||
@item -x @var{extended_param}
|
||||
Pass @var{extended_param} to the chosen programmer implementation as
|
||||
an extended parameter. The interpretation of the extended parameter
|
||||
depends on the programmer itself. See below for a list of programmers
|
||||
accepting extended parameters.
|
||||
|
||||
@item -y
|
||||
Tells AVRDUDE to use the last four bytes of the connected parts' EEPROM
|
||||
memory to track the number of times the device has been erased. When
|
||||
@@ -817,52 +741,7 @@ should not be used.
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Programmers accepting extended parameters, Example Command Line Invocations, Option Descriptions, Command Line Options
|
||||
@section Programmers accepting extended parameters
|
||||
|
||||
@table @code
|
||||
|
||||
@item JTAG ICE mkII
|
||||
@itemx AVR Dragon
|
||||
|
||||
When using the JTAG ICE mkII or AVR Dragon in JTAG mode, the
|
||||
following extended parameter is accepted:
|
||||
@table @code
|
||||
@item @samp{jtagchain=UB,UA,BB,BA}
|
||||
Setup the JTAG scan chain for @var{UB} units before, @var{UA} units
|
||||
after, @var{BB} bits before, and @var{BA} bits after the target AVR,
|
||||
respectively.
|
||||
Each AVR unit within the chain shifts by 4 bits.
|
||||
Other JTAG units might require a different bit shift count.
|
||||
@end table
|
||||
|
||||
@item AVR910
|
||||
|
||||
The AVR910 programmer type accepts the following extended parameter:
|
||||
@table @code
|
||||
@item @samp{devcode=VALUE}
|
||||
Override the device code selection by using @var{VALUE}
|
||||
as the device code.
|
||||
The programmer is not queried for the list of supported
|
||||
device codes, and the specified @var{VALUE}
|
||||
is not verified but used directly within the
|
||||
@code{T} command sent to the programmer.
|
||||
@var{VALUE} can be specified using the conventional number notation of the
|
||||
C programming language.
|
||||
@item @samp{no_blockmode}
|
||||
Disables the default checking for block transfer capability.
|
||||
Use
|
||||
@samp{no_blockmode} only if your @samp{AVR910}
|
||||
programmer creates errors during initial sequence.
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@page
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Example Command Line Invocations, , Programmers accepting extended parameters, Command Line Options
|
||||
@node Example Command Line Invocations, , Option Descriptions, Command Line Options
|
||||
@section Example Command Line Invocations
|
||||
|
||||
@noindent
|
||||
@@ -1078,24 +957,16 @@ Perform a chip erase.
|
||||
Send raw instruction codes to the AVR device. If you need access to a
|
||||
feature of an AVR part that is not directly supported by AVRDUDE, this
|
||||
command allows you to use it, even though AVRDUDE does not implement the
|
||||
command. When using direct SPI mode, up to 3 bytes
|
||||
can be omitted.
|
||||
command.
|
||||
|
||||
@item sig
|
||||
Display the device signature bytes.
|
||||
|
||||
@item spi
|
||||
Enter direct SPI mode. The @emph{pgmled} pin acts as slave select.
|
||||
@emph{Only supported on parallel bitbang programmers.}
|
||||
|
||||
@item part
|
||||
Display the current part settings and parameters. Includes chip
|
||||
specific information including all memory types supported by the
|
||||
device, read/write timing, etc.
|
||||
|
||||
@item pgm
|
||||
Return to programming mode (from direct SPI mode).
|
||||
|
||||
@item ?
|
||||
@itemx help
|
||||
Give a short on-line summary of the available commands.
|
||||
@@ -1107,31 +978,28 @@ Leave terminal mode and thus AVRDUDE.
|
||||
|
||||
@noindent
|
||||
In addition, the following commands are supported on the STK500
|
||||
and STK600 programmer:
|
||||
programmer:
|
||||
|
||||
@table @code
|
||||
|
||||
@item vtarg @var{voltage}
|
||||
Set the target's supply voltage to @var{voltage} Volts.
|
||||
|
||||
@item varef [@var{channel}] @var{voltage}
|
||||
@item varef @var{voltage}
|
||||
Set the adjustable voltage source to @var{voltage} Volts.
|
||||
This voltage is normally used to drive the target's
|
||||
@emph{Aref} input on the STK500 and STK600.
|
||||
The STK600 offers two reference voltages, which can be
|
||||
selected by the optional parameter @var{channel} (either
|
||||
0 or 1).
|
||||
@emph{Aref} input on the STK500.
|
||||
|
||||
@item fosc @var{freq}[@code{M}|@code{k}]
|
||||
@item fosc @var{freq}[@var{M}|@var{k}]
|
||||
Set the master oscillator to @var{freq} Hz.
|
||||
An optional trailing letter @code{M}
|
||||
multiplies by 1E6, a trailing letter @code{k} by 1E3.
|
||||
An optional trailing letter @var{M}
|
||||
multiplies by 1E6, a trailing letter @var{k} by 1E3.
|
||||
|
||||
@item fosc off
|
||||
Turn the master oscillator off.
|
||||
|
||||
@item sck @var{period}
|
||||
@emph{STK500 and STK600 only:}
|
||||
@emph{STK500 only:}
|
||||
Set the SCK clock period to @var{period} microseconds.
|
||||
|
||||
@emph{JTAG ICE only:}
|
||||
@@ -1143,7 +1011,7 @@ This parameter can also be used on the JTAG ICE mkII to specify the
|
||||
ISP clock period when operating the ICE in ISP mode.
|
||||
|
||||
@item parms
|
||||
@emph{STK500 and STK600 only:}
|
||||
@emph{STK500 only:}
|
||||
Display the current voltage and master oscillator parameters.
|
||||
|
||||
@emph{JTAG ICE only:}
|
||||
@@ -1258,7 +1126,7 @@ avrdude>
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Configuration File, Programmer Specific Information, Terminal Mode Operation, Top
|
||||
@node Configuration File, Platform Dependent Information, Terminal Mode Operation, Top
|
||||
@chapter Configuration File
|
||||
|
||||
@noindent
|
||||
@@ -1499,87 +1367,11 @@ functionality does not make sense for these boot loaders.
|
||||
|
||||
@end itemize
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Programmer Specific Information, Platform Dependent Information, Configuration File, Top
|
||||
@chapter Programmer Specific Information
|
||||
|
||||
@menu
|
||||
* Atmel STK600::
|
||||
@end menu
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Atmel STK600, , Programmer Specific Information, Programmer Specific Information
|
||||
@section Atmel STK600
|
||||
|
||||
@c
|
||||
@c Update the table below by running the tools/get-stk600-devices.xsl
|
||||
@c XSLT transformation on targetboard.xml as shipped by the latest
|
||||
@c release of AVR Studio.
|
||||
@c
|
||||
The following devices are supported by the respective STK600 routing
|
||||
and socket card:
|
||||
|
||||
@multitable @columnfractions .25 .25 .5
|
||||
@headitem Routing card @tab Socket card @tab Devices
|
||||
@item @code{STK600-RC008T-2} @tab @code{STK600-DIP} @tab ATtiny11 ATtiny12 ATtiny13 ATtiny25 ATtiny45 ATtiny85
|
||||
@item @code{STK600-RC008T-7} @tab @code{STK600-DIP} @tab ATtiny15
|
||||
@item @code{STK600-RC020T-1} @tab @code{STK600-DIP} @tab ATtiny2313
|
||||
@item @code{} @tab @code{STK600-TinyX3U} @tab ATtiny43U
|
||||
@item @code{STK600-RC014T-12} @tab @code{STK600-DIP} @tab ATtiny24 ATtiny44 ATtiny84
|
||||
@item @code{STK600-RC020T-8} @tab @code{STK600-DIP} @tab ATtiny26 ATtiny261 ATtiny461 ATtiny861
|
||||
@item @code{STK600-RC020T-23} @tab @code{STK600-SOIC} @tab ATtiny167
|
||||
@item @code{STK600-RC028T-3} @tab @code{STK600-DIP} @tab ATtiny28
|
||||
@item @code{STK600-RC028M-6} @tab @code{STK600-DIP} @tab ATtiny48 ATtiny88 ATmega8 ATmega48 ATmega88 ATmega168 ATmega48P ATmega88P ATmega168P ATmega328P
|
||||
@item @code{STK600-RC040M-4} @tab @code{STK600-DIP} @tab ATmega8515 ATmega162
|
||||
@item @code{STK600-RC040M-5} @tab @code{STK600-DIP} @tab ATmega8535 ATmega16 ATmega32 ATmega164P ATmega324P ATmega644 ATmega644P ATmega1284P
|
||||
@item @code{STK600-RC064M-9} @tab @code{STK600-TQFP64} @tab ATmega64 ATmega128 ATmega1281 ATmega2561 AT90CAN32 AT90CAN64 AT90CAN128
|
||||
@item @code{STK600-RC064M-10} @tab @code{STK600-TQFP64} @tab ATmega165 ATmega165P ATmega169 ATmega169P ATmega325 ATmega325P ATmega329 ATmega329P ATmega645 ATmega649
|
||||
@item @code{STK600-RC100M-11} @tab @code{STK600-TQFP100} @tab ATmega640 ATmega1280 ATmega2560
|
||||
@item @code{} @tab @code{STK600-ATMEGA2560} @tab ATmega2560
|
||||
@item @code{STK600-RC100M-18} @tab @code{STK600-TQFP100} @tab ATmega3250 ATmega3250P ATmega3290 ATmega3290P ATmega6450 ATmega6490
|
||||
@item @code{STK600-RC32U-20} @tab @code{STK600-TQFP32} @tab AT90USB82 AT90USB162
|
||||
@item @code{STK600-RC044U-25} @tab @code{STK600-TQFP44} @tab ATmega32U4
|
||||
@item @code{STK600-RC064U-17} @tab @code{STK600-TQFP64} @tab AT90USB646 AT90USB1286 AT90USB647 AT90USB1287
|
||||
@item @code{STK600-RCPWM-22} @tab @code{STK600-TQFP32} @tab ATmega32C1 ATmega32M1
|
||||
@item @code{STK600-RCPWM-19} @tab @code{STK600-SOIC} @tab AT90PWM2 AT90PWM3 AT90PWM2B AT90PWM3B AT90PWM216 AT90PWM316
|
||||
@item @code{STK600-RC044M-24} @tab @code{STK600-TSSOP44} @tab ATmega32HVB
|
||||
@item @code{STK600-RC100X-13} @tab @code{STK600-TQFP100} @tab ATxmega128A1 ATxmega128A1_revD ATxmega64A1
|
||||
@item @code{} @tab @code{STK600-uC3-144} @tab AT32UC3A0512 AT32UC3A0256 AT32UC3A0128
|
||||
@item @code{STK600-RCuC3B0-21} @tab @code{STK600-TQFP64-2} @tab AT32UC3B0256 AT32UC3B0128 AT32UC3B064
|
||||
@end multitable
|
||||
|
||||
Ensure the correct socket and routing card are mounted @emph{before}
|
||||
powering on the STK600. While the STK600 firmware ensures the socket
|
||||
and routing card mounted match each other (using a table stored
|
||||
internally in nonvolatile memory), it cannot handle the case where a
|
||||
wrong routing card is used, e. g. the routing card
|
||||
@code{STK600-RC040M-5} (which is meant for 40-pin DIP AVRs that have
|
||||
an ADC, with the power supply pins in the center of the package) was
|
||||
used but an ATmega8515 inserted (which uses the ``industry standard''
|
||||
pinout with Vcc and GND at opposite corners).
|
||||
|
||||
Note that for devices that use the routing card @code{STK600-RC008T-2},
|
||||
in order to use ISP mode, the jumper for @code{AREF0} must be removed
|
||||
as it would otherwise block one of the ISP signals. High-voltage
|
||||
serial programming can be used even with that jumper installed.
|
||||
|
||||
The ISP system of the STK600 contains a detection against shortcuts
|
||||
and other wiring errors. AVRDUDE initiates a connection check before
|
||||
trying to enter ISP programming mode, and display the result if the
|
||||
target is not found ready to be ISP programmed.
|
||||
|
||||
High-voltage programming requires the target voltage to be set to at
|
||||
least 4.5 V in order to work. This can be done using
|
||||
@emph{Terminal Mode}, see @ref{Terminal Mode Operation}.
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Platform Dependent Information, Troubleshooting, Programmer Specific Information, Top
|
||||
@node Platform Dependent Information, Troubleshooting, Configuration File, Top
|
||||
@appendix Platform Dependent Information
|
||||
|
||||
@menu
|
||||
@@ -1903,7 +1695,7 @@ Windows serial port device names such as: com1, com2, etc.
|
||||
@subsubsection Parallel Ports
|
||||
|
||||
@noindent
|
||||
AVRDUDE will accept 3 Windows parallel port names: lpt1, lpt2, or
|
||||
AVRDUDE will only accept 3 Windows parallel port names: lpt1, lpt2, or
|
||||
lpt3. Each of these names corresponds to a fixed parallel port base
|
||||
address:
|
||||
|
||||
@@ -1924,9 +1716,6 @@ using a laptop, you might have to use lpt3 instead of lpt1. Select the
|
||||
name of the port the corresponds to the base address of the parallel
|
||||
port that you want.
|
||||
|
||||
If the parallel port can be accessed through a different
|
||||
address, this address can be specified directly, using the common C
|
||||
language notation (i. e., hexadecimal values are prefixed by @code{0x}).
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@@ -2097,7 +1886,7 @@ programming works, and is documented that way in the Atmel AVR
|
||||
datasheets.
|
||||
In order to successfully program the EEPROM that way, a prior chip
|
||||
erase (with the EESAVE fuse unprogrammed) is required.
|
||||
This also applies to the STK500 and STK600 in high-voltage programming mode.
|
||||
This also applies to the STK500 in high-voltage programming mode.
|
||||
|
||||
@item
|
||||
Problem: How do I turn off the @var{DWEN} fuse?
|
||||
@@ -2143,12 +1932,12 @@ The pin mapping for the JTAG-to-ISP adapter is:
|
||||
@end multitable
|
||||
|
||||
@item
|
||||
Problem: Multiple USBasp or USBtinyISP programmers connected simultaneously are not
|
||||
Problem: Multiple USBasp programmers connected simultaneously are not
|
||||
found.
|
||||
|
||||
Solution: none at this time. The simplicity of these programmers
|
||||
Solution: none at this time. The simplicity of the USBasp programmer
|
||||
doesn't offer a method to distinguish multiple programmers that are
|
||||
connected simultaneously, so effectively only one of them is supported.
|
||||
connected simultaneously, so effectively only one USBasp is supported.
|
||||
|
||||
@item
|
||||
Problem: I cannot do @dots{} when the target is in debugWire mode.
|
||||
|
||||
@@ -743,10 +743,6 @@ static int fileio_imm(struct fioparms * fio,
|
||||
p = strtok(filename, " ,");
|
||||
while (p != NULL && loc < size) {
|
||||
b = strtoul(p, &e, 0);
|
||||
/* check for binary formated (0b10101001) strings */
|
||||
b = (strncmp (p, "0b", 2))?
|
||||
strtoul (p, &e, 0):
|
||||
strtoul (p + 2, &e, 2);
|
||||
if (*e != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: invalid byte value (%s) specified for immediate mode\n",
|
||||
@@ -969,10 +965,8 @@ static int fmt_autodetect(char * fname)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
fclose(f);
|
||||
if (found)
|
||||
return FMT_RBIN;
|
||||
}
|
||||
|
||||
/* check for lines that look like intel hex */
|
||||
if ((buf[0] == ':') && (len >= 11)) {
|
||||
@@ -983,10 +977,8 @@ static int fmt_autodetect(char * fname)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
fclose(f);
|
||||
if (found)
|
||||
return FMT_IHEX;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for lines that look like motorola s-record */
|
||||
@@ -998,14 +990,11 @@ static int fmt_autodetect(char * fname)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
fclose(f);
|
||||
if (found)
|
||||
return FMT_SREC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1150,9 +1139,7 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
rc = avr_mem_hiaddr(mem);
|
||||
}
|
||||
}
|
||||
if (format != FMT_IMM && !using_stdio) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2005, 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright (C) 2005 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -41,29 +41,24 @@
|
||||
#include "serial.h"
|
||||
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
* XXX There should really be a programmer-specific private data
|
||||
* pointer in struct PROGRAMMER.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
int initial_baudrate;
|
||||
static int initial_baudrate;
|
||||
|
||||
/*
|
||||
* See jtagmkI_read_byte() for an explanation of the flash and
|
||||
* EEPROM page caches.
|
||||
*/
|
||||
unsigned char *flash_pagecache;
|
||||
unsigned long flash_pageaddr;
|
||||
unsigned int flash_pagesize;
|
||||
/*
|
||||
* See jtagmkI_read_byte() for an explanation of the flash and
|
||||
* EEPROM page caches.
|
||||
*/
|
||||
static unsigned char *flash_pagecache;
|
||||
static unsigned long flash_pageaddr;
|
||||
static unsigned int flash_pagesize;
|
||||
|
||||
unsigned char *eeprom_pagecache;
|
||||
unsigned long eeprom_pageaddr;
|
||||
unsigned int eeprom_pagesize;
|
||||
|
||||
int prog_enabled; /* Cached value of PROGRAMMING status. */
|
||||
};
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
static unsigned char *eeprom_pagecache;
|
||||
static unsigned long eeprom_pageaddr;
|
||||
static unsigned int eeprom_pagesize;
|
||||
|
||||
static int prog_enabled; /* Cached value of PROGRAMMING status. */
|
||||
/*
|
||||
* The OCDEN fuse is bit 7 of the high fuse (hfuse). In order to
|
||||
* perform memory operations on MTYPE_SPM and MTYPE_EEPROM, OCDEN
|
||||
@@ -109,23 +104,6 @@ static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p);
|
||||
|
||||
static int jtagmkI_resync(PROGRAMMER *pgm, int maxtries, int signon);
|
||||
|
||||
static void jtagmkI_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkI_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
}
|
||||
|
||||
static void jtagmkI_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
u32_to_b3(unsigned char *b, unsigned long l)
|
||||
{
|
||||
@@ -200,7 +178,7 @@ static int jtagmkI_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
unsigned char *buf;
|
||||
|
||||
if (verbose >= 3)
|
||||
fprintf(stderr, "\n%s: jtagmkI_send(): sending %u bytes\n",
|
||||
fprintf(stderr, "\n%s: jtagmkI_send(): sending %zd bytes\n",
|
||||
progname, len);
|
||||
|
||||
if ((buf = malloc(len + 2)) == NULL)
|
||||
@@ -403,10 +381,10 @@ static void jtagmkI_set_devdescr(PROGRAMMER * pgm, AVRPART * p)
|
||||
for (ln = lfirst(p->mem); ln; ln = lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
PDATA(pgm)->flash_pagesize = m->page_size;
|
||||
u16_to_b2(sendbuf.dd.uiFlashPageSize, PDATA(pgm)->flash_pagesize);
|
||||
flash_pagesize = m->page_size;
|
||||
u16_to_b2(sendbuf.dd.uiFlashPageSize, flash_pagesize);
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
sendbuf.dd.ucEepromPageSize = PDATA(pgm)->eeprom_pagesize = m->page_size;
|
||||
sendbuf.dd.ucEepromPageSize = eeprom_pagesize = m->page_size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,7 +448,7 @@ static int jtagmkI_program_enable(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char buf[1], resp[2];
|
||||
|
||||
if (PDATA(pgm)->prog_enabled)
|
||||
if (prog_enabled)
|
||||
return 0;
|
||||
|
||||
buf[0] = CMD_ENTER_PROGMODE;
|
||||
@@ -494,7 +472,7 @@ static int jtagmkI_program_enable(PROGRAMMER * pgm)
|
||||
fprintf(stderr, "OK\n");
|
||||
}
|
||||
|
||||
PDATA(pgm)->prog_enabled = 1;
|
||||
prog_enabled = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -503,7 +481,7 @@ static int jtagmkI_program_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char buf[1], resp[2];
|
||||
|
||||
if (!PDATA(pgm)->prog_enabled)
|
||||
if (!prog_enabled)
|
||||
return 0;
|
||||
|
||||
if (pgm->fd.ifd != -1) {
|
||||
@@ -528,7 +506,7 @@ static int jtagmkI_program_disable(PROGRAMMER * pgm)
|
||||
fprintf(stderr, "OK\n");
|
||||
}
|
||||
}
|
||||
PDATA(pgm)->prog_enabled = 0;
|
||||
prog_enabled = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -550,7 +528,7 @@ static unsigned char jtagmkI_get_baud(long baud)
|
||||
static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
AVRMEM hfuse;
|
||||
unsigned char cmd[1], resp[5];
|
||||
char cmd[1], resp[5];
|
||||
unsigned char b;
|
||||
|
||||
if (!(p->flags & AVRPART_HAS_JTAG)) {
|
||||
@@ -561,7 +539,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
jtagmkI_drain(pgm, 0);
|
||||
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) {
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && initial_baudrate != pgm->baudrate) {
|
||||
if ((b = jtagmkI_get_baud(pgm->baudrate)) == 0) {
|
||||
fprintf(stderr, "%s: jtagmkI_initialize(): unsupported baudrate %d\n",
|
||||
progname, pgm->baudrate);
|
||||
@@ -571,7 +549,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
"trying to set baudrate to %d\n",
|
||||
progname, pgm->baudrate);
|
||||
if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
|
||||
PDATA(pgm)->initial_baudrate = pgm->baudrate; /* don't adjust again later */
|
||||
initial_baudrate = pgm->baudrate; /* don't adjust again later */
|
||||
serial_setspeed(&pgm->fd, pgm->baudrate);
|
||||
}
|
||||
}
|
||||
@@ -606,24 +584,24 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
*/
|
||||
jtagmkI_set_devdescr(pgm, p);
|
||||
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_LOW, PDATA(pgm)->flash_pagesize & 0xff);
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_HIGH, PDATA(pgm)->flash_pagesize >> 8);
|
||||
jtagmkI_setparm(pgm, PARM_EEPROM_PAGESIZE, PDATA(pgm)->eeprom_pagesize & 0xff);
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_LOW, flash_pagesize & 0xff);
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_HIGH, flash_pagesize >> 8);
|
||||
jtagmkI_setparm(pgm, PARM_EEPROM_PAGESIZE, eeprom_pagesize & 0xff);
|
||||
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
free(PDATA(pgm)->eeprom_pagecache);
|
||||
if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
|
||||
free(flash_pagecache);
|
||||
free(eeprom_pagecache);
|
||||
if ((flash_pagecache = malloc(flash_pagesize)) == NULL) {
|
||||
fprintf(stderr, "%s: jtagmkI_initialize(): Out of memory\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
|
||||
if ((eeprom_pagecache = malloc(eeprom_pagesize)) == NULL) {
|
||||
fprintf(stderr, "%s: jtagmkI_initialize(): Out of memory\n",
|
||||
progname);
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
free(flash_pagecache);
|
||||
return -1;
|
||||
}
|
||||
PDATA(pgm)->flash_pageaddr = PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
flash_pageaddr = eeprom_pageaddr = (unsigned long)-1L;
|
||||
|
||||
if (jtagmkI_reset(pgm) < 0)
|
||||
return -1;
|
||||
@@ -644,10 +622,10 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
static void jtagmkI_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
PDATA(pgm)->flash_pagecache = NULL;
|
||||
free(PDATA(pgm)->eeprom_pagecache);
|
||||
PDATA(pgm)->eeprom_pagecache = NULL;
|
||||
free(flash_pagecache);
|
||||
flash_pagecache = NULL;
|
||||
free(eeprom_pagecache);
|
||||
eeprom_pagecache = NULL;
|
||||
|
||||
(void)jtagmkI_program_disable(pgm);
|
||||
}
|
||||
@@ -666,7 +644,7 @@ static int jtagmkI_open(PROGRAMMER * pgm, char * port)
|
||||
fprintf(stderr, "%s: jtagmkI_open()\n", progname);
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
PDATA(pgm)->initial_baudrate = -1L;
|
||||
initial_baudrate = -1L;
|
||||
|
||||
for (i = 0; i < sizeof(baudtab) / sizeof(baudtab[0]); i++) {
|
||||
if (verbose >= 2)
|
||||
@@ -681,7 +659,7 @@ static int jtagmkI_open(PROGRAMMER * pgm, char * port)
|
||||
jtagmkI_drain(pgm, 0);
|
||||
|
||||
if (jtagmkI_getsync(pgm) == 0) {
|
||||
PDATA(pgm)->initial_baudrate = baudtab[i].baud;
|
||||
initial_baudrate = baudtab[i].baud;
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkI_open(): succeeded\n", progname);
|
||||
return 0;
|
||||
@@ -711,15 +689,15 @@ static void jtagmkI_close(PROGRAMMER * pgm)
|
||||
* appears to make AVR Studio happier when it is about to access the
|
||||
* ICE later on.
|
||||
*/
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) {
|
||||
if ((b = jtagmkI_get_baud(PDATA(pgm)->initial_baudrate)) == 0) {
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && initial_baudrate != pgm->baudrate) {
|
||||
if ((b = jtagmkI_get_baud(initial_baudrate)) == 0) {
|
||||
fprintf(stderr, "%s: jtagmkI_close(): unsupported baudrate %d\n",
|
||||
progname, PDATA(pgm)->initial_baudrate);
|
||||
progname, initial_baudrate);
|
||||
} else {
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkI_close(): "
|
||||
"trying to set baudrate to %d\n",
|
||||
progname, PDATA(pgm)->initial_baudrate);
|
||||
progname, initial_baudrate);
|
||||
if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
|
||||
serial_setspeed(&pgm->fd, pgm->baudrate);
|
||||
}
|
||||
@@ -768,13 +746,13 @@ static int jtagmkI_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
cmd[0] = CMD_WRITE_MEM;
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd[1] = MTYPE_FLASH_PAGE;
|
||||
PDATA(pgm)->flash_pageaddr = (unsigned long)-1L;
|
||||
page_size = PDATA(pgm)->flash_pagesize;
|
||||
flash_pageaddr = (unsigned long)-1L;
|
||||
page_size = flash_pagesize;
|
||||
is_flash = 1;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM_PAGE;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
page_size = PDATA(pgm)->eeprom_pagesize;
|
||||
eeprom_pageaddr = (unsigned long)-1L;
|
||||
page_size = eeprom_pagesize;
|
||||
}
|
||||
datacmd[0] = CMD_DATA;
|
||||
|
||||
@@ -990,15 +968,15 @@ static int jtagmkI_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
cmd[1] = MTYPE_FLASH_PAGE;
|
||||
pagesize = mem->page_size;
|
||||
paddr = addr & ~(pagesize - 1);
|
||||
paddr_ptr = &PDATA(pgm)->flash_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->flash_pagecache;
|
||||
paddr_ptr = &flash_pageaddr;
|
||||
cache_ptr = flash_pagecache;
|
||||
is_flash = 1;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM_PAGE;
|
||||
pagesize = mem->page_size;
|
||||
paddr = addr & ~(pagesize - 1);
|
||||
paddr_ptr = &PDATA(pgm)->eeprom_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->eeprom_pagecache;
|
||||
paddr_ptr = &eeprom_pageaddr;
|
||||
cache_ptr = eeprom_pagecache;
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
addr = 0;
|
||||
@@ -1100,11 +1078,11 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
cmd[1] = MTYPE_SPM;
|
||||
need_progmode = 0;
|
||||
PDATA(pgm)->flash_pageaddr = (unsigned long)-1L;
|
||||
flash_pageaddr = (unsigned long)-1L;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM;
|
||||
need_progmode = 0;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
eeprom_pageaddr = (unsigned long)-1L;
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
addr = 0;
|
||||
@@ -1396,7 +1374,5 @@ void jtagmkI_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_load = jtagmkI_paged_load;
|
||||
pgm->print_parms = jtagmkI_print_parms;
|
||||
pgm->set_sck_period = jtagmkI_set_sck_period;
|
||||
pgm->setup = jtagmkI_setup;
|
||||
pgm->teardown = jtagmkI_teardown;
|
||||
pgm->page_size = 256;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2005-2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright (C) 2005,2006 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* Derived from stk500 code which is:
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
@@ -52,36 +52,25 @@
|
||||
|
||||
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
* XXX There should really be a programmer-specific private data
|
||||
* pointer in struct PROGRAMMER.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
unsigned short command_sequence; /* Next cmd seqno to issue. */
|
||||
static unsigned short command_sequence; /* Next cmd seqno to issue. */
|
||||
|
||||
/*
|
||||
* See jtagmkII_read_byte() for an explanation of the flash and
|
||||
* EEPROM page caches.
|
||||
*/
|
||||
unsigned char *flash_pagecache;
|
||||
unsigned long flash_pageaddr;
|
||||
unsigned int flash_pagesize;
|
||||
/*
|
||||
* See jtagmkII_read_byte() for an explanation of the flash and
|
||||
* EEPROM page caches.
|
||||
*/
|
||||
static unsigned char *flash_pagecache;
|
||||
static unsigned long flash_pageaddr;
|
||||
static unsigned int flash_pagesize;
|
||||
|
||||
unsigned char *eeprom_pagecache;
|
||||
unsigned long eeprom_pageaddr;
|
||||
unsigned int eeprom_pagesize;
|
||||
|
||||
int prog_enabled; /* Cached value of PROGRAMMING status. */
|
||||
unsigned char serno[6]; /* JTAG ICE serial number. */
|
||||
|
||||
/* JTAG chain stuff */
|
||||
unsigned char jtagchain[4];
|
||||
|
||||
/* The length of the device descriptor is firmware-dependent. */
|
||||
size_t device_descriptor_length;
|
||||
};
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
static unsigned char *eeprom_pagecache;
|
||||
static unsigned long eeprom_pageaddr;
|
||||
static unsigned int eeprom_pagesize;
|
||||
|
||||
static int prog_enabled; /* Cached value of PROGRAMMING status. */
|
||||
static unsigned char serno[6]; /* JTAG ICE serial number. */
|
||||
/*
|
||||
* The OCDEN fuse is bit 7 of the high fuse (hfuse). In order to
|
||||
* perform memory operations on MTYPE_SPM and MTYPE_EEPROM, OCDEN
|
||||
@@ -120,6 +109,9 @@ static struct {
|
||||
*/
|
||||
#define PGM_FL_IS_DW (0x0001)
|
||||
|
||||
/* The length of the device descriptor is firmware-dependent. */
|
||||
static size_t device_descriptor_length;
|
||||
|
||||
static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char * value);
|
||||
static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
@@ -128,24 +120,7 @@ static int jtagmkII_reset(PROGRAMMER * pgm, unsigned char flags);
|
||||
static int jtagmkII_set_sck_period(PROGRAMMER * pgm, double v);
|
||||
static int jtagmkII_setparm(PROGRAMMER * pgm, unsigned char parm,
|
||||
unsigned char * value);
|
||||
static void jtagmkII_print_parms1(PROGRAMMER * pgm, const char * p);
|
||||
|
||||
void jtagmkII_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
}
|
||||
|
||||
void jtagmkII_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
static void jtagmkII_print_parms1(PROGRAMMER * pgm, char * p);
|
||||
|
||||
static unsigned long
|
||||
b4_to_u32(unsigned char *b)
|
||||
@@ -261,7 +236,6 @@ static void jtagmkII_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
case EMULATOR_MODE_JTAG: fprintf(stderr, ": JTAG"); break;
|
||||
case EMULATOR_MODE_HV: fprintf(stderr, ": HVSP/PP"); break;
|
||||
case EMULATOR_MODE_SPI: fprintf(stderr, ": SPI"); break;
|
||||
case EMULATOR_MODE_JTAG_XMEGA: fprintf(stderr, ": JTAG/Xmega"); break;
|
||||
}
|
||||
putc('\n', stderr);
|
||||
break;
|
||||
@@ -364,7 +338,7 @@ int jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
unsigned char *buf;
|
||||
|
||||
if (verbose >= 3)
|
||||
fprintf(stderr, "\n%s: jtagmkII_send(): sending %u bytes\n",
|
||||
fprintf(stderr, "\n%s: jtagmkII_send(): sending %zd bytes\n",
|
||||
progname, len);
|
||||
|
||||
if ((buf = malloc(len + 10)) == NULL)
|
||||
@@ -375,7 +349,7 @@ int jtagmkII_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
}
|
||||
|
||||
buf[0] = MESSAGE_START;
|
||||
u16_to_b2(buf + 1, PDATA(pgm)->command_sequence);
|
||||
u16_to_b2(buf + 1, command_sequence);
|
||||
u32_to_b4(buf + 3, len);
|
||||
buf[7] = TOKEN;
|
||||
memcpy(buf + 8, data, len);
|
||||
@@ -571,10 +545,10 @@ int jtagmkII_recv(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
if (verbose >= 3)
|
||||
fprintf(stderr, "%s: jtagmkII_recv(): "
|
||||
"Got message seqno %d (command_sequence == %d)\n",
|
||||
progname, r_seqno, PDATA(pgm)->command_sequence);
|
||||
if (r_seqno == PDATA(pgm)->command_sequence) {
|
||||
if (++(PDATA(pgm)->command_sequence) == 0xffff)
|
||||
PDATA(pgm)->command_sequence = 0;
|
||||
progname, r_seqno, command_sequence);
|
||||
if (r_seqno == command_sequence) {
|
||||
if (++command_sequence == 0xffff)
|
||||
command_sequence = 0;
|
||||
/*
|
||||
* We move the payload to the beginning of the buffer, to make
|
||||
* the job easier for the caller. We have to return the
|
||||
@@ -591,10 +565,11 @@ int jtagmkII_recv(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkII_recv(): "
|
||||
"got wrong sequence number, %u != %u\n",
|
||||
progname, r_seqno, PDATA(pgm)->command_sequence);
|
||||
progname, r_seqno, command_sequence);
|
||||
}
|
||||
free(*msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -632,7 +607,7 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||
if ((c = resp[0]) == RSP_SIGN_ON) {
|
||||
fwver = ((unsigned)resp[8] << 8) | (unsigned)resp[7];
|
||||
hwver = (unsigned)resp[9];
|
||||
memcpy(PDATA(pgm)->serno, resp + 10, 6);
|
||||
memcpy(serno, resp + 10, 6);
|
||||
if (verbose >= 1 && status > 17) {
|
||||
fprintf(stderr, "JTAG ICE mkII sign-on message:\n");
|
||||
fprintf(stderr, "Communications protocol version: %u\n",
|
||||
@@ -653,7 +628,7 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||
(unsigned)resp[9]);
|
||||
fprintf(stderr, "Serial number: "
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
PDATA(pgm)->serno[0], PDATA(pgm)->serno[1], PDATA(pgm)->serno[2], PDATA(pgm)->serno[3], PDATA(pgm)->serno[4], PDATA(pgm)->serno[5]);
|
||||
serno[0], serno[1], serno[2], serno[3], serno[4], serno[5]);
|
||||
resp[status - 1] = '\0';
|
||||
fprintf(stderr, "Device ID: %s\n",
|
||||
resp + 16);
|
||||
@@ -677,7 +652,7 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
PDATA(pgm)->device_descriptor_length = sizeof(struct device_descriptor);
|
||||
device_descriptor_length = sizeof(struct device_descriptor);
|
||||
/*
|
||||
* There's no official documentation from Atmel about what firmware
|
||||
* revision matches what device descriptor length. The algorithm
|
||||
@@ -689,20 +664,20 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||
*/
|
||||
#define FWVER(maj, min) ((maj << 8) | (min))
|
||||
if (hwver == 0 && fwver < FWVER(3, 16)) {
|
||||
PDATA(pgm)->device_descriptor_length -= 2;
|
||||
device_descriptor_length -= 2;
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_getsync(): "
|
||||
"S_MCU firmware version might be too old to work correctly\n",
|
||||
progname);
|
||||
} else if (hwver == 0 && fwver < FWVER(4, 0)) {
|
||||
PDATA(pgm)->device_descriptor_length -= 2;
|
||||
device_descriptor_length -= 2;
|
||||
}
|
||||
if (verbose >= 2 && mode != EMULATOR_MODE_SPI)
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_getsync(): Using a %zu-byte device descriptor\n",
|
||||
progname, PDATA(pgm)->device_descriptor_length);
|
||||
progname, device_descriptor_length);
|
||||
if (mode == EMULATOR_MODE_SPI || mode == EMULATOR_MODE_HV) {
|
||||
PDATA(pgm)->device_descriptor_length = 0;
|
||||
device_descriptor_length = 0;
|
||||
if (hwver == 0 && fwver < FWVER(4, 14)) {
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_getsync(): ISP functionality requires firmware "
|
||||
@@ -864,27 +839,25 @@ static void jtagmkII_set_devdescr(PROGRAMMER * pgm, AVRPART * p)
|
||||
for (ln = lfirst(p->mem); ln; ln = lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
PDATA(pgm)->flash_pagesize = m->page_size;
|
||||
flash_pagesize = m->page_size;
|
||||
u32_to_b4(sendbuf.dd.ulFlashSize, m->size);
|
||||
u16_to_b2(sendbuf.dd.uiFlashPageSize, PDATA(pgm)->flash_pagesize);
|
||||
u16_to_b2(sendbuf.dd.uiFlashpages, m->size / PDATA(pgm)->flash_pagesize);
|
||||
u16_to_b2(sendbuf.dd.uiFlashPageSize, flash_pagesize);
|
||||
u16_to_b2(sendbuf.dd.uiFlashpages, m->size / flash_pagesize);
|
||||
if (p->flags & AVRPART_HAS_DW) {
|
||||
memcpy(sendbuf.dd.ucFlashInst, p->flash_instr, FLASH_INSTR_SIZE);
|
||||
memcpy(sendbuf.dd.ucEepromInst, p->eeprom_instr, EEPROM_INSTR_SIZE);
|
||||
}
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
sendbuf.dd.ucEepromPageSize = PDATA(pgm)->eeprom_pagesize = m->page_size;
|
||||
sendbuf.dd.ucEepromPageSize = eeprom_pagesize = m->page_size;
|
||||
}
|
||||
}
|
||||
sendbuf.dd.ucCacheType =
|
||||
(p->flags & AVRPART_HAS_PDI)? 0x02 /* ATxmega */: 0x00;
|
||||
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkII_set_devdescr(): "
|
||||
"Sending set device descriptor command: ",
|
||||
progname);
|
||||
jtagmkII_send(pgm, (unsigned char *)&sendbuf,
|
||||
PDATA(pgm)->device_descriptor_length + sizeof(unsigned char));
|
||||
device_descriptor_length + sizeof(unsigned char));
|
||||
|
||||
status = jtagmkII_recv(pgm, &resp);
|
||||
if (status <= 0) {
|
||||
@@ -975,7 +948,7 @@ static int jtagmkII_program_enable(PROGRAMMER * pgm)
|
||||
int status;
|
||||
unsigned char buf[1], *resp, c;
|
||||
|
||||
if (PDATA(pgm)->prog_enabled)
|
||||
if (prog_enabled)
|
||||
return 0;
|
||||
|
||||
buf[0] = CMND_ENTER_PROGMODE;
|
||||
@@ -1012,55 +985,16 @@ static int jtagmkII_program_enable(PROGRAMMER * pgm)
|
||||
return -1;
|
||||
}
|
||||
|
||||
PDATA(pgm)->prog_enabled = 1;
|
||||
prog_enabled = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int jtagmkII_pre_write(PROGRAMMER * pgm)
|
||||
{
|
||||
int status;
|
||||
unsigned char *resp, c;
|
||||
unsigned char buf[] = { CMND_0x34, 0x0, 0x0, 0x0, 0x0, 0x0 };
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkII_pre_write(): Sending pre-write command: ",
|
||||
progname);
|
||||
jtagmkII_send(pgm, buf, 6);
|
||||
|
||||
status = jtagmkII_recv(pgm, &resp);
|
||||
if (status <= 0) {
|
||||
if (verbose >= 2)
|
||||
putc('\n', stderr);
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_pre_write(): "
|
||||
"timeout/error communicating with programmer (status %d)\n",
|
||||
progname, status);
|
||||
return -1;
|
||||
}
|
||||
if (verbose >= 3) {
|
||||
putc('\n', stderr);
|
||||
jtagmkII_prmsg(pgm, resp, status);
|
||||
} else if (verbose == 2)
|
||||
fprintf(stderr, "0x%02x (%d bytes msg)\n", resp[0], status);
|
||||
c = resp[0];
|
||||
free(resp);
|
||||
if (c != RSP_OK) {
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_pre_write(): "
|
||||
"bad response to pre_write command: %s\n",
|
||||
progname, jtagmkII_get_rc(c));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int jtagmkII_program_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
int status;
|
||||
unsigned char buf[1], *resp, c;
|
||||
|
||||
if (!PDATA(pgm)->prog_enabled)
|
||||
if (!prog_enabled)
|
||||
return 0;
|
||||
|
||||
buf[0] = CMND_LEAVE_PROGMODE;
|
||||
@@ -1095,7 +1029,7 @@ static int jtagmkII_program_disable(PROGRAMMER * pgm)
|
||||
return -1;
|
||||
}
|
||||
|
||||
PDATA(pgm)->prog_enabled = 0;
|
||||
prog_enabled = 0;
|
||||
(void)jtagmkII_reset(pgm, 0x01);
|
||||
|
||||
return 0;
|
||||
@@ -1174,38 +1108,25 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (jtagmkII_setparm(pgm, PAR_DAISY_CHAIN_INFO, PDATA(pgm)->jtagchain) < 0) {
|
||||
fprintf(stderr, "%s: jtagmkII_initialize(): Failed to setup JTAG chain\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Must set the device descriptor before entering programming mode.
|
||||
*/
|
||||
jtagmkII_set_devdescr(pgm, p);
|
||||
/*
|
||||
* If this is an ATxmega device, change the emulator mode from JTAG
|
||||
* to JTAG_XMEGA.
|
||||
*/
|
||||
if (!(pgm->flag & PGM_FL_IS_DW) &&
|
||||
(p->flags & AVRPART_HAS_PDI))
|
||||
jtagmkII_getsync(pgm, EMULATOR_MODE_JTAG_XMEGA);
|
||||
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
free(PDATA(pgm)->eeprom_pagecache);
|
||||
if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
|
||||
free(flash_pagecache);
|
||||
free(eeprom_pagecache);
|
||||
if ((flash_pagecache = malloc(flash_pagesize)) == NULL) {
|
||||
fprintf(stderr, "%s: jtagmkII_initialize(): Out of memory\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
|
||||
if ((eeprom_pagecache = malloc(eeprom_pagesize)) == NULL) {
|
||||
fprintf(stderr, "%s: jtagmkII_initialize(): Out of memory\n",
|
||||
progname);
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
free(flash_pagecache);
|
||||
return -1;
|
||||
}
|
||||
PDATA(pgm)->flash_pageaddr = PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
flash_pageaddr = eeprom_pageaddr = (unsigned long)-1L;
|
||||
|
||||
if (jtagmkII_reset(pgm, 0x01) < 0)
|
||||
return -1;
|
||||
@@ -1228,10 +1149,10 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
static void jtagmkII_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
PDATA(pgm)->flash_pagecache = NULL;
|
||||
free(PDATA(pgm)->eeprom_pagecache);
|
||||
PDATA(pgm)->eeprom_pagecache = NULL;
|
||||
free(flash_pagecache);
|
||||
flash_pagecache = NULL;
|
||||
free(eeprom_pagecache);
|
||||
eeprom_pagecache = NULL;
|
||||
|
||||
if (!(pgm->flag & PGM_FL_IS_DW))
|
||||
(void)jtagmkII_program_disable(pgm);
|
||||
@@ -1242,49 +1163,6 @@ static void jtagmkII_enable(PROGRAMMER * pgm)
|
||||
return;
|
||||
}
|
||||
|
||||
static int jtagmkII_parseextparms(PROGRAMMER * pgm, LISTID extparms)
|
||||
{
|
||||
LNODEID ln;
|
||||
const char *extended_param;
|
||||
int rv = 0;
|
||||
|
||||
for (ln = lfirst(extparms); ln; ln = lnext(ln)) {
|
||||
extended_param = ldata(ln);
|
||||
|
||||
if (strncmp(extended_param, "jtagchain=", strlen("jtagchain=")) == 0) {
|
||||
unsigned int ub, ua, bb, ba;
|
||||
if (sscanf(extended_param, "jtagchain=%u,%u,%u,%u", &ub, &ua, &bb, &ba)
|
||||
!= 4) {
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_parseextparms(): invalid JTAG chain '%s'\n",
|
||||
progname, extended_param);
|
||||
rv = -1;
|
||||
continue;
|
||||
}
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_parseextparms(): JTAG chain parsed as:\n"
|
||||
"%s %u units before, %u units after, %u bits before, %u bits after\n",
|
||||
progname,
|
||||
progbuf, ub, ua, bb, ba);
|
||||
}
|
||||
PDATA(pgm)->jtagchain[0] = ub;
|
||||
PDATA(pgm)->jtagchain[1] = ua;
|
||||
PDATA(pgm)->jtagchain[2] = bb;
|
||||
PDATA(pgm)->jtagchain[3] = ba;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkII_parseextparms(): invalid extended parameter '%s'\n",
|
||||
progname, extended_param);
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int jtagmkII_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
@@ -1474,7 +1352,7 @@ void jtagmkII_close(PROGRAMMER * pgm)
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkII_close()\n", progname);
|
||||
|
||||
if (PDATA(pgm)->device_descriptor_length) {
|
||||
if (device_descriptor_length) {
|
||||
/* When in JTAG mode, restart target. */
|
||||
buf[0] = CMND_GO;
|
||||
if (verbose >= 2)
|
||||
@@ -1548,7 +1426,6 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int addr, block_size;
|
||||
unsigned char *cmd;
|
||||
unsigned char *resp;
|
||||
unsigned char par[4];
|
||||
int status, tries;
|
||||
long otimeout = serial_recv_timeout;
|
||||
|
||||
@@ -1566,42 +1443,22 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
if ( p->flags & AVRPART_HAS_PDI )
|
||||
{
|
||||
u32_to_b4( par, m->offset );
|
||||
(void) jtagmkII_setparm( pgm, PAR_PDI_OFFSET_START, par );
|
||||
u32_to_b4( par, m->offset + m->size );
|
||||
(void) jtagmkII_setparm( pgm, PAR_PDI_OFFSET_END, par );
|
||||
}
|
||||
|
||||
cmd[0] = CMND_WRITE_MEMORY;
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE;
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
PDATA(pgm)->flash_pageaddr = (unsigned long)-1L;
|
||||
page_size = PDATA(pgm)->flash_pagesize;
|
||||
cmd[1] = MTYPE_FLASH_PAGE;
|
||||
flash_pageaddr = (unsigned long)-1L;
|
||||
page_size = flash_pagesize;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM_PAGE;
|
||||
eeprom_pageaddr = (unsigned long)-1L;
|
||||
page_size = eeprom_pagesize;
|
||||
if (pgm->flag & PGM_FL_IS_DW) {
|
||||
/*
|
||||
* jtagmkII_paged_write() to EEPROM attempted while in
|
||||
* DW mode. Use jtagmkII_write_byte() instead.
|
||||
*/
|
||||
for (addr = 0; addr < n_bytes; addr++) {
|
||||
status = jtagmkII_write_byte(pgm, p, m, addr, m->buf[addr]);
|
||||
report_progress(addr, n_bytes, NULL);
|
||||
if (status < 0) {
|
||||
free(cmd);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free(cmd);
|
||||
return n_bytes;
|
||||
return -1;
|
||||
}
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
page_size = PDATA(pgm)->eeprom_pagesize;
|
||||
}
|
||||
if ( cmd[1] == MTYPE_FLASH ) (void)jtagmkII_pre_write(pgm);
|
||||
|
||||
|
||||
serial_recv_timeout = 100;
|
||||
for (addr = 0; addr < n_bytes; addr += page_size) {
|
||||
report_progress(addr, n_bytes,NULL);
|
||||
@@ -1616,7 +1473,7 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
progname, addr, block_size);
|
||||
|
||||
u32_to_b4(cmd + 2, page_size);
|
||||
u32_to_b4(cmd + 6, addr+m->offset );
|
||||
u32_to_b4(cmd + 6, addr);
|
||||
|
||||
/*
|
||||
* The JTAG ICE will refuse to write anything but a full page, at
|
||||
@@ -1701,16 +1558,14 @@ static int jtagmkII_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
page_size = m->readsize;
|
||||
|
||||
cmd[0] = CMND_READ_MEMORY;
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE;
|
||||
if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd[1] = MTYPE_FLASH_PAGE;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM_PAGE;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
return -1;
|
||||
} else if ( ( strcmp(m->desc, "prodsig") == 0 ) ) {
|
||||
cmd[1] = MTYPE_PRODSIG;
|
||||
} else if ( ( strcmp(m->desc, "usersig") == 0 ) ) {
|
||||
cmd[1] = MTYPE_USERSIG;
|
||||
}
|
||||
|
||||
serial_recv_timeout = 100;
|
||||
for (addr = 0; addr < n_bytes; addr += page_size) {
|
||||
report_progress(addr, n_bytes,NULL);
|
||||
@@ -1725,7 +1580,7 @@ static int jtagmkII_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
progname, addr, block_size);
|
||||
|
||||
u32_to_b4(cmd + 2, block_size);
|
||||
u32_to_b4(cmd + 6, addr+m->offset );
|
||||
u32_to_b4(cmd + 6, addr);
|
||||
|
||||
tries = 0;
|
||||
|
||||
@@ -1769,7 +1624,7 @@ static int jtagmkII_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
serial_recv_timeout = otimeout;
|
||||
return -1;
|
||||
}
|
||||
memcpy(m->buf + addr, resp + 1, status-1);
|
||||
memcpy(m->buf + addr, resp + 1, status);
|
||||
free(resp);
|
||||
}
|
||||
serial_recv_timeout = otimeout;
|
||||
@@ -1796,23 +1651,22 @@ static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
cmd[0] = CMND_READ_MEMORY;
|
||||
unsupp = 0;
|
||||
|
||||
addr += mem->offset;
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE;
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
cmd[1] = MTYPE_FLASH_PAGE;
|
||||
pagesize = mem->page_size;
|
||||
paddr = addr & ~(pagesize - 1);
|
||||
paddr_ptr = &PDATA(pgm)->flash_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->flash_pagecache;
|
||||
paddr_ptr = &flash_pageaddr;
|
||||
cache_ptr = flash_pagecache;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & AVRPART_HAS_PDI ) ) {
|
||||
if (pgm->flag & PGM_FL_IS_DW) {
|
||||
/* debugWire cannot use page access for EEPROM */
|
||||
cmd[1] = MTYPE_EEPROM;
|
||||
} else {
|
||||
cmd[1] = MTYPE_EEPROM_PAGE;
|
||||
pagesize = mem->page_size;
|
||||
paddr = addr & ~(pagesize - 1);
|
||||
paddr_ptr = &PDATA(pgm)->eeprom_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->eeprom_pagecache;
|
||||
paddr_ptr = &eeprom_pageaddr;
|
||||
cache_ptr = eeprom_pagecache;
|
||||
}
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
@@ -1833,12 +1687,6 @@ static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
cmd[1] = MTYPE_LOCK_BITS;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
} else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
cmd[1] = MTYPE_USERSIG;
|
||||
} else if (strcmp(mem->desc, "prodsig") == 0) {
|
||||
cmd[1] = MTYPE_PRODSIG;
|
||||
} else if (strcmp(mem->desc, "calibration") == 0) {
|
||||
cmd[1] = MTYPE_OSCCAL_BYTE;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
@@ -1873,7 +1721,6 @@ static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1972,20 +1819,18 @@ static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
fprintf(stderr, "%s: jtagmkII_write_byte(.., %s, 0x%lx, ...)\n",
|
||||
progname, mem->desc, addr);
|
||||
|
||||
addr += mem->offset;
|
||||
|
||||
writedata = data;
|
||||
cmd[0] = CMND_WRITE_MEMORY;
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_SPM;
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
need_progmode = 0;
|
||||
PDATA(pgm)->flash_pageaddr = (unsigned long)-1L;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
cmd[1] = MTYPE_SPM;
|
||||
need_progmode = 0;
|
||||
flash_pageaddr = (unsigned long)-1L;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM;
|
||||
need_progmode = 0;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
eeprom_pageaddr = (unsigned long)-1L;
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
addr = 0;
|
||||
@@ -2001,12 +1846,6 @@ static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
addr = 2;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
} else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
cmd[1] = MTYPE_USERSIG;
|
||||
} else if (strcmp(mem->desc, "prodsig") == 0) {
|
||||
cmd[1] = MTYPE_PRODSIG;
|
||||
} else if (strcmp(mem->desc, "lock") == 0) {
|
||||
cmd[1] = MTYPE_LOCK_BITS;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
@@ -2187,9 +2026,6 @@ static int jtagmkII_setparm(PROGRAMMER * pgm, unsigned char parm,
|
||||
case PAR_OCD_VTARGET: size = 2; break;
|
||||
case PAR_OCD_JTAG_CLK: size = 1; break;
|
||||
case PAR_TIMERS_RUNNING: size = 1; break;
|
||||
case PAR_DAISY_CHAIN_INFO: size = 4; break;
|
||||
case PAR_PDI_OFFSET_START:
|
||||
case PAR_PDI_OFFSET_END: size = 4; break;
|
||||
default:
|
||||
fprintf(stderr, "%s: jtagmkII_setparm(): unknown parameter 0x%02x\n",
|
||||
progname, parm);
|
||||
@@ -2247,7 +2083,7 @@ static void jtagmkII_display(PROGRAMMER * pgm, const char * p)
|
||||
fprintf(stderr, "%sS_MCU hardware version: %d\n", p, hw[1]);
|
||||
fprintf(stderr, "%sS_MCU firmware version: %d.%02d\n", p, fw[3], fw[2]);
|
||||
fprintf(stderr, "%sSerial number: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
p, PDATA(pgm)->serno[0], PDATA(pgm)->serno[1], PDATA(pgm)->serno[2], PDATA(pgm)->serno[3], PDATA(pgm)->serno[4], PDATA(pgm)->serno[5]);
|
||||
p, serno[0], serno[1], serno[2], serno[3], serno[4], serno[5]);
|
||||
|
||||
jtagmkII_print_parms1(pgm, p);
|
||||
|
||||
@@ -2255,7 +2091,7 @@ static void jtagmkII_display(PROGRAMMER * pgm, const char * p)
|
||||
}
|
||||
|
||||
|
||||
static void jtagmkII_print_parms1(PROGRAMMER * pgm, const char * p)
|
||||
static void jtagmkII_print_parms1(PROGRAMMER * pgm, char * p)
|
||||
{
|
||||
unsigned char vtarget[4], jtag_clock[4];
|
||||
char clkbuf[20];
|
||||
@@ -2324,9 +2160,6 @@ void jtagmkII_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_load = jtagmkII_paged_load;
|
||||
pgm->print_parms = jtagmkII_print_parms;
|
||||
pgm->set_sck_period = jtagmkII_set_sck_period;
|
||||
pgm->parseextparams = jtagmkII_parseextparms;
|
||||
pgm->setup = jtagmkII_setup;
|
||||
pgm->teardown = jtagmkII_teardown;
|
||||
pgm->page_size = 256;
|
||||
}
|
||||
|
||||
@@ -2355,8 +2188,6 @@ void jtagmkII_dw_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_write = jtagmkII_paged_write;
|
||||
pgm->paged_load = jtagmkII_paged_load;
|
||||
pgm->print_parms = jtagmkII_print_parms;
|
||||
pgm->setup = jtagmkII_setup;
|
||||
pgm->teardown = jtagmkII_teardown;
|
||||
pgm->page_size = 256;
|
||||
pgm->flag = PGM_FL_IS_DW;
|
||||
}
|
||||
@@ -2387,9 +2218,6 @@ void jtagmkII_dragon_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_load = jtagmkII_paged_load;
|
||||
pgm->print_parms = jtagmkII_print_parms;
|
||||
pgm->set_sck_period = jtagmkII_set_sck_period;
|
||||
pgm->parseextparams = jtagmkII_parseextparms;
|
||||
pgm->setup = jtagmkII_setup;
|
||||
pgm->teardown = jtagmkII_teardown;
|
||||
pgm->page_size = 256;
|
||||
}
|
||||
|
||||
@@ -2418,8 +2246,6 @@ void jtagmkII_dragon_dw_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_write = jtagmkII_paged_write;
|
||||
pgm->paged_load = jtagmkII_paged_load;
|
||||
pgm->print_parms = jtagmkII_print_parms;
|
||||
pgm->setup = jtagmkII_setup;
|
||||
pgm->teardown = jtagmkII_teardown;
|
||||
pgm->page_size = 256;
|
||||
pgm->flag = PGM_FL_IS_DW;
|
||||
}
|
||||
|
||||
@@ -38,14 +38,6 @@ void jtagmkII_dw_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_dragon_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_dragon_dw_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
/*
|
||||
* These functions are referenced from stk500v2.c for JTAG ICE mkII
|
||||
* and AVR Dragon programmers running in one of the STK500v2
|
||||
* modi.
|
||||
*/
|
||||
void jtagmkII_setup(PROGRAMMER * pgm);
|
||||
void jtagmkII_teardown(PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -103,7 +103,6 @@
|
||||
#define CMND_SPI_CMD 0x1D
|
||||
#define CMND_WRITE_MEMORY 0x04
|
||||
#define CMND_WRITE_PC 0x06
|
||||
#define CMND_0x34 0x34
|
||||
|
||||
/* ICE responses */
|
||||
#define RSP_DEBUGWIRE_SYNC_FAILED 0xAC
|
||||
@@ -171,9 +170,6 @@
|
||||
#define MTYPE_SIGN_JTAG 0xB4 /* signature in programming mode */
|
||||
#define MTYPE_OSCCAL_BYTE 0xB5 /* osccal cells in programming mode */
|
||||
#define MTYPE_CAN 0xB6 /* CAN mailbox */
|
||||
#define MTYPE_FLASH 0xc0 /* xmega flash - undocumented in AVR067 */
|
||||
#define MTYPE_USERSIG 0xc5 /* xmega user signature - undocumented in AVR067 */
|
||||
#define MTYPE_PRODSIG 0xc6 /* xmega production signature - undocumented in AVR067 */
|
||||
|
||||
/* (some) ICE parameters, for CMND_{GET,SET}_PARAMETER */
|
||||
#define PAR_HW_VERSION 0x01
|
||||
@@ -183,7 +179,6 @@
|
||||
# define EMULATOR_MODE_JTAG 0x01
|
||||
# define EMULATOR_MODE_HV 0x02 /* HVSP or PP mode of AVR Dragon */
|
||||
# define EMULATOR_MODE_SPI 0x03
|
||||
# define EMULATOR_MODE_JTAG_XMEGA 0x05
|
||||
#define PAR_IREG 0x04
|
||||
#define PAR_BAUD_RATE 0x05
|
||||
# define PAR_BAUD_2400 0x01
|
||||
@@ -223,8 +218,6 @@
|
||||
#define PAR_TARGET_SIGNATURE 0x1D
|
||||
#define PAR_DEBUGWIRE_BAUDRATE 0x1E
|
||||
#define PAR_PROGRAM_ENTRY_POINT 0x1F
|
||||
#define PAR_PDI_OFFSET_START 0x32
|
||||
#define PAR_PDI_OFFSET_END 0x33
|
||||
#define PAR_PACKET_PARSING_ERRORS 0x40
|
||||
#define PAR_VALID_PACKETS_RECEIVED 0x41
|
||||
#define PAR_INTERCOMMUNICATION_TX_FAILURES 0x42
|
||||
|
||||
@@ -50,7 +50,7 @@ SIGN [+-]
|
||||
|
||||
/* Bump resources for classic lex. */
|
||||
%e2000
|
||||
%p10000
|
||||
%p5000
|
||||
%n1000
|
||||
|
||||
%%
|
||||
@@ -117,11 +117,9 @@ SIGN [+-]
|
||||
exit(1); }
|
||||
|
||||
allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; }
|
||||
arduino { yylval=NULL; return K_ARDUINO; }
|
||||
avr910 { yylval=NULL; return K_AVR910; }
|
||||
avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; }
|
||||
usbasp { yylval=NULL; return K_USBASP; }
|
||||
usbtiny { yylval=NULL; return K_USBTINY; }
|
||||
bank_size { yylval=NULL; return K_PAGE_SIZE; }
|
||||
banked { yylval=NULL; return K_PAGED; }
|
||||
baudrate { yylval=NULL; return K_BAUDRATE; }
|
||||
@@ -146,7 +144,6 @@ errled { yylval=NULL; return K_ERRLED; }
|
||||
flash { yylval=NULL; return K_FLASH; }
|
||||
has_jtag { yylval=NULL; return K_HAS_JTAG; }
|
||||
has_debugwire { yylval=NULL; return K_HAS_DW; }
|
||||
has_pdi { yylval=NULL; return K_HAS_PDI; }
|
||||
id { yylval=NULL; return K_ID; }
|
||||
idr { yylval=NULL; return K_IDR; }
|
||||
jtagmki { yylval=NULL; return K_JTAG_MKI; }
|
||||
@@ -160,8 +157,6 @@ miso { yylval=NULL; return K_MISO; }
|
||||
mosi { yylval=NULL; return K_MOSI; }
|
||||
num_banks { yylval=NULL; return K_NUM_PAGES; }
|
||||
num_pages { yylval=NULL; return K_NUM_PAGES; }
|
||||
nvm_base { yylval=NULL; return K_NVM_BASE; }
|
||||
offset { yylval=NULL; return K_OFFSET; }
|
||||
page_size { yylval=NULL; return K_PAGE_SIZE; }
|
||||
paged { yylval=NULL; return K_PAGED; }
|
||||
pagel { yylval=NULL; return K_PAGEL; }
|
||||
@@ -187,9 +182,6 @@ stk500pp { yylval=NULL; return K_STK500PP; }
|
||||
stk500v2 { yylval=NULL; return K_STK500V2; }
|
||||
stk500generic { yylval=NULL; return K_STK500GENERIC; }
|
||||
stk500_devcode { yylval=NULL; return K_STK500_DEVCODE; }
|
||||
stk600 { yylval=NULL; return K_STK600; }
|
||||
stk600hvsp { yylval=NULL; return K_STK600HVSP; }
|
||||
stk600pp { yylval=NULL; return K_STK600PP; }
|
||||
type { yylval=NULL; return K_TYPE; }
|
||||
vcc { yylval=NULL; return K_VCC; }
|
||||
vfyled { yylval=NULL; return K_VFYLED; }
|
||||
|
||||
160
avrdude/main.c
160
avrdude/main.c
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2000-2005 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007-2009 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -73,10 +72,6 @@ struct list_walk_cookie
|
||||
|
||||
static LISTID updates;
|
||||
|
||||
static LISTID extended_params;
|
||||
|
||||
static PROGRAMMER * pgm;
|
||||
|
||||
/*
|
||||
* global options
|
||||
*/
|
||||
@@ -116,14 +111,13 @@ static void usage(void)
|
||||
" fuses should be changed back.\n"
|
||||
" -t Enter terminal mode.\n"
|
||||
" -E <exitspec>[,<exitspec>] List programmer exit specifications.\n"
|
||||
" -x <extended_param> Pass <extended_param> to programmer.\n"
|
||||
" -y Count # erase cycles in EEPROM.\n"
|
||||
" -Y <number> Initialize erase cycle # in EEPROM.\n"
|
||||
" -v Verbose output. -v -v for more.\n"
|
||||
" -q Quell progress output. -q -q for less.\n"
|
||||
" -? Display this usage.\n"
|
||||
"\navrdude version %s, URL: <http://savannah.nongnu.org/projects/avrdude/>\n"
|
||||
,progname, version);
|
||||
"\navrdude project: <URL:http://savannah.nongnu.org/projects/avrdude>\n"
|
||||
,progname);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,8 +128,6 @@ static void update_progress_tty (int percent, double etime, char *hdr)
|
||||
static int last = 0;
|
||||
int i;
|
||||
|
||||
setvbuf(stderr, (char*)NULL, _IONBF, 0);
|
||||
|
||||
hashes[50] = 0;
|
||||
|
||||
memset (hashes, ' ', 50);
|
||||
@@ -158,8 +150,6 @@ static void update_progress_tty (int percent, double etime, char *hdr)
|
||||
last = 1;
|
||||
fprintf (stderr, "\n\n");
|
||||
}
|
||||
|
||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||
}
|
||||
|
||||
static void update_progress_no_tty (int percent, double etime, char *hdr)
|
||||
@@ -168,8 +158,6 @@ static void update_progress_no_tty (int percent, double etime, char *hdr)
|
||||
static int last = 0;
|
||||
int cnt = (percent>>1)*2;
|
||||
|
||||
setvbuf(stderr, (char*)NULL, _IONBF, 0);
|
||||
|
||||
if (hdr) {
|
||||
fprintf (stderr, "\n%s | ", hdr);
|
||||
last = 0;
|
||||
@@ -189,8 +177,6 @@ static void update_progress_no_tty (int percent, double etime, char *hdr)
|
||||
}
|
||||
else
|
||||
last = (percent>>1)*2; /* Make last a multiple of 2. */
|
||||
|
||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||
}
|
||||
|
||||
static void list_programmers_callback(const char *name, const char *desc,
|
||||
@@ -233,12 +219,6 @@ static void list_parts(FILE * f, const char *prefix, LISTID avrparts)
|
||||
walk_avrparts(avrparts, list_avrparts_callback, &c);
|
||||
}
|
||||
|
||||
static void exithook(void)
|
||||
{
|
||||
if (pgm->teardown)
|
||||
pgm->teardown(pgm);
|
||||
}
|
||||
|
||||
/*
|
||||
* main routine
|
||||
*/
|
||||
@@ -255,6 +235,7 @@ int main(int argc, char * argv [])
|
||||
struct stat sb;
|
||||
UPDATE * upd;
|
||||
LNODEID * ln;
|
||||
PROGRAMMER * pgm;
|
||||
|
||||
|
||||
/* options / operating mode variables */
|
||||
@@ -279,7 +260,6 @@ int main(int argc, char * argv [])
|
||||
int ispdelay; /* Specify the delay for ISP clock */
|
||||
int safemode; /* Enable safemode, 1=safemode on, 0=normal */
|
||||
int silentsafe; /* Don't ask about fuses, 1=silent, 0=normal */
|
||||
int init_ok; /* Device initialization worked well */
|
||||
unsigned char safemode_lfuse = 0xff;
|
||||
unsigned char safemode_hfuse = 0xff;
|
||||
unsigned char safemode_efuse = 0xff;
|
||||
@@ -292,13 +272,6 @@ int main(int argc, char * argv [])
|
||||
char * homedir;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set line buffering for file descriptors so we see stdout and stderr
|
||||
* properly interleaved.
|
||||
*/
|
||||
setvbuf(stdout, (char*)NULL, _IOLBF, 0);
|
||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||
|
||||
progname = strrchr(argv[0],'/');
|
||||
|
||||
#if defined (WIN32NATIVE)
|
||||
@@ -322,12 +295,6 @@ int main(int argc, char * argv [])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
extended_params = lcreat(NULL, 0);
|
||||
if (extended_params == NULL) {
|
||||
fprintf(stderr, "%s: cannot initialize extended parameter list\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
partdesc = NULL;
|
||||
port = default_parallel;
|
||||
erase = 0;
|
||||
@@ -350,7 +317,7 @@ int main(int argc, char * argv [])
|
||||
ispdelay = 0;
|
||||
safemode = 1; /* Safemode on by default */
|
||||
silentsafe = 0; /* Ask by default */
|
||||
|
||||
|
||||
if (isatty(STDIN_FILENO) == 0)
|
||||
safemode = 0; /* Turn off safemode if this isn't a terminal */
|
||||
|
||||
@@ -398,7 +365,7 @@ int main(int argc, char * argv [])
|
||||
/*
|
||||
* process command line arguments
|
||||
*/
|
||||
while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:np:OP:qstU:uvVx:yY:")) != -1) {
|
||||
while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:np:OP:qstU:uvVyY:")) != -1) {
|
||||
|
||||
switch (ch) {
|
||||
case 'b': /* override default programmer baud rate */
|
||||
@@ -510,10 +477,6 @@ int main(int argc, char * argv [])
|
||||
verify = 0;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
ladd(extended_params, optarg);
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
do_cycles = 1;
|
||||
break;
|
||||
@@ -563,9 +526,8 @@ int main(int argc, char * argv [])
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"\n%s: Version %s, compiled on %s at %s\n"
|
||||
"%sCopyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/\n"
|
||||
"%sCopyright (c) 2007-2009 Joerg Wunsch\n\n",
|
||||
progname, version, __DATE__, __TIME__, progbuf, progbuf);
|
||||
"%sCopyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/\n\n",
|
||||
progname, version, __DATE__, __TIME__, progbuf);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
@@ -654,29 +616,6 @@ int main(int argc, char * argv [])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pgm->setup) {
|
||||
pgm->setup(pgm);
|
||||
}
|
||||
if (pgm->teardown) {
|
||||
atexit(exithook);
|
||||
}
|
||||
|
||||
if (lsize(extended_params) > 0) {
|
||||
if (pgm->parseextparams == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: WARNING: Programmer doesn't support extended parameters,"
|
||||
" -x option(s) ignored\n",
|
||||
progname);
|
||||
} else {
|
||||
if (pgm->parseextparams(pgm, extended_params) < 0) {
|
||||
fprintf(stderr,
|
||||
"%s: Error parsing extended parameter list\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((strcmp(pgm->type, "STK500") == 0) ||
|
||||
(strcmp(pgm->type, "avr910") == 0) ||
|
||||
(strcmp(pgm->type, "STK500V2") == 0) ||
|
||||
@@ -743,26 +682,20 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "%sUsing Port : %s\n", progbuf, port);
|
||||
fprintf(stderr, "%sUsing Programmer : %s\n", progbuf, programmer);
|
||||
if ((strcmp(pgm->type, "avr910") == 0)) {
|
||||
fprintf(stderr, "%savr910_devcode (avrdude.conf) : ", progbuf);
|
||||
if(p->avr910_devcode)fprintf(stderr, "0x%x\n", p->avr910_devcode);
|
||||
else fprintf(stderr, "none\n");
|
||||
}
|
||||
|
||||
fprintf(stderr, "%sUsing Port : %s\n", progbuf, port);
|
||||
fprintf(stderr, "%sUsing Programmer : %s\n", progbuf, programmer);
|
||||
}
|
||||
|
||||
if (baudrate != 0) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "%sOverriding Baud Rate : %d\n", progbuf, baudrate);
|
||||
fprintf(stderr, "%sOverriding Baud Rate : %d\n", progbuf, baudrate);
|
||||
}
|
||||
pgm->baudrate = baudrate;
|
||||
}
|
||||
|
||||
if (bitclock != 0.0) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "%sSetting bit clk period : %.1f\n", progbuf, bitclock);
|
||||
fprintf(stderr, "%sSetting bit clk period: %.1f\n", progbuf, bitclock);
|
||||
}
|
||||
|
||||
pgm->bitclock = bitclock * 1e-6;
|
||||
@@ -770,7 +703,7 @@ int main(int argc, char * argv [])
|
||||
|
||||
if (ispdelay != 0) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "%sSetting isp clock delay : %3i\n", progbuf, ispdelay);
|
||||
fprintf(stderr, "%sSetting isp clock delay: %3i\n", progbuf, ispdelay);
|
||||
}
|
||||
pgm->ispdelay = ispdelay;
|
||||
}
|
||||
@@ -787,15 +720,8 @@ int main(int argc, char * argv [])
|
||||
* perform an RC oscillator calibration
|
||||
* as outlined in appnote AVR053
|
||||
*/
|
||||
if (pgm->perform_osccal == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: programmer does not support RC oscillator calibration\n",
|
||||
progname);
|
||||
exitrc = 1;
|
||||
} else {
|
||||
fprintf(stderr, "%s: performing RC oscillator calibration\n", progname);
|
||||
exitrc = pgm->perform_osccal(pgm);
|
||||
}
|
||||
fprintf(stderr, "%s: performing RC oscillator calibration\n", progname);
|
||||
exitrc = pgm->perform_osccal(pgm);
|
||||
if (exitrc == 0 && quell_progress < 2) {
|
||||
fprintf(stderr,
|
||||
"%s: calibration value is now stored in EEPROM at address 0\n",
|
||||
@@ -832,8 +758,8 @@ int main(int argc, char * argv [])
|
||||
/*
|
||||
* initialize the chip in preperation for accepting commands
|
||||
*/
|
||||
init_ok = (rc = pgm->initialize(pgm, p)) >= 0;
|
||||
if (!init_ok) {
|
||||
rc = pgm->initialize(pgm, p);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "%s: initialization failed, rc=%d\n", progname, rc);
|
||||
if (!ovsigck) {
|
||||
fprintf(stderr, "%sDouble check connections and try again, "
|
||||
@@ -860,14 +786,12 @@ int main(int argc, char * argv [])
|
||||
* against 0xffffff / 0x000000 should ensure that the signature bytes
|
||||
* are valid.
|
||||
*/
|
||||
if (init_ok) {
|
||||
rc = avr_signature(pgm, p);
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "%s: error reading signature data, rc=%d\n",
|
||||
progname, rc);
|
||||
exitrc = 1;
|
||||
goto main_exit;
|
||||
}
|
||||
rc = avr_signature(pgm, p);
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "%s: error reading signature data, rc=%d\n",
|
||||
progname, rc);
|
||||
exitrc = 1;
|
||||
goto main_exit;
|
||||
}
|
||||
|
||||
sig = avr_locate_mem(p, "signature");
|
||||
@@ -928,7 +852,7 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
}
|
||||
|
||||
if (init_ok && safemode == 1) {
|
||||
if (safemode == 1) {
|
||||
/* If safemode is enabled, go ahead and read the current low, high,
|
||||
and extended fuse bytes as needed */
|
||||
|
||||
@@ -964,14 +888,7 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
|
||||
|
||||
if ((p->flags & AVRPART_HAS_PDI) != 0) {
|
||||
/*
|
||||
* This is an ATxmega which can page erase, so no auto erase is
|
||||
* needed.
|
||||
*/
|
||||
auto_erase = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((erase == 0) && (auto_erase == 1)) {
|
||||
AVRMEM * m;
|
||||
@@ -1000,8 +917,7 @@ int main(int argc, char * argv [])
|
||||
*
|
||||
* The cycle count will be displayed anytime it will be changed later.
|
||||
*/
|
||||
if (init_ok &&
|
||||
(set_cycles == -1) && ((erase == 0) || (do_cycles == 0))) {
|
||||
if ((set_cycles == -1) && ((erase == 0) || (do_cycles == 0))) {
|
||||
/*
|
||||
* see if the cycle count in the last four bytes of eeprom seems
|
||||
* reasonable
|
||||
@@ -1017,7 +933,7 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
}
|
||||
|
||||
if (init_ok && set_cycles != -1) {
|
||||
if (set_cycles != -1) {
|
||||
rc = avr_get_cycle_count(pgm, p, &cycles);
|
||||
if (rc == 0) {
|
||||
/*
|
||||
@@ -1040,39 +956,25 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
|
||||
|
||||
if (init_ok && erase) {
|
||||
if (erase) {
|
||||
/*
|
||||
* erase the chip's flash and eeprom memories, this is required
|
||||
* before the chip can accept new programming
|
||||
*/
|
||||
if (nowrite) {
|
||||
fprintf(stderr,
|
||||
"%s: conflicting -e and -n options specified, NOT erasing chip\n",
|
||||
progname);
|
||||
} else {
|
||||
if (quell_progress < 2) {
|
||||
fprintf(stderr, "%s: erasing chip\n", progname);
|
||||
}
|
||||
avr_chip_erase(pgm, p);
|
||||
if (quell_progress < 2) {
|
||||
fprintf(stderr, "%s: erasing chip\n", progname);
|
||||
}
|
||||
avr_chip_erase(pgm, p);
|
||||
}
|
||||
|
||||
|
||||
if (terminal) {
|
||||
/*
|
||||
* terminal mode
|
||||
*/
|
||||
*/
|
||||
exitrc = terminal_mode(pgm, p);
|
||||
}
|
||||
|
||||
if (!init_ok) {
|
||||
/*
|
||||
* If we came here by the -tF options, bail out now.
|
||||
*/
|
||||
exitrc = 1;
|
||||
goto main_exit;
|
||||
}
|
||||
|
||||
|
||||
for (ln=lfirst(updates); ln; ln=lnext(ln)) {
|
||||
upd = ldata(ln);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
# include "freebsd_ppi.h"
|
||||
#elif defined(__linux__)
|
||||
# include "linux_ppdev.h"
|
||||
#elif defined(__sun__) || defined(__sun) /* Solaris */
|
||||
#elif defined(__sun__) && defined(__svr4__) /* Solaris */
|
||||
# include "solaris_ecpp.h"
|
||||
#endif
|
||||
|
||||
@@ -416,7 +416,6 @@ void par_initpgm(PROGRAMMER * pgm)
|
||||
pgm->program_enable = bitbang_program_enable;
|
||||
pgm->chip_erase = bitbang_chip_erase;
|
||||
pgm->cmd = bitbang_cmd;
|
||||
pgm->spi = bitbang_spi;
|
||||
pgm->open = par_open;
|
||||
pgm->close = par_close;
|
||||
pgm->setpin = par_setpin;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -118,7 +117,6 @@ PROGRAMMER * pgm_new(void)
|
||||
* assigned before they are called
|
||||
*/
|
||||
pgm->cmd = NULL;
|
||||
pgm->spi = NULL;
|
||||
pgm->paged_write = NULL;
|
||||
pgm->paged_load = NULL;
|
||||
pgm->write_setup = NULL;
|
||||
@@ -127,9 +125,6 @@ PROGRAMMER * pgm_new(void)
|
||||
pgm->set_varef = NULL;
|
||||
pgm->set_fosc = NULL;
|
||||
pgm->perform_osccal = NULL;
|
||||
pgm->parseextparams = NULL;
|
||||
pgm->setup = NULL;
|
||||
pgm->teardown = NULL;
|
||||
|
||||
return pgm;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -78,8 +77,6 @@ typedef struct programmer_t {
|
||||
int (*chip_erase) (struct programmer_t * pgm, AVRPART * p);
|
||||
int (*cmd) (struct programmer_t * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4]);
|
||||
int (*spi) (struct programmer_t * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int count);
|
||||
int (*open) (struct programmer_t * pgm, char * port);
|
||||
void (*close) (struct programmer_t * pgm);
|
||||
int (*paged_write) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||
@@ -94,7 +91,7 @@ typedef struct programmer_t {
|
||||
int (*read_sig_bytes) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
||||
void (*print_parms) (struct programmer_t * pgm);
|
||||
int (*set_vtarget) (struct programmer_t * pgm, double v);
|
||||
int (*set_varef) (struct programmer_t * pgm, unsigned int chan, double v);
|
||||
int (*set_varef) (struct programmer_t * pgm, double v);
|
||||
int (*set_fosc) (struct programmer_t * pgm, double v);
|
||||
int (*set_sck_period) (struct programmer_t * pgm, double v);
|
||||
int (*setpin) (struct programmer_t * pgm, int pin, int value);
|
||||
@@ -102,12 +99,8 @@ typedef struct programmer_t {
|
||||
int (*highpulsepin) (struct programmer_t * pgm, int pin);
|
||||
int (*parseexitspecs) (struct programmer_t * pgm, char *s);
|
||||
int (*perform_osccal) (struct programmer_t * pgm);
|
||||
int (*parseextparams) (struct programmer_t * pgm, LISTID xparams);
|
||||
void (*setup) (struct programmer_t * pgm);
|
||||
void (*teardown) (struct programmer_t * pgm);
|
||||
char config_file[PATH_MAX]; /* config file where defined */
|
||||
int lineno; /* config file line number */
|
||||
void *cookie; /* for private use by the programmer */
|
||||
char flag; /* for private use of the programmer */
|
||||
} PROGRAMMER;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# include "freebsd_ppi.h"
|
||||
#elif defined(__linux__)
|
||||
# include "linux_ppdev.h"
|
||||
#elif defined(__sun__) || defined(__sun) /* Solaris */
|
||||
#elif defined(__sun__) && defined(__svr4__) /* Solaris */
|
||||
# include "solaris_ecpp.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003, 2004, 2006
|
||||
* Eric B. Weddington <eweddington@cso.atmel.com>
|
||||
* Copyright 2008, Joerg Wunsch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -32,7 +31,6 @@ reg = register as defined in an enum in ppi.h. This must be converted
|
||||
|
||||
|
||||
#include "ac_cfg.h"
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined (WIN32NATIVE)
|
||||
|
||||
@@ -46,6 +44,7 @@ reg = register as defined in an enum in ppi.h. This must be converted
|
||||
#include <sys/time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "serial.h"
|
||||
#include "ppi.h"
|
||||
|
||||
@@ -108,24 +107,6 @@ void ppi_open(char *port, union filedescriptor *fdp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(fd == -1)
|
||||
{
|
||||
/*
|
||||
* Supplied port name did not match any of the pre-defined
|
||||
* names. Try interpreting it as a numeric
|
||||
* (hexadecimal/decimal/octal) address.
|
||||
*/
|
||||
char *cp;
|
||||
|
||||
fd = strtol(port, &cp, 0);
|
||||
if(*port == '\0' || *cp != '\0')
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: port name \"%s\" is neither lpt1/2/3 nor valid number\n",
|
||||
progname, port);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
if(fd < 0)
|
||||
{
|
||||
fprintf(stderr, "%s: can't open device \"%s\"\n\n", progname, port);
|
||||
@@ -374,7 +355,7 @@ int gettimeofday(struct timeval *tv, struct timezone *unused){
|
||||
|
||||
#endif
|
||||
|
||||
int usleep(unsigned int us)
|
||||
void usleep(unsigned long us)
|
||||
{
|
||||
int has_highperf;
|
||||
LARGE_INTEGER freq,start,stop,loopend;
|
||||
@@ -407,8 +388,6 @@ int usleep(unsigned int us)
|
||||
}
|
||||
|
||||
DEBUG_DisplayTimingInfo(start, stop, freq, us, has_highperf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -92,7 +92,6 @@ static void convertUniToAscii(char *buffer)
|
||||
while(*uni != 0){
|
||||
if(*uni >= 256){
|
||||
*ascii++ = '?';
|
||||
uni++;
|
||||
}else{
|
||||
*ascii++ = *uni++;
|
||||
}
|
||||
@@ -426,7 +425,7 @@ static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNum
|
||||
*len = bytesReceived;
|
||||
if(!usesReportIDs){
|
||||
buffer[-1] = reportNumber; /* add dummy report ID */
|
||||
len++;
|
||||
*len++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -120,10 +120,10 @@ static int ser_setspeed(union filedescriptor *fd, long baud)
|
||||
|
||||
cfsetospeed(&termios, speed);
|
||||
cfsetispeed(&termios, speed);
|
||||
|
||||
rc = tcsetattr(fd->ifd, TCSANOW, &termios);
|
||||
|
||||
rc = tcsetattr(fd->ifd, TCSANOW | TCSAFLUSH, &termios);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "%s: ser_setspeed(): tcsetattr() failed\n",
|
||||
fprintf(stderr, "%s: ser_setspeed(): tcsetattr() failed",
|
||||
progname);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,13 @@
|
||||
* Native Win32 serial interface for avrdude.
|
||||
*/
|
||||
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h> /* for isprint */
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "serial.h"
|
||||
|
||||
long serial_recv_timeout = 5000; /* ms */
|
||||
@@ -110,7 +109,6 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
HANDLE hComPort=INVALID_HANDLE_VALUE;
|
||||
char *newname = 0;
|
||||
|
||||
/*
|
||||
* If the port is of the form "net:<host>:<port>", then
|
||||
@@ -126,22 +124,10 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (strncasecmp(port, "com", strlen("com")) == 0) {
|
||||
|
||||
// prepend "\\\\.\\" to name, required for port # >= 10
|
||||
newname = malloc(strlen("\\\\.\\") + strlen(port) + 1);
|
||||
|
||||
if (newname == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: ser_open(): out of memory\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(newname, "\\\\.\\");
|
||||
strcat(newname, port);
|
||||
|
||||
port = newname;
|
||||
}
|
||||
/* if (hComPort!=INVALID_HANDLE_VALUE)
|
||||
fprintf(stderr, "%s: ser_open(): \"%s\" is already open\n",
|
||||
progname, port);
|
||||
*/
|
||||
|
||||
hComPort = CreateFile(port, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -187,10 +173,6 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
progname, port);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (newname != 0) {
|
||||
free(newname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +245,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
{
|
||||
unsigned char c;
|
||||
unsigned char * p = buf;
|
||||
size_t len = 0;
|
||||
DWORD read;
|
||||
|
||||
HANDLE hComPort=(HANDLE)fd->pfd;
|
||||
@@ -299,7 +282,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
{
|
||||
fprintf(stderr, "%s: Recv: ", progname);
|
||||
|
||||
while (read) {
|
||||
while (len) {
|
||||
c = *p;
|
||||
if (isprint(c)) {
|
||||
fprintf(stderr, "%c ", c);
|
||||
@@ -310,7 +293,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
fprintf(stderr, "[%02x] ", c);
|
||||
|
||||
p++;
|
||||
read--;
|
||||
len--;
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
* Win32 serial bitbanging interface for avrdude.
|
||||
*/
|
||||
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
|
||||
@@ -34,6 +32,7 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
#include "pindefs.h"
|
||||
#include "pgm.h"
|
||||
|
||||
@@ -35,11 +35,6 @@ union filedescriptor
|
||||
{
|
||||
int ifd;
|
||||
void *pfd;
|
||||
struct
|
||||
{
|
||||
void *handle;
|
||||
int ep;
|
||||
} usb;
|
||||
};
|
||||
|
||||
struct serial_device
|
||||
|
||||
124
avrdude/stk500.c
124
avrdude/stk500.c
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright (C) 2008 Joerg Wunsch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -331,77 +330,6 @@ static int stk500_set_extended_parms(PROGRAMMER * pgm, int n,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Crossbow MIB510 initialization and shutdown. Use cmd = 1 to
|
||||
* initialize, cmd = 0 to close.
|
||||
*/
|
||||
static int mib510_isp(PROGRAMMER * pgm, unsigned char cmd)
|
||||
{
|
||||
unsigned char buf[9];
|
||||
int tries = 0;
|
||||
|
||||
buf[0] = 0xaa;
|
||||
buf[1] = 0x55;
|
||||
buf[2] = 0x55;
|
||||
buf[3] = 0xaa;
|
||||
buf[4] = 0x17;
|
||||
buf[5] = 0x51;
|
||||
buf[6] = 0x31;
|
||||
buf[7] = 0x13;
|
||||
buf[8] = cmd;
|
||||
|
||||
|
||||
retry:
|
||||
|
||||
tries++;
|
||||
|
||||
stk500_send(pgm, buf, 9);
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
exit(1);
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
fprintf(stderr, "%s: mib510_isp(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
if (stk500_getsync(pgm) < 0)
|
||||
return -1;
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
"%s: mib510_isp(): protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
exit(1);
|
||||
if (buf[0] == Resp_STK_OK) {
|
||||
return 0;
|
||||
}
|
||||
else if (buf[0] == Resp_STK_NODEVICE) {
|
||||
fprintf(stderr, "%s: mib510_isp(): no device\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf[0] == Resp_STK_FAILED)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: mib510_isp(): command %d failed\n",
|
||||
progname, cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr, "%s: mib510_isp(): unknown response=0x%02x\n",
|
||||
progname, buf[0]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* initialize the AVR device and prepare it to accept commands
|
||||
@@ -413,18 +341,13 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
int tries;
|
||||
unsigned maj, min;
|
||||
int rc;
|
||||
int n_extparms;
|
||||
int n_extparms = 3;
|
||||
|
||||
stk500_getparm(pgm, Parm_STK_SW_MAJOR, &maj);
|
||||
stk500_getparm(pgm, Parm_STK_SW_MINOR, &min);
|
||||
|
||||
// MIB510 does not need extparams
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0)
|
||||
n_extparms = 0;
|
||||
else if ((maj > 1) || ((maj == 1) && (min > 10)))
|
||||
if ((maj > 1) || ((maj == 1) && (min > 10)))
|
||||
n_extparms = 4;
|
||||
else
|
||||
n_extparms = 3;
|
||||
|
||||
tries = 0;
|
||||
|
||||
@@ -539,6 +462,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (stk500_getsync(pgm) < 0)
|
||||
return -1;
|
||||
goto retry;
|
||||
return -1;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
@@ -664,11 +588,6 @@ static int stk500_open(PROGRAMMER * pgm, char * port)
|
||||
*/
|
||||
stk500_drain(pgm, 0);
|
||||
|
||||
// MIB510 init
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0 &&
|
||||
mib510_isp(pgm, 1) != 0)
|
||||
return -1;
|
||||
|
||||
if (stk500_getsync(pgm) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -678,10 +597,6 @@ static int stk500_open(PROGRAMMER * pgm, char * port)
|
||||
|
||||
static void stk500_close(PROGRAMMER * pgm)
|
||||
{
|
||||
// MIB510 close
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0)
|
||||
(void)mib510_isp(pgm, 0);
|
||||
|
||||
serial_close(&pgm->fd);
|
||||
pgm->fd.ifd = -1;
|
||||
}
|
||||
@@ -751,13 +666,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int flash;
|
||||
|
||||
if (page_size == 0) {
|
||||
// MIB510 uses page size of 256 bytes
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) {
|
||||
page_size = 256;
|
||||
}
|
||||
else {
|
||||
page_size = 128;
|
||||
}
|
||||
page_size = 128;
|
||||
}
|
||||
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
@@ -802,9 +711,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
for (addr = 0; addr < n; addr += page_size) {
|
||||
report_progress (addr, n_bytes, NULL);
|
||||
|
||||
// MIB510 uses fixed blocks size of 256 bytes
|
||||
if ((strcmp(ldata(lfirst(pgm->id)), "mib510") != 0) &&
|
||||
(addr + page_size > n_bytes)) {
|
||||
if (addr + page_size > n_bytes) {
|
||||
block_size = n_bytes % page_size;
|
||||
}
|
||||
else {
|
||||
@@ -925,9 +832,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
for (addr = 0; addr < n; addr += page_size) {
|
||||
report_progress (addr, n_bytes, NULL);
|
||||
|
||||
// MIB510 uses fixed blocks size of 256 bytes
|
||||
if ((strcmp(ldata(lfirst(pgm->id)), "mib510") != 0) &&
|
||||
(addr + page_size > n_bytes)) {
|
||||
if (addr + page_size > n_bytes) {
|
||||
block_size = n_bytes % page_size;
|
||||
}
|
||||
else {
|
||||
@@ -970,9 +875,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
exit(1);
|
||||
|
||||
if(strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) {
|
||||
if (buf[0] != Resp_STK_INSYNC) {
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
fprintf(stderr,
|
||||
"\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
@@ -980,16 +883,6 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
fprintf(stderr,
|
||||
"\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_OK, buf[0]);
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return n_bytes;
|
||||
}
|
||||
@@ -1020,8 +913,7 @@ static int stk500_set_vtarget(PROGRAMMER * pgm, double v)
|
||||
}
|
||||
|
||||
|
||||
static int stk500_set_varef(PROGRAMMER * pgm, unsigned int chan /* unused */,
|
||||
double v)
|
||||
static int stk500_set_varef(PROGRAMMER * pgm, double v)
|
||||
{
|
||||
unsigned uaref, utarg;
|
||||
|
||||
|
||||
@@ -65,27 +65,9 @@ static int stk500generic_open(PROGRAMMER * pgm, char * port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void stk500generic_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
/*
|
||||
* Only STK500v2 needs setup/teardown.
|
||||
*/
|
||||
stk500v2_initpgm(pgm);
|
||||
pgm->setup(pgm);
|
||||
}
|
||||
|
||||
static void stk500generic_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
stk500v2_initpgm(pgm);
|
||||
pgm->teardown(pgm);
|
||||
}
|
||||
|
||||
|
||||
void stk500generic_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "STK500GENERIC");
|
||||
|
||||
pgm->open = stk500generic_open;
|
||||
pgm->setup = stk500generic_setup;
|
||||
pgm->teardown = stk500generic_teardown;
|
||||
}
|
||||
|
||||
1421
avrdude/stk500v2.c
1421
avrdude/stk500v2.c
File diff suppressed because it is too large
Load Diff
@@ -34,9 +34,6 @@ void stk500v2_jtagmkII_initpgm(PROGRAMMER * pgm);
|
||||
void stk500v2_dragon_hvsp_initpgm(PROGRAMMER * pgm);
|
||||
void stk500v2_dragon_isp_initpgm(PROGRAMMER * pgm);
|
||||
void stk500v2_dragon_pp_initpgm(PROGRAMMER * pgm);
|
||||
void stk600_initpgm (PROGRAMMER * pgm);
|
||||
void stk600hvsp_initpgm (PROGRAMMER * pgm);
|
||||
void stk600pp_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#define CMD_OSCCAL 0x05
|
||||
#define CMD_LOAD_ADDRESS 0x06
|
||||
#define CMD_FIRMWARE_UPGRADE 0x07
|
||||
#define CMD_CHECK_TARGET_CONNECTION 0x0D
|
||||
#define CMD_LOAD_RC_ID_TABLE 0x0E
|
||||
#define CMD_LOAD_EC_ID_TABLE 0x0F
|
||||
|
||||
|
||||
// *****************[ STK ISP command constants ]******************************
|
||||
@@ -78,27 +75,6 @@
|
||||
#define CMD_READ_LOCK_HVSP 0x3A
|
||||
#define CMD_READ_SIGNATURE_HVSP 0x3B
|
||||
#define CMD_READ_OSCCAL_HVSP 0x3C
|
||||
// These two are redefined since 0x30/0x31 collide
|
||||
// with the STK600 bootloader.
|
||||
#define CMD_ENTER_PROGMODE_HVSP_STK600 0x3D
|
||||
#define CMD_LEAVE_PROGMODE_HVSP_STK600 0x3E
|
||||
|
||||
// *** XPROG command constants ***
|
||||
|
||||
#define CMD_XPROG 0x50
|
||||
#define CMD_XPROG_SETMODE 0x51
|
||||
|
||||
|
||||
// *** AVR32 JTAG Programming command ***
|
||||
|
||||
#define CMD_JTAG_AVR32 0x80
|
||||
#define CMD_ENTER_PROGMODE_JTAG_AVR32 0x81
|
||||
#define CMD_LEAVE_PROGMODE_JTAG_AVR32 0x82
|
||||
|
||||
|
||||
// *** AVR JTAG Programming command ***
|
||||
|
||||
#define CMD_JTAG_AVR 0x90
|
||||
|
||||
// *****************[ STK test command constants ]***************************
|
||||
|
||||
@@ -134,136 +110,24 @@
|
||||
#define STATUS_CMD_FAILED 0xC0
|
||||
#define STATUS_CKSUM_ERROR 0xC1
|
||||
#define STATUS_CMD_UNKNOWN 0xC9
|
||||
#define STATUS_CMD_ILLEGAL_PARAMETER 0xCA
|
||||
|
||||
// Status
|
||||
#define STATUS_CONN_FAIL_MOSI 0x01
|
||||
#define STATUS_CONN_FAIL_RST 0x02
|
||||
#define STATUS_CONN_FAIL_SCK 0x04
|
||||
#define STATUS_TGT_NOT_DETECTED 0x00
|
||||
#define STATUS_ISP_READY 0x10
|
||||
#define STATUS_TGT_REVERSE_INSERTED 0x20
|
||||
|
||||
// hw_status
|
||||
// Bits in status variable
|
||||
// Bit 0-3: Slave MCU
|
||||
// Bit 4-7: Master MCU
|
||||
|
||||
#define STATUS_AREF_ERROR 0
|
||||
// Set to '1' if AREF is short circuited
|
||||
|
||||
#define STATUS_VTG_ERROR 4
|
||||
// Set to '1' if VTG is short circuited
|
||||
|
||||
#define STATUS_RC_CARD_ERROR 5
|
||||
// Set to '1' if board id changes when board is powered
|
||||
|
||||
#define STATUS_PROGMODE 6
|
||||
// Set to '1' if board is in programming mode
|
||||
|
||||
#define STATUS_POWER_SURGE 7
|
||||
// Set to '1' if board draws excessive current
|
||||
|
||||
// *****************[ STK parameter constants ]***************************
|
||||
#define PARAM_BUILD_NUMBER_LOW 0x80 /* ??? */
|
||||
#define PARAM_BUILD_NUMBER_HIGH 0x81 /* ??? */
|
||||
#define PARAM_BUILD_NUMBER_LOW 0x80
|
||||
#define PARAM_BUILD_NUMBER_HIGH 0x81
|
||||
#define PARAM_HW_VER 0x90
|
||||
#define PARAM_SW_MAJOR 0x91
|
||||
#define PARAM_SW_MINOR 0x92
|
||||
#define PARAM_VTARGET 0x94
|
||||
#define PARAM_VADJUST 0x95 /* STK500 only */
|
||||
#define PARAM_OSC_PSCALE 0x96 /* STK500 only */
|
||||
#define PARAM_OSC_CMATCH 0x97 /* STK500 only */
|
||||
#define PARAM_SCK_DURATION 0x98 /* STK500 only */
|
||||
#define PARAM_TOPCARD_DETECT 0x9A /* STK500 only */
|
||||
#define PARAM_STATUS 0x9C /* STK500 only */
|
||||
#define PARAM_DATA 0x9D /* STK500 only */
|
||||
#define PARAM_RESET_POLARITY 0x9E /* STK500 only, and STK600 FW
|
||||
* version <= 2.0.3 */
|
||||
#define PARAM_VADJUST 0x95
|
||||
#define PARAM_OSC_PSCALE 0x96
|
||||
#define PARAM_OSC_CMATCH 0x97
|
||||
#define PARAM_SCK_DURATION 0x98
|
||||
#define PARAM_TOPCARD_DETECT 0x9A
|
||||
#define PARAM_STATUS 0x9C
|
||||
#define PARAM_DATA 0x9D
|
||||
#define PARAM_RESET_POLARITY 0x9E
|
||||
#define PARAM_CONTROLLER_INIT 0x9F
|
||||
|
||||
/* STK600 parameters */
|
||||
#define PARAM_STATUS_TGT_CONN 0xA1
|
||||
#define PARAM_DISCHARGEDELAY 0xA4
|
||||
#define PARAM_SOCKETCARD_ID 0xA5
|
||||
#define PARAM_ROUTINGCARD_ID 0xA6
|
||||
#define PARAM_EXPCARD_ID 0xA7
|
||||
#define PARAM_SW_MAJOR_SLAVE1 0xA8
|
||||
#define PARAM_SW_MINOR_SLAVE1 0xA9
|
||||
#define PARAM_SW_MAJOR_SLAVE2 0xAA
|
||||
#define PARAM_SW_MINOR_SLAVE2 0xAB
|
||||
#define PARAM_BOARD_ID_STATUS 0xAD
|
||||
#define PARAM_RESET 0xB4
|
||||
|
||||
#define PARAM_JTAG_ALLOW_FULL_PAGE_STREAM 0x50
|
||||
#define PARAM_JTAG_EEPROM_PAGE_SIZE 0x52
|
||||
#define PARAM_JTAG_DAISY_BITS_BEFORE 0x53
|
||||
#define PARAM_JTAG_DAISY_BITS_AFTER 0x54
|
||||
#define PARAM_JTAG_DAISY_UNITS_BEFORE 0x55
|
||||
#define PARAM_JTAG_DAISY_UNITS_AFTER 0x56
|
||||
|
||||
// *** Parameter constants for 2 byte values ***
|
||||
#define PARAM2_SCK_DURATION 0xC0
|
||||
#define PARAM2_CLOCK_CONF 0xC1
|
||||
#define PARAM2_AREF0 0xC2
|
||||
#define PARAM2_AREF1 0xC3
|
||||
|
||||
#define PARAM2_JTAG_FLASH_SIZE_H 0xC5
|
||||
#define PARAM2_JTAG_FLASH_SIZE_L 0xC6
|
||||
#define PARAM2_JTAG_FLASH_PAGE_SIZE 0xC7
|
||||
#define PARAM2_RC_ID_TABLE_REV 0xC8
|
||||
#define PARAM2_EC_ID_TABLE_REV 0xC9
|
||||
|
||||
/* STK600 XPROG section */
|
||||
// XPROG commands
|
||||
#define XPRG_CMD_ENTER_PROGMODE 0x01
|
||||
#define XPRG_CMD_LEAVE_PROGMODE 0x02
|
||||
#define XPRG_CMD_ERASE 0x03
|
||||
#define XPRG_CMD_WRITE_MEM 0x04
|
||||
#define XPRG_CMD_READ_MEM 0x05
|
||||
#define XPRG_CMD_CRC 0x06
|
||||
#define XPRG_CMD_SET_PARAM 0x07
|
||||
|
||||
// Memory types
|
||||
#define XPRG_MEM_TYPE_APPL 1
|
||||
#define XPRG_MEM_TYPE_BOOT 2
|
||||
#define XPRG_MEM_TYPE_EEPROM 3
|
||||
#define XPRG_MEM_TYPE_FUSE 4
|
||||
#define XPRG_MEM_TYPE_LOCKBITS 5
|
||||
#define XPRG_MEM_TYPE_USERSIG 6
|
||||
#define XPRG_MEM_TYPE_FACTORY_CALIBRATION 7
|
||||
|
||||
// Erase types
|
||||
#define XPRG_ERASE_CHIP 1
|
||||
#define XPRG_ERASE_APP 2
|
||||
#define XPRG_ERASE_BOOT 3
|
||||
#define XPRG_ERASE_EEPROM 4
|
||||
#define XPRG_ERASE_APP_PAGE 5
|
||||
#define XPRG_ERASE_BOOT_PAGE 6
|
||||
#define XPRG_ERASE_EEPROM_PAGE 7
|
||||
#define XPRG_ERASE_USERSIG 8
|
||||
|
||||
// Write mode flags
|
||||
#define XPRG_MEM_WRITE_ERASE 0
|
||||
#define XPRG_MEM_WRITE_WRITE 1
|
||||
|
||||
// CRC types
|
||||
#define XPRG_CRC_APP 1
|
||||
#define XPRG_CRC_BOOT 2
|
||||
#define XPRG_CRC_FLASH 3
|
||||
|
||||
// Error codes
|
||||
#define XPRG_ERR_OK 0
|
||||
#define XPRG_ERR_FAILED 1
|
||||
#define XPRG_ERR_COLLISION 2
|
||||
#define XPRG_ERR_TIMEOUT 3
|
||||
|
||||
// XPROG parameters of different sizes
|
||||
// 4-byte address
|
||||
#define XPRG_PARAM_NVMBASE 0x01
|
||||
// 2-byte page size
|
||||
#define XPRG_PARAM_EEPPAGESIZE 0x02
|
||||
|
||||
// *****************[ STK answer constants ]***************************
|
||||
|
||||
#define ANSWER_CKSUM_ERROR 0xB0
|
||||
|
||||
@@ -88,11 +88,6 @@ static int cmd_fosc (PROGRAMMER * pgm, struct avrpart * p,
|
||||
static int cmd_sck (PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char *argv[]);
|
||||
|
||||
static int cmd_spi (PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char *argv[]);
|
||||
|
||||
static int cmd_pgm (PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char *argv[]);
|
||||
|
||||
struct command cmd[] = {
|
||||
{ "dump", cmd_dump, "dump memory : %s <memtype> <addr> <N-Bytes>" },
|
||||
@@ -107,8 +102,6 @@ struct command cmd[] = {
|
||||
{ "varef", cmd_varef, "set <V[aref]> (STK500 only)" },
|
||||
{ "fosc", cmd_fosc, "set <oscillator frequency> (STK500 only)" },
|
||||
{ "sck", cmd_sck, "set <SCK period> (STK500 only)" },
|
||||
{ "spi", cmd_spi, "enter direct SPI mode" },
|
||||
{ "pgm", cmd_pgm, "return to programming mode" },
|
||||
{ "help", cmd_help, "help" },
|
||||
{ "?", cmd_help, "help" },
|
||||
{ "quit", cmd_quit, "quit" }
|
||||
@@ -118,7 +111,7 @@ struct command cmd[] = {
|
||||
|
||||
|
||||
|
||||
static int spi_mode = 0;
|
||||
|
||||
|
||||
static int nexttok(char * buf, char ** tok, char ** next)
|
||||
{
|
||||
@@ -452,18 +445,8 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (spi_mode && (pgm->spi == NULL)) {
|
||||
fprintf(stderr,
|
||||
"The %s programmer does not support direct SPI transfers.\n",
|
||||
pgm->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if ((argc > 5) || ((argc < 5) && (!spi_mode))) {
|
||||
fprintf(stderr, spi_mode?
|
||||
"Usage: send <byte1> [<byte2> [<byte3> [<byte4>]]]\n":
|
||||
"Usage: send <byte1> <byte2> <byte3> <byte4>\n");
|
||||
if (argc != 5) {
|
||||
fprintf(stderr, "Usage: send <byte1> <byte2> <byte3> <byte4>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -482,10 +465,7 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p,
|
||||
|
||||
pgm->err_led(pgm, OFF);
|
||||
|
||||
if (spi_mode)
|
||||
pgm->spi(pgm, cmd, res, argc-1);
|
||||
else
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
|
||||
/*
|
||||
* display results
|
||||
@@ -682,42 +662,25 @@ static int cmd_varef(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
int rc;
|
||||
unsigned int chan;
|
||||
double v;
|
||||
char *endp;
|
||||
|
||||
if (argc != 2 && argc != 3) {
|
||||
fprintf(stderr, "Usage: varef [channel] <value>\n");
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: varef <value>\n");
|
||||
return -1;
|
||||
}
|
||||
if (argc == 2) {
|
||||
chan = 0;
|
||||
v = strtod(argv[1], &endp);
|
||||
if (endp == argv[1]) {
|
||||
fprintf(stderr, "%s (varef): can't parse voltage \"%s\"\n",
|
||||
progname, argv[1]);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
chan = strtoul(argv[1], &endp, 10);
|
||||
if (endp == argv[1]) {
|
||||
fprintf(stderr, "%s (varef): can't parse channel \"%s\"\n",
|
||||
progname, argv[1]);
|
||||
return -1;
|
||||
}
|
||||
v = strtod(argv[2], &endp);
|
||||
if (endp == argv[2]) {
|
||||
fprintf(stderr, "%s (varef): can't parse voltage \"%s\"\n",
|
||||
progname, argv[2]);
|
||||
return -1;
|
||||
}
|
||||
v = strtod(argv[1], &endp);
|
||||
if (endp == argv[1]) {
|
||||
fprintf(stderr, "%s (varef): can't parse voltage \"%s\"\n",
|
||||
progname, argv[1]);
|
||||
return -1;
|
||||
}
|
||||
if (pgm->set_varef == NULL) {
|
||||
fprintf(stderr, "%s (varef): the %s programmer cannot set V[aref]\n",
|
||||
progname, pgm->type);
|
||||
return -2;
|
||||
}
|
||||
if ((rc = pgm->set_varef(pgm, chan, v)) != 0) {
|
||||
if ((rc = pgm->set_varef(pgm, v)) != 0) {
|
||||
fprintf(stderr, "%s (varef): failed to set V[aref] (rc = %d)\n",
|
||||
progname, rc);
|
||||
return -3;
|
||||
@@ -744,22 +707,6 @@ static int cmd_help(PROGRAMMER * pgm, struct avrpart * p,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_spi(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_RESET], 1);
|
||||
spi_mode = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_pgm(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_RESET], 0);
|
||||
spi_mode = 0;
|
||||
pgm->initialize(pgm, p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tokenize(char * s, char *** argv)
|
||||
{
|
||||
|
||||
@@ -112,7 +112,6 @@
|
||||
<!-- recursively then until everything has been done -->
|
||||
<xsl:template name="format-hex">
|
||||
<xsl:param name="arg" />
|
||||
<xsl:param name="count" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($arg) <= 4">
|
||||
<!-- Last element, print it, and leave template. -->
|
||||
|
||||
@@ -219,7 +219,6 @@
|
||||
-->
|
||||
<xsl:template name="format_cstack">
|
||||
<xsl:param name="stack" />
|
||||
<xsl:param name="count" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length($stack) <= 4">
|
||||
<!-- Last element, print it, and leave template. -->
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding='ISO-8859-1' ?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<!--
|
||||
* Copyright (c) 2008 Joerg Wunsch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
*
|
||||
* $Id$
|
||||
-->
|
||||
<!--
|
||||
* Extract STK600 routing and socket card information out of
|
||||
* targetboards.xml.
|
||||
*
|
||||
* Run this like:
|
||||
*
|
||||
* xsltproc -param what "'RC'" \
|
||||
* tools/get-stk600-cards.xsl targetboard.xml | sort -u
|
||||
*
|
||||
* xsltproc -param what "'SC'" \
|
||||
* tools/get-stk600-cards.xsl targetboard.xml | sort -u
|
||||
*
|
||||
* and copy&paste the results into the respective tables.
|
||||
-->
|
||||
<xsl:output method="text"/>
|
||||
<xsl:template match="/">
|
||||
<xsl:if test="$what = 'RC'">
|
||||
<xsl:for-each select="/STK600/ROUTING/CARD">
|
||||
<xsl:if test="RC_NAME != ''">
|
||||
<xsl:text> { </xsl:text>
|
||||
<xsl:value-of select="RC_ID" />
|
||||
<xsl:text>, "</xsl:text>
|
||||
<xsl:value-of select="RC_NAME" />
|
||||
<xsl:text>" },
</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each> <!-- All cards -->
|
||||
</xsl:if> <!-- Routing cards -->
|
||||
|
||||
<xsl:if test="$what = 'SC'">
|
||||
<xsl:for-each select="/STK600/ROUTING/CARD">
|
||||
<xsl:if test="SC_NAME != ''">
|
||||
<xsl:text> { </xsl:text>
|
||||
<xsl:value-of select="SC_ID" />
|
||||
<xsl:text>, "</xsl:text>
|
||||
<xsl:value-of select="SC_NAME" />
|
||||
<xsl:text>" },
</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each> <!-- All cards -->
|
||||
</xsl:if> <!-- Socket cards -->
|
||||
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding='ISO-8859-1' ?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<!--
|
||||
* Copyright (c) 2008 Joerg Wunsch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
*
|
||||
* $Id$
|
||||
-->
|
||||
<!--
|
||||
* Extract STK600 device support out of
|
||||
* targetboards.xml.
|
||||
*
|
||||
* Run this like:
|
||||
*
|
||||
* xsltproc \
|
||||
* tools/get-stk600-devices.xsl targetboard.xml
|
||||
*
|
||||
* and copy&paste the results into the respective table.
|
||||
-->
|
||||
<xsl:output method="text"/>
|
||||
<xsl:template match="/">
|
||||
<xsl:text>@multitable @columnfractions .15 .15 .6
</xsl:text>
|
||||
<xsl:text>Routing card @tab Socket card @tab Devices
</xsl:text>
|
||||
<xsl:for-each select="/STK600/ROUTING/CARD">
|
||||
<xsl:text>@item @code{</xsl:text>
|
||||
<xsl:value-of select="RC_NAME" />
|
||||
<xsl:text>} @tab @code{</xsl:text>
|
||||
<xsl:value-of select="SC_NAME" />
|
||||
<xsl:text>} @tab</xsl:text>
|
||||
<xsl:for-each select="TARGET">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="NAME" />
|
||||
</xsl:for-each>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:for-each> <!-- All cards -->
|
||||
<xsl:text>@end multitable
</xsl:text>
|
||||
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -51,7 +51,6 @@ UPDATE * parse_op(char * s)
|
||||
p = s;
|
||||
while ((i < (sizeof(buf)-1) && *p && (*p != ':')))
|
||||
buf[i++] = *p++;
|
||||
buf[i] = 0;
|
||||
|
||||
if (*p != ':') {
|
||||
upd->memtype = (char *)malloc(strlen("flash")+1);
|
||||
@@ -70,6 +69,8 @@ UPDATE * parse_op(char * s)
|
||||
return upd;
|
||||
}
|
||||
|
||||
buf[i] = 0;
|
||||
|
||||
upd->memtype = (char *)malloc(strlen(buf)+1);
|
||||
if (upd->memtype == NULL) {
|
||||
fprintf(stderr, "%s: out of memory\n", progname);
|
||||
|
||||
@@ -42,11 +42,6 @@
|
||||
#include "serial.h"
|
||||
#include "usbdevs.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
/* someone has defined "interface" to "struct" in Cygwin */
|
||||
# undef interface
|
||||
#endif
|
||||
|
||||
static char usbbuf[USBDEV_MAX_XFER];
|
||||
static int buflen = -1, bufptr;
|
||||
|
||||
@@ -64,7 +59,6 @@ static void usbdev_open(char * port, long baud, union filedescriptor *fd)
|
||||
struct usb_device *dev;
|
||||
usb_dev_handle *udev;
|
||||
char *serno, *cp2;
|
||||
int i;
|
||||
size_t x;
|
||||
|
||||
/*
|
||||
@@ -193,33 +187,7 @@ static void usbdev_open(char * port, long baud, union filedescriptor *fd)
|
||||
goto trynext;
|
||||
}
|
||||
|
||||
fd->usb.handle = udev;
|
||||
fd->usb.ep = -1;
|
||||
/* Try finding out what our read endpoint is. */
|
||||
for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++)
|
||||
{
|
||||
int possible_ep = dev->config[0].interface[0].altsetting[0].
|
||||
endpoint[i].bEndpointAddress;
|
||||
|
||||
if ((possible_ep & USB_ENDPOINT_DIR_MASK) != 0)
|
||||
{
|
||||
if (verbose > 1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: usbdev_open(): using read endpoint 0x%02x\n",
|
||||
progname, possible_ep);
|
||||
}
|
||||
fd->usb.ep = possible_ep;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fd->usb.ep == -1)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: usbdev_open(): cannot find a read endpoint, using 0x%02x\n",
|
||||
progname, USBDEV_BULK_EP_READ);
|
||||
fd->usb.ep = USBDEV_BULK_EP_READ;
|
||||
}
|
||||
fd->pfd = udev;
|
||||
return;
|
||||
}
|
||||
trynext:
|
||||
@@ -235,18 +203,15 @@ static void usbdev_open(char * port, long baud, union filedescriptor *fd)
|
||||
|
||||
static void usbdev_close(union filedescriptor *fd)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
|
||||
(void)usb_release_interface(udev, usb_interface);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
/*
|
||||
* Without this reset, the AVRISP mkII seems to stall the second
|
||||
* time we try to connect to it. This is not necessary on
|
||||
* FreeBSD.
|
||||
* time we try to connect to it.
|
||||
*/
|
||||
usb_reset(udev);
|
||||
#endif
|
||||
|
||||
usb_close(udev);
|
||||
}
|
||||
@@ -254,7 +219,7 @@ static void usbdev_close(union filedescriptor *fd)
|
||||
|
||||
static int usbdev_send(union filedescriptor *fd, unsigned char *bp, size_t mlen)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int rv;
|
||||
int i = mlen;
|
||||
unsigned char * p = bp;
|
||||
@@ -311,11 +276,11 @@ static int usbdev_send(union filedescriptor *fd, unsigned char *bp, size_t mlen)
|
||||
* empty and more data are requested.
|
||||
*/
|
||||
static int
|
||||
usb_fill_buf(usb_dev_handle *udev, int ep)
|
||||
usb_fill_buf(usb_dev_handle *udev)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = usb_bulk_read(udev, ep, usbbuf, USBDEV_MAX_XFER, 5000);
|
||||
rv = usb_bulk_read(udev, USBDEV_BULK_EP_READ, usbbuf, USBDEV_MAX_XFER, 5000);
|
||||
if (rv < 0)
|
||||
{
|
||||
if (verbose > 1)
|
||||
@@ -332,7 +297,7 @@ usb_fill_buf(usb_dev_handle *udev, int ep)
|
||||
|
||||
static int usbdev_recv(union filedescriptor *fd, unsigned char *buf, size_t nbytes)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int i, amnt;
|
||||
unsigned char * p = buf;
|
||||
|
||||
@@ -340,7 +305,7 @@ static int usbdev_recv(union filedescriptor *fd, unsigned char *buf, size_t nbyt
|
||||
{
|
||||
if (buflen <= bufptr)
|
||||
{
|
||||
if (usb_fill_buf(udev, fd->usb.ep) < 0)
|
||||
if (usb_fill_buf(udev) < 0)
|
||||
return -1;
|
||||
}
|
||||
amnt = buflen - bufptr > nbytes? nbytes: buflen - bufptr;
|
||||
@@ -384,7 +349,7 @@ static int usbdev_recv(union filedescriptor *fd, unsigned char *buf, size_t nbyt
|
||||
*/
|
||||
static int usbdev_recv_frame(union filedescriptor *fd, unsigned char *buf, size_t nbytes)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int rv, n;
|
||||
int i;
|
||||
unsigned char * p = buf;
|
||||
@@ -392,7 +357,7 @@ static int usbdev_recv_frame(union filedescriptor *fd, unsigned char *buf, size_
|
||||
n = 0;
|
||||
do
|
||||
{
|
||||
rv = usb_bulk_read(udev, fd->usb.ep, usbbuf,
|
||||
rv = usb_bulk_read(udev, USBDEV_BULK_EP_READ, usbbuf,
|
||||
USBDEV_MAX_XFER, 10000);
|
||||
if (rv < 0)
|
||||
{
|
||||
@@ -441,11 +406,11 @@ static int usbdev_recv_frame(union filedescriptor *fd, unsigned char *buf, size_
|
||||
|
||||
static int usbdev_drain(union filedescriptor *fd, int display)
|
||||
{
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->usb.handle;
|
||||
usb_dev_handle *udev = (usb_dev_handle *)fd->pfd;
|
||||
int rv;
|
||||
|
||||
do {
|
||||
rv = usb_bulk_read(udev, fd->usb.ep, usbbuf, USBDEV_MAX_XFER, 100);
|
||||
rv = usb_bulk_read(udev, USBDEV_BULK_EP_READ, usbbuf, USBDEV_MAX_XFER, 100);
|
||||
if (rv > 0 && verbose >= 4)
|
||||
fprintf(stderr, "%s: usbdev_drain(): flushed %d characters\n",
|
||||
progname, rv);
|
||||
|
||||
169
avrdude/usbasp.c
169
avrdude/usbasp.c
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2006 Thomas Fischl
|
||||
* Copyright 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -42,47 +41,21 @@
|
||||
#ifdef HAVE_LIBUSB
|
||||
#include <usb.h>
|
||||
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
usb_dev_handle *usbhandle;
|
||||
};
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
|
||||
static void usbasp_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: usbasp_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
}
|
||||
|
||||
static void usbasp_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
static usb_dev_handle *usbhandle;
|
||||
|
||||
/*
|
||||
* wrapper for usb_control_msg call
|
||||
*/
|
||||
static int usbasp_transmit(PROGRAMMER * pgm,
|
||||
unsigned char receive, unsigned char functionid,
|
||||
static int usbasp_transmit(unsigned char receive, unsigned char functionid,
|
||||
unsigned char send[4], unsigned char * buffer, int buffersize)
|
||||
{
|
||||
int nbytes;
|
||||
nbytes = usb_control_msg(PDATA(pgm)->usbhandle,
|
||||
nbytes = usb_control_msg(usbhandle,
|
||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE | (receive << 7),
|
||||
functionid,
|
||||
(send[1] << 8) | send[0],
|
||||
(send[3] << 8) | send[2],
|
||||
(char *)buffer, buffersize,
|
||||
buffer, buffersize,
|
||||
5000);
|
||||
if(nbytes < 0){
|
||||
fprintf(stderr, "%s: error: usbasp_transmit: %s\n", progname, usb_strerror());
|
||||
@@ -185,11 +158,11 @@ static int usbasp_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
usb_init();
|
||||
|
||||
if (usbOpenDevice(&PDATA(pgm)->usbhandle, USBASP_SHARED_VID, "www.fischl.de",
|
||||
if (usbOpenDevice(&usbhandle, USBASP_SHARED_VID, "www.fischl.de",
|
||||
USBASP_SHARED_PID, "USBasp") != 0) {
|
||||
|
||||
/* check if device with old VID/PID is available */
|
||||
if (usbOpenDevice(&PDATA(pgm)->usbhandle, USBASP_OLD_VID, "www.fischl.de",
|
||||
if (usbOpenDevice(&usbhandle, USBASP_OLD_VID, "www.fischl.de",
|
||||
USBASP_OLD_PID, "USBasp") != 0) {
|
||||
|
||||
/* no USBasp found */
|
||||
@@ -217,9 +190,9 @@ static void usbasp_close(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char temp[4];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_DISCONNECT, temp, temp, sizeof(temp));
|
||||
usbasp_transmit(1, USBASP_FUNC_DISCONNECT, temp, temp, sizeof(temp));
|
||||
|
||||
usb_close(PDATA(pgm)->usbhandle);
|
||||
usb_close(usbhandle);
|
||||
}
|
||||
|
||||
|
||||
@@ -228,14 +201,8 @@ static int usbasp_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
unsigned char temp[4];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
usbasp_transmit(1, USBASP_FUNC_CONNECT, temp, temp, sizeof(temp));
|
||||
|
||||
/* set sck period */
|
||||
pgm->set_sck_period(pgm, pgm->bitclock);
|
||||
|
||||
/* connect to target device */
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_CONNECT, temp, temp, sizeof(temp));
|
||||
|
||||
/* wait, so device is ready to receive commands */
|
||||
usleep(100000);
|
||||
|
||||
return pgm->program_enable(pgm, p);
|
||||
@@ -265,7 +232,7 @@ static int usbasp_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
{
|
||||
int nbytes =
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_TRANSMIT, cmd, res, sizeof(res));
|
||||
usbasp_transmit(1, USBASP_FUNC_TRANSMIT, cmd, res, sizeof(res));
|
||||
|
||||
if(nbytes != 4){
|
||||
fprintf(stderr, "%s: error: wrong responds size\n",
|
||||
@@ -287,7 +254,7 @@ static int usbasp_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
cmd[0] = 0;
|
||||
|
||||
int nbytes =
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_ENABLEPROG, cmd, res, sizeof(res));
|
||||
usbasp_transmit(1, USBASP_FUNC_ENABLEPROG, cmd, res, sizeof(res));
|
||||
|
||||
if ((nbytes != 1) | (res[0] != 0)) {
|
||||
fprintf(stderr, "%s: error: programm enable: target doesn't answer. %x \n",
|
||||
@@ -349,24 +316,10 @@ static int usbasp_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
wbytes = 0;
|
||||
}
|
||||
|
||||
/* set address (new mode) - if firmware on usbasp support newmode, then they use address from this command */
|
||||
unsigned char temp[4];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
cmd[2] = address >> 16;
|
||||
cmd[3] = address >> 24;
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_SETLONGADDRESS, cmd, temp, sizeof(temp));
|
||||
|
||||
/* send command with address (compatibility mode) - if firmware on
|
||||
usbasp doesn't support newmode, then they use address from this */
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
// for compatibility - previous version of usbasp.c doesn't initialize this fields (firmware ignore it)
|
||||
cmd[2] = 0;
|
||||
cmd[3] = 0;
|
||||
|
||||
n = usbasp_transmit(pgm, 1, function, cmd, buffer, blocksize);
|
||||
n = usbasp_transmit(1, function, cmd, buffer, blocksize);
|
||||
|
||||
if (n != blocksize) {
|
||||
fprintf(stderr, "%s: error: wrong reading bytes %x\n",
|
||||
@@ -413,26 +366,13 @@ static int usbasp_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
blockflags |= USBASP_BLOCKFLAG_LAST;
|
||||
}
|
||||
|
||||
/* set address (new mode) - if firmware on usbasp support newmode, then
|
||||
they use address from this command */
|
||||
unsigned char temp[4];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
cmd[2] = address >> 16;
|
||||
cmd[3] = address >> 24;
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_SETLONGADDRESS, cmd, temp, sizeof(temp));
|
||||
|
||||
/* normal command - firmware what support newmode - use address from previous command,
|
||||
firmware what doesn't support newmode - ignore previous command and use address from this command */
|
||||
|
||||
cmd[0] = address & 0xFF;
|
||||
cmd[1] = address >> 8;
|
||||
cmd[2] = page_size & 0xFF;
|
||||
cmd[3] = (blockflags & 0x0F) + ((page_size & 0xF00) >> 4); //TP: Mega128 fix
|
||||
blockflags = 0;
|
||||
|
||||
n = usbasp_transmit(pgm, 0, function, cmd, buffer, blocksize);
|
||||
n = usbasp_transmit(0, function, cmd, buffer, blocksize);
|
||||
|
||||
if (n != blocksize) {
|
||||
fprintf(stderr, "%s: error: wrong count at writing %x\n",
|
||||
@@ -450,86 +390,6 @@ static int usbasp_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
|
||||
/* The list of SCK frequencies in kHz supported by USBasp */
|
||||
static struct sckoptions_t usbaspSCKoptions[] = {
|
||||
{ USBASP_ISP_SCK_1500, 1500 },
|
||||
{ USBASP_ISP_SCK_750, 750 },
|
||||
{ USBASP_ISP_SCK_375, 375 },
|
||||
{ USBASP_ISP_SCK_187_5, 187.5 },
|
||||
{ USBASP_ISP_SCK_93_75, 93.75 },
|
||||
{ USBASP_ISP_SCK_32, 32 },
|
||||
{ USBASP_ISP_SCK_16, 16 },
|
||||
{ USBASP_ISP_SCK_8, 8 },
|
||||
{ USBASP_ISP_SCK_4, 4 },
|
||||
{ USBASP_ISP_SCK_2, 2 },
|
||||
{ USBASP_ISP_SCK_1, 1 },
|
||||
{ USBASP_ISP_SCK_0_5, 0.5 }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Set sck period (in seconds)
|
||||
* Find next possible sck period and write it to the programmer.
|
||||
*/
|
||||
static int usbasp_set_sck_period(PROGRAMMER *pgm, double sckperiod)
|
||||
{
|
||||
char clockoption = USBASP_ISP_SCK_AUTO;
|
||||
unsigned char res[4];
|
||||
unsigned char cmd[4];
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
memset(res, 0, sizeof(res));
|
||||
|
||||
if (sckperiod == 0) {
|
||||
/* auto sck set */
|
||||
|
||||
if (verbose >= 1)
|
||||
fprintf(stderr, "%s: auto set sck period (because given equals null)\n", progname);
|
||||
|
||||
} else {
|
||||
|
||||
double sckfreq = 1 / sckperiod / 1000; /* sck in kHz */
|
||||
double usefreq = 0;
|
||||
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: try to set SCK period to %g s (= %g kHz)\n", progname, sckperiod, sckfreq);
|
||||
|
||||
if (sckperiod >= 1500) {
|
||||
clockoption = USBASP_ISP_SCK_1500;
|
||||
usefreq = 1500;
|
||||
|
||||
} else {
|
||||
|
||||
/* find clock option next to given clock */
|
||||
int i;
|
||||
for (i = 0; i < sizeof(usbaspSCKoptions) / sizeof(usbaspSCKoptions[0]); i++) {
|
||||
if (sckfreq >= usbaspSCKoptions[i].frequency) {
|
||||
clockoption = usbaspSCKoptions[i].id;
|
||||
usefreq = usbaspSCKoptions[i].frequency;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: set SCK frequency to %g kHz\n", progname, usefreq);
|
||||
}
|
||||
|
||||
cmd[0] = clockoption;
|
||||
|
||||
int nbytes =
|
||||
usbasp_transmit(pgm, 1, USBASP_FUNC_SETISPSCK, cmd, res, sizeof(res));
|
||||
|
||||
if ((nbytes != 1) | (res[0] != 0)) {
|
||||
fprintf(stderr, "%s: warning: cannot set sck period. please check for usbasp firmware update.\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void usbasp_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "usbasp");
|
||||
@@ -556,9 +416,6 @@ void usbasp_initpgm(PROGRAMMER * pgm)
|
||||
|
||||
pgm->paged_write = usbasp_paged_write;
|
||||
pgm->paged_load = usbasp_paged_load;
|
||||
pgm->setup = usbasp_setup;
|
||||
pgm->teardown = usbasp_teardown;
|
||||
pgm->set_sck_period = usbasp_set_sck_period;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,13 @@
|
||||
|
||||
#include "avrpart.h"
|
||||
|
||||
/* USB identifiers */
|
||||
|
||||
#define USBASP_SHARED_VID 0x16C0 /* VOTI */
|
||||
#define USBASP_SHARED_PID 0x05DC /* Obdev's free shared PID */
|
||||
|
||||
#define USBASP_OLD_VID 0x03EB /* ATMEL */
|
||||
#define USBASP_OLD_PID 0xC7B4 /* (unoffical) USBasp */
|
||||
|
||||
/* USB function call identifiers */
|
||||
#define USBASP_FUNC_CONNECT 1
|
||||
#define USBASP_FUNC_DISCONNECT 2
|
||||
#define USBASP_FUNC_TRANSMIT 3
|
||||
@@ -40,38 +39,13 @@
|
||||
#define USBASP_FUNC_WRITEFLASH 6
|
||||
#define USBASP_FUNC_READEEPROM 7
|
||||
#define USBASP_FUNC_WRITEEEPROM 8
|
||||
#define USBASP_FUNC_SETLONGADDRESS 9
|
||||
#define USBASP_FUNC_SETISPSCK 10
|
||||
|
||||
/* Block mode flags */
|
||||
#define USBASP_BLOCKFLAG_FIRST 1
|
||||
#define USBASP_BLOCKFLAG_LAST 2
|
||||
|
||||
/* Block mode data size */
|
||||
#define USBASP_READBLOCKSIZE 200
|
||||
#define USBASP_WRITEBLOCKSIZE 200
|
||||
|
||||
/* ISP SCK speed identifiers */
|
||||
#define USBASP_ISP_SCK_AUTO 0
|
||||
#define USBASP_ISP_SCK_0_5 1 /* 500 Hz */
|
||||
#define USBASP_ISP_SCK_1 2 /* 1 kHz */
|
||||
#define USBASP_ISP_SCK_2 3 /* 2 kHz */
|
||||
#define USBASP_ISP_SCK_4 4 /* 4 kHz */
|
||||
#define USBASP_ISP_SCK_8 5 /* 8 kHz */
|
||||
#define USBASP_ISP_SCK_16 6 /* 16 kHz */
|
||||
#define USBASP_ISP_SCK_32 7 /* 32 kHz */
|
||||
#define USBASP_ISP_SCK_93_75 8 /* 93.75 kHz */
|
||||
#define USBASP_ISP_SCK_187_5 9 /* 187.5 kHz */
|
||||
#define USBASP_ISP_SCK_375 10 /* 375 kHz */
|
||||
#define USBASP_ISP_SCK_750 11 /* 750 kHz */
|
||||
#define USBASP_ISP_SCK_1500 12 /* 1.5 MHz */
|
||||
|
||||
typedef struct sckoptions_t {
|
||||
int id;
|
||||
double frequency;
|
||||
} CLOCKOPTIONS;
|
||||
|
||||
/* USB error identifiers */
|
||||
#define USB_ERROR_NOTFOUND 1
|
||||
#define USB_ERROR_ACCESS 2
|
||||
#define USB_ERROR_IO 3
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#define USB_VENDOR_ATMEL 1003
|
||||
#define USB_DEVICE_JTAGICEMKII 0x2103
|
||||
#define USB_DEVICE_AVRISPMKII 0x2104
|
||||
#define USB_DEVICE_STK600 0x2106
|
||||
#define USB_DEVICE_AVRDRAGON 0x2107
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,552 +0,0 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2007 Dick Streefland, adapted for 5.4 by Limor Fried
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Driver for "usbtiny"-type programmers
|
||||
* Please see http://www.xs4all.nl/~dicks/avr/usbtiny/
|
||||
* and http://www.ladyada.net/make/usbtinyisp/
|
||||
* For example schematics and detailed documentation
|
||||
*/
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
#include "pgm.h"
|
||||
#include "usbtiny.h"
|
||||
|
||||
#if defined(HAVE_LIBUSB) // we use LIBUSB to talk to the board
|
||||
#include <usb.h>
|
||||
|
||||
#ifndef HAVE_UINT_T
|
||||
typedef unsigned int uint_t;
|
||||
#endif
|
||||
#ifndef HAVE_ULONG_T
|
||||
typedef unsigned long ulong_t;
|
||||
#endif
|
||||
|
||||
extern int avr_write_byte_default ( PROGRAMMER* pgm, AVRPART* p,
|
||||
AVRMEM* mem, ulong_t addr,
|
||||
unsigned char data );
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
usb_dev_handle *usb_handle;
|
||||
int sck_period;
|
||||
int chunk_size;
|
||||
int retries;
|
||||
};
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
static void usbtiny_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: usbtiny_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
}
|
||||
|
||||
static void usbtiny_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
// Wrapper for simple usb_control_msg messages
|
||||
static int usb_control (PROGRAMMER * pgm,
|
||||
unsigned int requestid, unsigned int val, unsigned int index )
|
||||
{
|
||||
int nbytes;
|
||||
nbytes = usb_control_msg( PDATA(pgm)->usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
requestid,
|
||||
val, index, // 2 bytes each of data
|
||||
NULL, 0, // no data buffer in control messge
|
||||
USB_TIMEOUT ); // default timeout
|
||||
if(nbytes < 0){
|
||||
fprintf(stderr, "\n%s: error: usbtiny_transmit: %s\n", progname, usb_strerror());
|
||||
return -1;
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
// Wrapper for simple usb_control_msg messages to receive data from programmer
|
||||
static int usb_in (PROGRAMMER * pgm,
|
||||
unsigned int requestid, unsigned int val, unsigned int index,
|
||||
unsigned char* buffer, int buflen, int bitclk )
|
||||
{
|
||||
int nbytes;
|
||||
int timeout;
|
||||
int i;
|
||||
|
||||
// calculate the amout of time we expect the process to take by
|
||||
// figuring the bit-clock time and buffer size and adding to the standard USB timeout.
|
||||
timeout = USB_TIMEOUT + (buflen * bitclk) / 1000;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
nbytes = usb_control_msg( PDATA(pgm)->usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
requestid,
|
||||
val, index,
|
||||
(char *)buffer, buflen,
|
||||
timeout);
|
||||
if (nbytes == buflen) {
|
||||
return nbytes;
|
||||
}
|
||||
PDATA(pgm)->retries++;
|
||||
}
|
||||
fprintf(stderr, "\n%s: error: usbtiny_receive: %s (expected %d, got %d)\n",
|
||||
progname, usb_strerror(), buflen, nbytes);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Report the number of retries, and reset the counter.
|
||||
static void check_retries (PROGRAMMER * pgm, const char* operation)
|
||||
{
|
||||
if (PDATA(pgm)->retries > 0 && quell_progress < 2) {
|
||||
printf("%s: %d retries during %s\n", progname,
|
||||
PDATA(pgm)->retries, operation);
|
||||
}
|
||||
PDATA(pgm)->retries = 0;
|
||||
}
|
||||
|
||||
// Wrapper for simple usb_control_msg messages to send data to programmer
|
||||
static int usb_out (PROGRAMMER * pgm,
|
||||
unsigned int requestid, unsigned int val, unsigned int index,
|
||||
unsigned char* buffer, int buflen, int bitclk )
|
||||
{
|
||||
int nbytes;
|
||||
int timeout;
|
||||
|
||||
// calculate the amout of time we expect the process to take by
|
||||
// figuring the bit-clock time and buffer size and adding to the standard USB timeout.
|
||||
timeout = USB_TIMEOUT + (buflen * bitclk) / 1000;
|
||||
|
||||
nbytes = usb_control_msg( PDATA(pgm)->usb_handle,
|
||||
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
requestid,
|
||||
val, index,
|
||||
(char *)buffer, buflen,
|
||||
timeout);
|
||||
if (nbytes != buflen) {
|
||||
fprintf(stderr, "\n%s: error: usbtiny_send: %s (expected %d, got %d)\n",
|
||||
progname, usb_strerror(), buflen, nbytes);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
// Sometimes we just need to know the SPI command for the part to perform
|
||||
// a function. Here we wrap this request for an operation so that we
|
||||
// can just specify the part and operation and it'll do the right stuff
|
||||
// to get the information from AvrDude and send to the USBtiny
|
||||
static int usbtiny_avr_op (PROGRAMMER * pgm, AVRPART * p,
|
||||
int op,
|
||||
unsigned char res[4])
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
|
||||
if (p->op[op] == NULL) {
|
||||
fprintf( stderr, "Operation %d not defined for this chip!\n", op );
|
||||
return -1;
|
||||
}
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
avr_set_bits(p->op[op], cmd);
|
||||
|
||||
return pgm->cmd(pgm, cmd, res);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/* Find a device with the correct VID/PID match for USBtiny */
|
||||
|
||||
static int usbtiny_open(PROGRAMMER* pgm, char* name)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *dev = 0;
|
||||
|
||||
usb_init(); // initialize the libusb system
|
||||
usb_find_busses(); // have libusb scan all the usb busses available
|
||||
usb_find_devices(); // have libusb scan all the usb devices available
|
||||
|
||||
PDATA(pgm)->usb_handle = NULL;
|
||||
|
||||
// now we iterate through all the busses and devices
|
||||
for ( bus = usb_busses; bus; bus = bus->next ) {
|
||||
for ( dev = bus->devices; dev; dev = dev->next ) {
|
||||
if (dev->descriptor.idVendor == USBTINY_VENDOR
|
||||
&& dev->descriptor.idProduct == USBTINY_PRODUCT ) { // found match?
|
||||
|
||||
PDATA(pgm)->usb_handle = usb_open(dev); // attempt to connect to device
|
||||
|
||||
// wrong permissions or something?
|
||||
if (!PDATA(pgm)->usb_handle) {
|
||||
fprintf(stderr, "%s: Warning: cannot open USB device: %s\n",
|
||||
progname, usb_strerror());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!PDATA(pgm)->usb_handle) {
|
||||
fprintf( stderr, "%s: Error: Could not find USBtiny device (0x%x/0x%x)\n",
|
||||
progname, USBTINY_VENDOR, USBTINY_PRODUCT );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0; // If we got here, we must have found a good USB device
|
||||
}
|
||||
|
||||
/* Clean up the handle for the usbtiny */
|
||||
static void usbtiny_close ( PROGRAMMER* pgm )
|
||||
{
|
||||
if (! PDATA(pgm)->usb_handle) {
|
||||
return; // not a valid handle, bail!
|
||||
}
|
||||
usb_close(PDATA(pgm)->usb_handle); // ask libusb to clean up
|
||||
PDATA(pgm)->usb_handle = NULL;
|
||||
}
|
||||
|
||||
/* A simple calculator function determines the maximum size of data we can
|
||||
shove through a USB connection without getting errors */
|
||||
static void usbtiny_set_chunk_size (PROGRAMMER * pgm, int period)
|
||||
{
|
||||
PDATA(pgm)->chunk_size = CHUNK_SIZE; // start with the maximum (default)
|
||||
while (PDATA(pgm)->chunk_size > 8 && period > 16) {
|
||||
// Reduce the chunk size for a slow SCK to reduce
|
||||
// the maximum time of a single USB transfer.
|
||||
PDATA(pgm)->chunk_size >>= 1;
|
||||
period >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Given a SCK bit-clock speed (in useconds) we verify its an OK speed and tell the
|
||||
USBtiny to update itself to the new frequency */
|
||||
static int usbtiny_set_sck_period (PROGRAMMER *pgm, double v)
|
||||
{
|
||||
PDATA(pgm)->sck_period = (int)(v * 1e6 + 0.5); // convert from us to 'int', the 0.5 is for rounding up
|
||||
|
||||
// Make sure its not 0, as that will confuse the usbtiny
|
||||
if (PDATA(pgm)->sck_period < SCK_MIN)
|
||||
PDATA(pgm)->sck_period = SCK_MIN;
|
||||
|
||||
// We can't go slower, due to the byte-size of the clock variable
|
||||
if (PDATA(pgm)->sck_period > SCK_MAX)
|
||||
PDATA(pgm)->sck_period = SCK_MAX;
|
||||
|
||||
if (verbose) {
|
||||
printf( "%s: Setting SCK period to %d usec\n", progname,
|
||||
PDATA(pgm)->sck_period );
|
||||
}
|
||||
|
||||
// send the command to the usbtiny device.
|
||||
// MEME: for at90's fix resetstate?
|
||||
if (usb_control(pgm, USBTINY_POWERUP, PDATA(pgm)->sck_period, RESET_LOW) < 0)
|
||||
return -1;
|
||||
|
||||
// with the new speed, we'll have to update how much data we send per usb transfer
|
||||
usbtiny_set_chunk_size(pgm, PDATA(pgm)->sck_period);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int usbtiny_initialize (PROGRAMMER *pgm, AVRPART *p )
|
||||
{
|
||||
unsigned char res[4]; // store the response from usbtinyisp
|
||||
|
||||
// Check for bit-clock and tell the usbtiny to adjust itself
|
||||
if (pgm->bitclock > 0.0) {
|
||||
// -B option specified: convert to valid range for sck_period
|
||||
usbtiny_set_sck_period(pgm, pgm->bitclock);
|
||||
} else {
|
||||
// -B option not specified: use default
|
||||
PDATA(pgm)->sck_period = SCK_DEFAULT;
|
||||
if (verbose) {
|
||||
printf( "%s: Using SCK period of %d usec\n",
|
||||
progname, PDATA(pgm)->sck_period );
|
||||
}
|
||||
if (usb_control(pgm, USBTINY_POWERUP,
|
||||
PDATA(pgm)->sck_period, RESET_LOW ) < 0)
|
||||
return -1;
|
||||
usbtiny_set_chunk_size(pgm, PDATA(pgm)->sck_period);
|
||||
}
|
||||
|
||||
// Let the device wake up.
|
||||
usleep(50000);
|
||||
|
||||
// Attempt to use the underlying avrdude methods to connect (MEME: is this kosher?)
|
||||
if (! usbtiny_avr_op(pgm, p, AVR_OP_PGM_ENABLE, res)) {
|
||||
// no response, RESET and try again
|
||||
if (usb_control(pgm, USBTINY_POWERUP,
|
||||
PDATA(pgm)->sck_period, RESET_HIGH) < 0 ||
|
||||
usb_control(pgm, USBTINY_POWERUP,
|
||||
PDATA(pgm)->sck_period, RESET_LOW) < 0)
|
||||
return -1;
|
||||
usleep(50000);
|
||||
if ( ! usbtiny_avr_op( pgm, p, AVR_OP_PGM_ENABLE, res)) {
|
||||
// give up
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Tell the USBtiny to release the output pins, etc */
|
||||
static void usbtiny_powerdown(PROGRAMMER * pgm)
|
||||
{
|
||||
if (!PDATA(pgm)->usb_handle) {
|
||||
return; // wasn't connected in the first place
|
||||
}
|
||||
usb_control(pgm, USBTINY_POWERDOWN, 0, 0); // Send USB control command to device
|
||||
}
|
||||
|
||||
/* Send a 4-byte SPI command to the USBtinyISP for execution
|
||||
This procedure is used by higher-level Avrdude procedures */
|
||||
static int usbtiny_cmd(PROGRAMMER * pgm, unsigned char cmd[4], unsigned char res[4])
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
// Make sure its empty so we don't read previous calls if it fails
|
||||
memset(res, '\0', 4 );
|
||||
|
||||
nbytes = usb_in( pgm, USBTINY_SPI,
|
||||
(cmd[1] << 8) | cmd[0], // convert to 16-bit words
|
||||
(cmd[3] << 8) | cmd[2], // "
|
||||
res, 4, 8 * PDATA(pgm)->sck_period );
|
||||
if (nbytes < 0)
|
||||
return -1;
|
||||
check_retries(pgm, "SPI command");
|
||||
if (verbose > 1) {
|
||||
// print out the data we sent and received
|
||||
printf( "CMD: [%02x %02x %02x %02x] [%02x %02x %02x %02x]\n",
|
||||
cmd[0], cmd[1], cmd[2], cmd[3],
|
||||
res[0], res[1], res[2], res[3] );
|
||||
}
|
||||
return ((nbytes == 4) && // should have read 4 bytes
|
||||
res[2] == cmd[1]); // AVR's do a delayed-echo thing
|
||||
}
|
||||
|
||||
/* Send the chip-erase command */
|
||||
static int usbtiny_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
unsigned char res[4];
|
||||
|
||||
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
|
||||
fprintf(stderr, "Chip erase instruction not defined for part \"%s\"\n",
|
||||
p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// get the command for erasing this chip and transmit to avrdude
|
||||
if (! usbtiny_avr_op( pgm, p, AVR_OP_CHIP_ERASE, res )) {
|
||||
return -1;
|
||||
}
|
||||
usleep( p->chip_erase_delay );
|
||||
|
||||
// prepare for further instruction
|
||||
pgm->initialize(pgm, p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// These are required functions but don't actually do anything
|
||||
static void usbtiny_enable ( PROGRAMMER* pgm ) {}
|
||||
|
||||
static void usbtiny_disable ( PROGRAMMER* pgm ) {}
|
||||
|
||||
|
||||
/* To speed up programming and reading, we do a 'chunked' read.
|
||||
* We request just the data itself and the USBtiny uses the SPI function
|
||||
* given to read in the data. Much faster than sending a 4-byte SPI request
|
||||
* per byte
|
||||
*/
|
||||
static int usbtiny_paged_load (PROGRAMMER * pgm, AVRPART * p, AVRMEM* m,
|
||||
int page_size, int n_bytes )
|
||||
{
|
||||
int i;
|
||||
int chunk;
|
||||
int function;
|
||||
|
||||
|
||||
// First determine what we're doing
|
||||
if (strcmp( m->desc, "flash" ) == 0) {
|
||||
function = USBTINY_FLASH_READ;
|
||||
} else {
|
||||
function = USBTINY_EEPROM_READ;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_bytes; i += chunk) {
|
||||
chunk = PDATA(pgm)->chunk_size; // start with the maximum chunk size possible
|
||||
|
||||
// If we want to xmit less than a chunk, thats OK
|
||||
if (chunk > n_bytes-i)
|
||||
chunk = n_bytes - i;
|
||||
|
||||
// Send the chunk of data to the USBtiny with the function we want
|
||||
// to perform
|
||||
if (usb_in(pgm,
|
||||
function, // EEPROM or flash
|
||||
0, // delay between SPI commands
|
||||
i, // index
|
||||
m->buf + i, // pointer to where we store data
|
||||
chunk, // number of bytes
|
||||
32 * PDATA(pgm)->sck_period) // each byte gets turned into a 4-byte SPI cmd
|
||||
< 0) {
|
||||
// usb_in() multiplies this per byte.
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Tell avrdude how we're doing to provide user feedback
|
||||
report_progress(i + chunk, n_bytes, NULL );
|
||||
}
|
||||
|
||||
check_retries(pgm, "read");
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
/* To speed up programming and reading, we do a 'chunked' write.
|
||||
* We send just the data itself and the USBtiny uses the SPI function
|
||||
* given to write the data. Much faster than sending a 4-byte SPI request
|
||||
* per byte.
|
||||
*/
|
||||
static int usbtiny_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
{
|
||||
int i;
|
||||
int chunk; // Size of data to write at once
|
||||
int next;
|
||||
int function; // which SPI command to use
|
||||
int delay; // delay required between SPI commands
|
||||
|
||||
// First determine what we're doing
|
||||
if (strcmp( m->desc, "flash" ) == 0) {
|
||||
function = USBTINY_FLASH_WRITE;
|
||||
} else {
|
||||
function = USBTINY_EEPROM_WRITE;
|
||||
}
|
||||
|
||||
delay = 0;
|
||||
if (! m->paged) {
|
||||
// Does this chip not support paged writes?
|
||||
i = (m->readback[1] << 8) | m->readback[0];
|
||||
if (usb_control(pgm, USBTINY_POLL_BYTES, i, 0 ) < 0)
|
||||
return -1;
|
||||
delay = m->max_write_delay;
|
||||
}
|
||||
|
||||
for (i=0; i < n_bytes; i=next) {
|
||||
// start with the max chunk size
|
||||
chunk = PDATA(pgm)->chunk_size;
|
||||
|
||||
// we can only write a page at a time anyways
|
||||
if (m->paged && chunk > page_size)
|
||||
chunk = page_size;
|
||||
|
||||
// if there's less data remaining than one chunk
|
||||
if (chunk > n_bytes-i)
|
||||
chunk = n_bytes - i;
|
||||
|
||||
if (usb_out(pgm,
|
||||
function, // Flash or EEPROM
|
||||
delay, // How much to wait between each byte
|
||||
i, // Index of data
|
||||
m->buf + i, // Pointer to data
|
||||
chunk, // Number of bytes to write
|
||||
32 * PDATA(pgm)->sck_period + delay // each byte gets turned into a
|
||||
// 4-byte SPI cmd usb_out() multiplies
|
||||
// this per byte. Then add the cmd-delay
|
||||
) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
next = i + chunk; // Calculate what address we're at now
|
||||
if (m->paged
|
||||
&& ((next % page_size) == 0 || next == n_bytes) ) {
|
||||
// If we're at a page boundary, send the SPI command to flush it.
|
||||
avr_write_page(pgm, p, m, (unsigned long) i);
|
||||
}
|
||||
|
||||
report_progress( next, n_bytes, NULL );
|
||||
}
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
extern void usbtiny_initpgm ( PROGRAMMER* pgm )
|
||||
{
|
||||
strcpy(pgm->type, "USBtiny");
|
||||
|
||||
/* Mandatory Functions */
|
||||
pgm->initialize = usbtiny_initialize;
|
||||
pgm->enable = usbtiny_enable;
|
||||
pgm->disable = usbtiny_disable;
|
||||
pgm->program_enable = NULL;
|
||||
pgm->chip_erase = usbtiny_chip_erase;
|
||||
pgm->cmd = usbtiny_cmd;
|
||||
pgm->open = usbtiny_open;
|
||||
pgm->close = usbtiny_close;
|
||||
pgm->read_byte = avr_read_byte_default;
|
||||
pgm->write_byte = avr_write_byte_default;
|
||||
|
||||
/* Optional Functions */
|
||||
pgm->powerup = NULL;
|
||||
pgm->powerdown = usbtiny_powerdown;
|
||||
pgm->paged_load = usbtiny_paged_load;
|
||||
pgm->paged_write = usbtiny_paged_write;
|
||||
pgm->set_sck_period = usbtiny_set_sck_period;
|
||||
pgm->setup = usbtiny_setup;
|
||||
pgm->teardown = usbtiny_teardown;
|
||||
}
|
||||
|
||||
#else /* !HAVE_LIBUSB */
|
||||
|
||||
// Give a proper error if we were not compiled with libusb
|
||||
|
||||
static int usbtiny_nousb_open(struct programmer_t *pgm, char * name)
|
||||
{
|
||||
fprintf(stderr, "%s: error: no usb support. Please compile again with libusb installed.\n",
|
||||
progname);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void usbtiny_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "usbtiny");
|
||||
|
||||
pgm->open = usbtiny_nousb_open;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBUSB */
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2007 Limor Fried
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef usbtiny_h
|
||||
#define usbtiny_h
|
||||
|
||||
#include "avrpart.h"
|
||||
|
||||
// these are specifically assigned to USBtiny,
|
||||
// if you need your own VID and PIDs you can get them for cheap from
|
||||
// www.mecanique.co.uk so please don't reuse these. Thanks!
|
||||
#define USBTINY_VENDOR 0x1781
|
||||
#define USBTINY_PRODUCT 0x0C9F
|
||||
|
||||
// Generic requests to the USBtiny
|
||||
#define USBTINY_ECHO 0 // echo test
|
||||
#define USBTINY_READ 1 // read byte (wIndex:address)
|
||||
#define USBTINY_WRITE 2 // write byte (wIndex:address, wValue:value)
|
||||
#define USBTINY_CLR 3 // clear bit (wIndex:address, wValue:bitno)
|
||||
#define USBTINY_SET 4 // set bit (wIndex:address, wValue:bitno)
|
||||
|
||||
// Programming requests
|
||||
#define USBTINY_POWERUP 5 // apply power (wValue:SCK-period, wIndex:RESET)
|
||||
#define USBTINY_POWERDOWN 6 // remove power from chip
|
||||
#define USBTINY_SPI 7 // issue SPI command (wValue:c1c0, wIndex:c3c2)
|
||||
#define USBTINY_POLL_BYTES 8 // set poll bytes for write (wValue:p1p2)
|
||||
#define USBTINY_FLASH_READ 9 // read flash (wIndex:address)
|
||||
#define USBTINY_FLASH_WRITE 10 // write flash (wIndex:address, wValue:timeout)
|
||||
#define USBTINY_EEPROM_READ 11 // read eeprom (wIndex:address)
|
||||
#define USBTINY_EEPROM_WRITE 12 // write eeprom (wIndex:address, wValue:timeout)
|
||||
|
||||
|
||||
|
||||
// Flags to indicate how to set RESET on power up
|
||||
#define RESET_LOW 0
|
||||
#define RESET_HIGH 1
|
||||
|
||||
// The SCK speed can be set by avrdude, to allow programming of slow-clocked parts
|
||||
#define SCK_MIN 1 // usec delay (target clock >= 4 MHz)
|
||||
#define SCK_MAX 250 // usec (target clock >= 16 KHz)
|
||||
#define SCK_DEFAULT 10 // usec (target clock >= 0.4 MHz)
|
||||
|
||||
// How much data, max, do we want to send in one USB packet?
|
||||
#define CHUNK_SIZE 128 // must be power of 2 less than 256
|
||||
|
||||
// The default USB Timeout
|
||||
#define USB_TIMEOUT 500 // msec
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void usbtiny_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* usbtiny_h */
|
||||
Reference in New Issue
Block a user