Commit Graph

130 Commits

Author SHA1 Message Date
Joerg Wunsch 5d0bfcaf4c 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.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@777 81a1dc3b-b13d-400b-aceb-764788c761c2
2008-07-26 22:53:40 +00:00
Joerg Wunsch cc8b75040f 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.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@772 81a1dc3b-b13d-400b-aceb-764788c761c2
2008-06-07 21:03:41 +00:00
Joerg Wunsch df28c35d8e Partially revert the line buffered output change,
and turn stderr into unbuffered output while producing the
progress report.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@765 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-11-08 22:34:36 +00:00
Joerg Wunsch 58a3d35757 main.c, pgm.c, pgm.h: Add setup and teardown hooks to the programmer
definition.  If present, call the setup hook immediately after finding
the respective programmer object, and schedule the teardown hook to be
called upon exit.  This allows the programmer implementation to
dynamically allocate private programmer data.

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


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

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

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


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@761 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-11-06 19:42:16 +00:00
Joerg Wunsch 8d5b9f3ea1 Submitted by <bikenomad@gmail.com>:
patch #5007: Patch for line-buffering of stdout and stderr


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@757 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-10-29 22:46:45 +00:00
Colin O Flynn be2e4b79a6 2007-05-01: Colin O'Flynn <coflynn@newae.com>
*Problem in verbose output of previous commit. I hoped to
   have all the verbose changes in a single commit, but that
   won't happen...
  *Main thing is fixed safemode to turn itself off when you can't
   read the fuses anyway. I don't know what I was thinking when
   I made it fail out of programmers that don't support fuse reading.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@733 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-05-02 23:05:21 +00:00
Joerg Wunsch 2682d0a227 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.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@724 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-01-29 20:41:47 +00:00
Joerg Wunsch 5bf9e2d9f2 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.

That effectively leaves the various module C files as something like
an "avrdude library", with main.c being the currently only frontend
program for that library.  In theory, it should be possible to write
different frontends using the same library backend functions though.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@722 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-01-24 22:43:46 +00:00
Joerg Wunsch 27e16e8371 Something I always wanted to do: replace all those private "extern"
declarations in each file by a central header file "avrdude.h".


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@721 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-01-24 21:07:54 +00:00
Joerg Wunsch 2cfccda03d Submitted by John Voltz: add AVR053 oscillator calibration.
* main.c: Add the -O option.
* pgm.c: Add the hook for the perform_osccal() method.
* pgm.h: (Ditto.)
* stk500v2.c: Implement perform_osccal().
* avrdude.1: Document the -O option.
* doc/avrdude.texi: (Ditto.)
Partially closes bug #17487: AVR RC oscillator calibration
routine not supported (feature request)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@671 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-10-09 14:34:24 +00:00
Joerg Wunsch 73cfe88386 * avr910.c: As there is a lot of ambiguity about the AVR910
device codes, allow the user to override the device code
verification with the -F option.
* main.c: Make ovsigck a global variable.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@665 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-20 21:32:18 +00:00
Joerg Wunsch 501a1606b4 Implement -U filename as a shorthand for -U flash:w:filename:a.
This has once been suggested by Brian Dean.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@655 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-08 21:52:45 +00:00
Joerg Wunsch 876d75a1a8 Implement numerical output formats for decimal, hexadecimal, octal,
and binary numbers.

Closes bug #16129: more output formats for fuse bits (avrdude
enhancement request)

* fileio.c: Implement fileio_num() and the itoa_simple() helper function.
* fileio.h: Add new file formats to FILEFMT.
* main.c: Parse the new file formats.
* avrdude.1: Document all this.
* doc/avrdude.texi: (Ditto.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@654 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-08 21:28:24 +00:00
Joerg Wunsch 7c235970a1 Add date and time of compilation to the verbose greeting message.
Idea taken from patch #3172: Adds date and time of compile to usage
message


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@642 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-01 21:15:03 +00:00
Joerg Wunsch 49de0c7e9a Rework the exit specs so they actually work again. It should be
possible to extend them for other programmers than PPI now (serbb,
stk500*).

* pgm.h: Keep the exit specs in an abstract form inside struct
programmer_t.  (Should be moved out into some programmer-specific
structure.)  Rename the getexitspecs() method into
parseexitspecs().
* main.c: Move the exit specs stuff out to the programmer
implementation.
* par.c: Implement the new exit spec handling.  Everything is now
done using the generic abstraction layer.

Closes bug #16443: No disable Resetsignal at the end of
Programming Session

Obviates need for patch #5057: quick and dirty Hack to unset Reset
after Programming


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@629 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-08-29 23:12:15 +00:00
Joerg Wunsch 840af6b242 Move the bitbang prerequisite checks out from
main() into their own bitbang_check_prerequisites().


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@626 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-08-23 21:06:28 +00:00
Joerg Wunsch 88e2614ee2 Submitted by Neil Davey:
patch #4539: Ability to control the bit clock (usleep) delay
for ppi interface
* bitbang.c: Implement bitbang_delay() and its calibration.
* bitbang.h: Declare bitbang_delay().
* main.c: Add the ispdelay option (-i).
* pgm.h (struct programmer_t): Add the ispdelay parameter.
* par.c: Add calls to bitbang_delay() when requested.
* serbb_posix.c: (Ditto.)
* serbb_win32.c: (Ditto.)
* avrdude.1: Document the new -i option.
* doc/avrdude.texi: (Ditto.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@610 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-08-17 15:06:20 +00:00
Joerg Wunsch ff8fb9928e Use mem->desc in place of upd->memtype in more places to
give the full name of the respective memory area, instead of
the (possibly abbreviated) name the user typed in the -U option.

(Previous attempt in rev 1.110 was obviously not complete.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@588 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-07-17 19:58:50 +00:00
Colin O Flynn 26d54b4499 2006-02-27 Colin O'Flynn <coflynn@newae.com>
Contributed by Wim Lewis, add support for checking device
        signatures in detail (patch #4924 and #4925)
    * avrdude.conf.in: Add signatures
    * avrpart.c: Set default signature
    * avrpart.h: Variable for signature
    * config_gram.y: More signature reading
    * lexer.l: Define that signatures exist
    * main.c: Read signatures and check them against hardware


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@573 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-02-27 17:18:42 +00:00
Colin O Flynn 972d657317 * main.c, stk500v2.c: Added patch 4804 from eolson@mit.edu
Which stops sck from being writtend needlessly


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@568 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-01-17 21:11:39 +00:00
Colin O Flynn edeffeef6e Colin O'Flynn <coflynn@newae.com>
* main.c: Fixed a typo in safemode variable names, fixed bug 15113


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@566 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-01-17 20:17:43 +00:00
Joerg Wunsch 7dba7155a2 Make avrdude Solaris-compatible.
* Makefile.am: distclean avrdude.conf.
* avrdude.conf.in: make the parallel-port programmers optional.
* bitbang.c: move the bitbang features out into PROGRAMMER.
* configure.ac: introduce --enable-parport, add Solaris.
* lexer.l: replace str by strng to work around problems in some
versions of flex.
* main.c: move getexitspecs into the respective programmer's
domain; replace rindex by the C-standard strrchr.
* par.c: make parallel port optional.
* par.h: everything but par_initpgm() is private now.
* pgm.h: add setping/getping/highpulsepin/getexitspecs.
* serbb_posix.c: generalize bitbang interface; replace
cfmakeraw() by explicit code.
* serbb_win32.c: generalize bitbang interface.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@539 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-11-01 23:02:06 +00:00
Joerg Wunsch e8e2067639 * main.c(do_op): use mem->desc in place of upd->memtype to
give the full name of the respective memory area, instead of
the (possibly abbreviated) name the user typed in the -U option.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@529 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-09-22 14:14:14 +00:00
Joerg Wunsch 37fb76687a Add the forgotten -B option (JTAG bit clock) to the getopt() option
string.  Actually evaluate that number as microseconds then, as the
documentation used to state already.

While being there, re-sort the -s option into alphabetical order.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@527 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-09-21 15:02:02 +00:00
Brian S. Dean c941cf8ab4 This is Colin O'Flynn's mega patch for updating safemode support:
* add support for parts with just 'fuse' memory

    * if any fuse memories are altered, reflect those changes in the
      post-programming safemode check so that safemode no longer
      complains about fuses which were intentionally altered; this
      eliminates the need to completely disable safemode using -u in
      order to program fuses.

    * provide -s option which will not ask to restore fuses, it will
      just do it

Submitted by: Colin O'Flynn <coflynn@newae.com>


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@519 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-09-21 00:20:32 +00:00
Brian S. Dean 0c266ce0dc Implement -q -q to be very very quiet.
Submitted by: andyw@pobox.com


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@503 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-09-16 21:52:42 +00:00
Brian S. Dean 43439bcc7a Don't call exit() directly here - set the exit value and jump to the
main_exit: label to ensure the programmer is released correctly.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@483 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-07-26 04:13:34 +00:00
Brian S. Dean 33da1ebf09 Update version and copyright message.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@467 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-14 14:56:00 +00:00
Brian S. Dean d1e25a6921 Change the default port to 'serial' for the newly added serial
programmers stk500v2 and jtagmkii.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@466 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-14 14:49:39 +00:00
Joerg Wunsch 04831af970 Mega-commit to bring in both, the STK500v2 support from Erik
Walthinsen, as well as JTAG ICE mkII support (by me).

Erik's submission has been cleaned up a little bit, mostly to add his
name and the current year to the copyright of the new file, remove
trailing white space before importing the files, and fix the minor
syntax errors in his avrdude.conf.in additions (missing semicolons).

The JTAG ICE mkII support should be considered alpha to beta quality
at this point.  Few things are still to be done, like defering the
hfuse (OCDEN) tweaks until they are really required.  Also, for
reasons not yet known, the target MCU doesn't start to run after
signing off from the ICE, it needs a power-cycle first (at least on my
STK500).

Note that for the JTAG ICE, I did change a few things in the internal
API.  Notably I made the serial receive timeout configurable by the
backends via an exported variable (done in both the Posix and the
Win32 implementation), and I made the serial_recv() function return a
-1 instead of bailing out with exit(1) upon encountering a receive
timeout (currently only done in the Posix implementation).  Both
measures together allow me to receive a datastreem from the ICE at 115
kbps on a somewhat lossy PCI multi-UART card that occasionally drops a
character.  The JTAG ICE mkII protocol has enough of safety layers to
allow recovering from these events, but the previous code wasn't
prepared for any kind of recovery.  The Win32 change for this still
has to be done, and the traditional drivers need to be converted to
exit(1) upon encountering a timeout (as they're now getting a -1
returned they didn't see before in that case).


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@451 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-10 19:17:12 +00:00
Brian S. Dean bcd52759b1 Exit non-zero if safe-mode reverts fuse bits that were requested on
the command-line.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@450 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-02-11 19:03:53 +00:00
Brian S. Dean d3e4b0db14 Variable declarations must only appear at the beginning of a block.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@449 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-02-10 18:37:37 +00:00
Brian S. Dean 5ee1bc4c34 Style police: white space only change; consistent indentation, wrap
long lines to < 80 columns.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@447 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-02-10 16:34:55 +00:00
Eric Weddington ffbc10401f Add Safe Mode. Fuse settings will be restored at the end of a programming session unless the -u switch is specified.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@440 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-01-24 21:26:11 +00:00
Brian S. Dean fb99d19d96 Replace my e-mail address with my url when displaying copyright
information.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@439 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-12-22 02:06:13 +00:00
Brian S. Dean 6249f94515 Update code copyrights.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@438 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-12-22 01:52:45 +00:00
Theodore A. Roth 5b7f00e024 * main.c (main): Don't indent CPP directives.
When showing update progress in a no tty situation, use unbuffered IO
for all systems, not just win32 native.
Update copyright year when printing version.
Remove warning about native win32 being experimental.
Split a line string.
* ppiwin.c: Update copyright year.
Add cvs Id keyword.
(usleep): Cleanup debug CPP directives to improve readability.
* ser_win32.c: Include <stdio.h> to fix failing build.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@430 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-07-15 17:29:35 +00:00
Jan-Hinnerk Reichert 7b4466c24b Removed unnecessary includes of config.h
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@426 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-07-05 15:04:19 +00:00
kiwi64ajs be4f46c49e merged in changes to allow native Win32 build with no cygwin DLL dependancy
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@419 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-06-24 11:05:07 +00:00
Brian S. Dean 723e25c9a8 Allow the baud rate to be specified on the command line with a new -b
switch.  The specified baud rate will override the default serial port
baud rate for a particular programmer.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@416 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-05-19 23:00:38 +00:00
Jan-Hinnerk Reichert 8c6a4e31e4 * main.c: Removed deprecated options.
* doc/TODO: Still need to remove these options from documentation


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@410 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-02-09 23:43:42 +00:00
Jan-Hinnerk Reichert 51491c6916 * pgm.[ch], main.c, par.c, avr910.c, butterfly.c, stk500.c:
Move save/restore-functionality into open/close.
	* par.c: open/close now saves/restores PPICTRL, too.
	* TODO: exitspecs don't work if RESET is in PPICTRL.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@407 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-01-28 20:01:44 +00:00
Jan-Hinnerk Reichert 8620dd9f11 *main.c,avr.c,avr.h,par.c,stk500.c: Add function avr_chip_erase() to unify handling of cycle-count. Makes cycle-count work for avr910-programmers
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@394 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-01-03 18:04:54 +00:00
Jan-Hinnerk Reichert 6913c88882 *avrpart.c,main.c: Moved list_parts() and locate_part() from main.c to avrpart.c
*avrpart.h: Added prototypes for list_parts() and locate_part()


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@389 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-11-30 16:49:00 +00:00
Joerg Wunsch 9a00b545e3 Make the -U parser tolerate colons in filenames.
Document the change, including changing one of the texinfo examples
to use a Windows-like filename that contains a space (and thus
requires quoting).

This fixes bug #6764.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@386 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-11-26 22:05:02 +00:00
Brian S. Dean fab896d9e4 Revert to honoring the return code from pgm->pgm_enable() within the
stk500 initialization routine.  However, allow one to use the -F
option to ignore a bad return code from that function.  I think this
still allows what Joerg intended, i.e., providing a way to still get
into terminal mode so that one can recover from setting bad STK500
values which may keep the chip from entering programming mode.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@359 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-08-31 15:40:59 +00:00
Brian S. Dean 4041cfe4d2 Perform an auto erase before programming if the flash memory is
anywhere specified to be written by any of the -U requests.

To remain backward compatible with previous versions, disable this
feature if any of the old-style memory specification operations are
specified (-i, -o).

Implement the -D option to explicitly disable the auto erase default.

Deprecate the old-style memory specification options (-f, -i, -I, -m,
and -o) in favor of the new -U option which allows one to operate on
multiple memories on a single command line.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@356 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-08-29 23:17:32 +00:00
Brian S. Dean f8e3aee203 Declare size and vsize as 'int'. These represent the size of the AVR
memory read or written (or up to where continuous 0xff begins in the
case of flash memory).  An 'int' should be plenty big enough for that.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@354 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-08-29 00:14:22 +00:00
Eric Weddington 4f05a28329 * avr910.c:
* fileio.c:
    * main.c:
    * stk500.c:
    More code cleanup to remove warnings.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@352 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-08-28 23:02:25 +00:00