Commit Graph

170 Commits

Author SHA1 Message Date
joerg_wunsch 8113ad8a87 Replace all occurences of exit() in potential library code
by appropriate return values.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1301 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-16 15:52:25 +00:00
joerg_wunsch 5c30babbdc Bump copyright year.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1287 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-28 14:26:24 +00:00
joerg_wunsch 52c59fade2 If the device is not open, don't try closing it.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1282 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-27 07:35:15 +00:00
joerg_wunsch faf274134b Submitted by Daniel Rozsnyo:
bug #40085: Typo fix in fuses report (for 6.1-svn-20130917)
* main.c: Fix a typo.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1247 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-22 21:23:12 +00:00
joerg_wunsch d292c1a394 bug #40055: AVRDUDE segfaults when writing eeprom
* main.c: Always clear the UF_AUTO_ERASE flag if either a
non-Xmega device was found, or the programmer does not offer a
page_erase method.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1242 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-18 05:54:37 +00:00
joerg_wunsch 7e10c77ff3 bug #35474 Feature request: print fuse values in safemode output
* config_gram.y: New configuration token "default_safemode".
* lexer.l: (Dito.)
* avrdude.conf.in: (Dito.)
* config.h: Add variable default_safemode.
* config.c: (Dito.)
* main.c: Handle default_safemode, including -u option.
* avrdude.1: Document all this.
* doc/avrdude.texi: (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1226 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-13 17:22:38 +00:00
joerg_wunsch ad15b61b0b Remove the erase cycle counter (options -y / -Y).
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1203 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-03 20:13:37 +00:00
joerg_wunsch a305ac0143 Add option -l logfile to redirect diagnostic messages to a logfile rather
than stderr.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1179 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-05-16 09:11:32 +00:00
rliebscher e5b9551631 * main.c: revert to rev 1159 (doing pgm_display after pgm_open)
* avrpart.[ch]: moved avr_pin_name to pindefs.[ch]
* pgm.c: moved pins_to_str to pindefs.[ch], added initialization of 
          new pin definitions in pgm_new()
* pindefs.[ch]: added moved functions from other files, added a lot of 
          documentation, reformatted files using astyle to have consistent spacing,
          added a new generic check function for pins
* ft245r.c: used new generic pin check function

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1161 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-05-05 13:35:35 +00:00
rliebscher 22158cd03a Create new pin definition data structures to support 0-based pin numbers, and mixed inverse/non-inverse pin lists.
* avrftdi.c,buspirate.c,linuxgpio.c,par.c,serbb_*.c: added function call 
          to fill old pinno entries from new pin definitions.
	* pindefs.[hc]: added data struct and helper functions for new pin definitions
	* avrdude.conf.in: pins in entries using ftdi_syncbb are now 0-based
	* config_gram.y: allow combinations of inverted and non-inverted pins in pin lists
	* ft245r.c: reworked to work directly with the new pin definitions,
          pins are now 0-based, inverse pins are supported, buff is supported
	* pgm.[ch]: added new pin definitions field to programmer structure, 
          adapted pin display functions

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1160 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-05-03 22:35:00 +00:00
joerg_wunsch 8fdf4d4071 Replace outdated FSF postal address by a reference to
the GPL info on their website.



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



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1089 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-05-04 10:02:30 +00:00
joerg_wunsch 0dd5684041 * update.c (parse_op): do not assume default memtype here
* main.c: after locating the part information, determine default
memtype for all update options that didn't have a memtype
specified; this is "application" for Xmega parts, and "flash" for
everything else.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1086 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-25 16:32:23 +00:00
joerg_wunsch 98d2f6fff8 bug #30756: When setting SUT to 64ms on XMEGA, avrdude doesn't
read device signature
* main.c: When reading the signature yields 0x000000 or 0xffffff,
retry (up to twice) after some progressive delay.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1084 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-20 12:33:15 +00:00
rliebscher 76dce38725 patch #7717 avrftdi_flash_write is broken
* avrftdi.c: fixed wrong buffer address initialization in paged_write
bug #35296 Extraneous newlines in output.
* main.c: fixed output of newlines at 100% progress


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


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1051 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-31 17:03:43 +00:00
joerg_wunsch a86aff7232 Add a connection_type attribute to each programmer, rather than
trying to hard-code the default port name in main.c.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1047 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-30 17:08:48 +00:00
rliebscher cfe513363f * avrdude.conf.in: used parent parts for some other parts, added
abstract .xmega part as parent for xmegas
* main.c: hide parts starting with '.' from parts list


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1046 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-27 21:14:34 +00:00
rliebscher 38e72e4b99 patch #7688: Implement parent programmers feature
* avrdude.conf.in: updated documentation comment and some programmers 
    have now parents
  * config_gram.y: initpgm will now called at first use of programmer 
    in main. parser sets only the function pointer in the pgm structure.
    Pin and pin lists definitions can now be empty to remove the parents
    setting.
  * doc/avrdude.texi: updated documentation
  * main.c: added call to pgm->initpgm after locate_programmer
  * pgm.[hc]: added field initpgm in structure, added function pgm_dup


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1045 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-22 12:31:54 +00:00
rliebscher 4976fcf88e bug #34302: Feature request : device configuration with parent classes
* config_gram.y: if memory section is overwritten old entry is removed
        
(not in original patch)
* config_gram.y: if programmer or part is defined twice, a warning is
  output and the first instance is removed
        
General cleanup and free functions, so valgrind does not report any lost
blocks at program end.
* avrpart.[hc]: added avr_free_(opcode|mem|part) functions
* pgm.[hc]: added pgm_free function
* update.[hc]: added free_update functions
* config.[hc]: added cleanup_config function, use yylex_destroy to reset
  the lexer after usage. (So it can be reused.)
* main.c: add cleanup_main function which is called by atexit() (This 
  frees all lists so that at program exit only really lost memory is 
  reported by valgrind.)
* usbasp.c: added libusb_free_device_list() and libusb_exit() calls to
  avoid lost memory
* buspirate.c: moved memory allocation from initpgm to setup and added 
  free in teardown
* configure.ac: add definition of HAVE_YYLEX_DESTROY if $LEX is flex.
* Makefile.am: added . in front of SUBDIRS to build avrdude before trying
  to use it for creating the part list for the docs.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1041 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-17 20:56:37 +00:00
rliebscher 12c2affe92 patch #7699 Read additional config files
* main.c: Added reading of additional config files
* avrdude.1: updated man page
* doc/avrdude.texi: updated documentation


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1038 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-01-10 18:07:19 +00:00
rliebscher 7eef860eb1 patch #7671: Sorting programmers and parts lists for console output
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1019 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-12-16 20:44:07 +00:00
joerg_wunsch b71fb55405 Restrict the cyclecounter readout to those cases where
it has been explicitly requested (by -y or -Y), rather than always
attempting to read the last EEPROM bytes.



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



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1007 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-09-14 21:49:42 +00:00
joerg_wunsch 0a1f0ad778 Submitted by Stefan Tomanek:
patch #7542: add default_bitclock to configuration files




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@988 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-26 20:30:26 +00:00
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