Commit Graph

145 Commits

Author SHA1 Message Date
joerg_wunsch 83fa6c7934 Cleanup Cygwin builds.
* windows/Makefile.am (loaddrv_LDFLAGS): remove, the -mno-cygwin
flag is supposed to be set in CFLAGS by ./configure
* configure.ac: add a check for the presence of usleep(), add a
check whether the linker accepts -static
* avrdude.h: protect prototype for usleep by !defined(HAVE_USLEEP)
* ppwin.c (usleep): protect by !defined(HAVE_USLEEP)
* main.c: silence "array subscript of type char" compiler warnings
by casting all arguments to tolower()/toupper() and isspace()/
isdigit()/ispunct() to "int"
* butterfly.c: (Dito.)
* avr910.c: (Dito.)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@936 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-22 16:40:17 +00:00
joerg_wunsch 46715b4296 Implement TPI mode for AVRISPmkII/STK600.
Add ATtiny4/5/9/10 to avrdude.conf.in.
Document TPI and new device support.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@916 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-15 16:36:13 +00:00
joerg_wunsch 1429550f8e Cleanup the open/close handling to avoid accessing
unallocated memory (in the atexit handler) in case of bailing out.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@910 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-13 12:44:54 +00:00
joerg_wunsch b827263faa Clean-up the Xmega erase functions.
* jtagmkII_private.h: Add CMND_XMEGA_ERASE as well as
the various XMEGA_ERASE_* definitions (from updated
appnote AVR067)
* jtagmkII.c (jtagmkII_chip_erase): Correctly implement
Xmega chip erase based on CMND_XMEGA_ERASE.
* jtagmkII.c (jtagmkII_pre_write): Remove, this turned out
to be just a chip erase.
* jtagmkII.c (jtagmkII_program_disable): Don't try reading
"hfuse" for Xmega parts; they don't have it.
* main.c (main): Re-enable auto-erase.  It's been done
before (as "jtagmkII_pre_write") in jtagmkII_paged_write()
anyway.  Xmega boot and application flash areas should be
handled separately in the future, so auto_erase can only
affect the area just being programmed.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@903 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-11 15:27:44 +00:00
joerg_wunsch 5dceef2b5c Disable safemode for Xmega parts.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@902 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-11 14:29:26 +00:00
mludvig d1f8ac6638 * main.c: Re-added default to serial port for BusPirate.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@872 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-12 23:31:05 +00:00
dhoerl ee73e2e873 avr32 cleanup, now does flash read and verify
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@870 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-12 16:44:30 +00:00
dhoerl 8ab13f94d5 AVR32
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@852 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-10 20:09:56 +00:00
mludvig 839dd39eeb Minor change - buspirate->BusPirate in strcmp()
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@843 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-08 04:40:53 +00:00
mludvig fa7829bcd7 Added support for the BusPirate programmer.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@842 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-08 02:05:03 +00:00
joerg_wunsch ae704584a1 Add my name to the copyright output when being verbose.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@829 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-07-02 11:26:29 +00:00
joerg_wunsch b770fc170e bug #26130: Avrdude doesn't display it's version.
* main.c (usage): add a version number display to the default usage
message.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@823 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-07-02 08:42:14 +00:00
joerg_wunsch 735371e9ba bug #26412: avrdude segfaults when called with a programmer that does not
support it

Do not call pgm->perform_osccal() unless it is != 0.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@822 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-07-01 16:08:49 +00:00
joerg_wunsch 3a3f9f2e44 bug #22883: Chip Erase performed even with no-write flag (-n)
Do not erase the chip if both, -e and -n options have
been specified.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@784 81a1dc3b-b13d-400b-aceb-764788c761c2
2008-11-04 12:10:28 +00:00
joerg_wunsch a37bbfab57 * 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.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@779 81a1dc3b-b13d-400b-aceb-764788c761c2
2008-07-29 21:26:55 +00:00
joerg_wunsch 15fc8af421 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 95cdd4dcb4 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 56783f0ac2 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 7d70684811 main.c, pgm.c, pgm.h: Add setup and teardown hooks to the programmer
definition.  If present, call the setup hook immediately after finding
the respective programmer object, and schedule the teardown hook to be
called upon exit.  This allows the programmer implementation to
dynamically allocate private programmer data.

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


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

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

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


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@761 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-11-06 19:42:16 +00:00
joerg_wunsch 5b57948a0d 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
c_oflynn 6b4270e2d8 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 7c7ba6733e 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 07c1079415 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 1cae809b9b Something I always wanted to do: replace all those private "extern"
declarations in each file by a central header file "avrdude.h".


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@721 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-01-24 21:07:54 +00:00
joerg_wunsch 319d25efc4 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 ad3fa869ee * 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 8ebe96ee2b 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 92cbfc744a 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 26952bf8f0 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 fb795d21f9 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 0b05af1165 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 501918258b 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 4d465fe0ac 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
c_oflynn c3f6c7e21c 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
c_oflynn c1bd17edb2 * 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
c_oflynn d0bd1ae69f 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 5564934a4e 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 dfbfb64e5f * 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 21a6c44ee3 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
bdean d53e6d7b25 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
bdean 461ffc9d80 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
bdean c844bd1236 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
bdean c37cefab01 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
bdean e457898255 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 b49dc8f645 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
bdean 1041ecd45e 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
bdean 5a7b9e59b6 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
bdean b5f3b84182 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
arcanum 3428a9985f 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