Commit Graph

57 Commits

Author SHA1 Message Date
Joerg Wunsch 6c78b35b8f Fix all "unused variable" warnings that were encountered.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1200 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-03 11:05:13 +00:00
Joerg Wunsch 51da59044e bug #38023: avrdude doesn't return an error code when attempting
to upload an invalid Intel HEX file
* fileio.c (ihex2b): Turn the "No end of file record found" warning
into an error if no valid record was found at all.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1195 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-02 18:18:15 +00:00
Joerg Wunsch 3879e70713 * fileio.c (elf2b): replace elf_getshstrndx() by
elf_getshdrstrndx() as the former one is deprecated



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1187 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-07-11 21:43:11 +00:00
Joerg Wunsch 147137a218 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 a8b5742512 Test for libelf.h in subdirectory libelf, too, and inlude it from there if test
was positive.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1093 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-07-18 12:42:47 +00:00
Joerg Wunsch 0bda6f26d1 * fileio.c: Rework the way ELF file sections are considered: while
scanning the program header table, the offsets from a program
header entry must never be used directly when checking the bounds
of the current AVR memory region.  Instead, they must always be
checked based on the corresponding section's entry.  That way,
Xmega devices now properly take into account whether the segment
fits into any of the application/apptable/boot memory region.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1085 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-24 15:41:02 +00:00
Joerg Wunsch c1a5d32c87 * fileio.c (elf2b): When checking the bounds of the current
program header segment, subtract `low' from ph[n].p_paddr in order
to correct the magic section offsets for the AVR's non-flash
memory regions.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1080 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-18 16:00:21 +00:00
Joerg Wunsch f8e99df355 * fileio.c (elf_get_scn): Rather than trying to just match whether
any given section maps straight to a program header segment, use a
more sophisticated decision that matches any section as long as it
fits into the segment.  This is needed for situations where the
program header segment spans a larger area than the section data
provided.  (This can e.g. happen in an ELF file that contains no
data at address 0, like a bootloader only.)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1079 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-18 15:47:57 +00:00
Joerg Wunsch 0025747234 bug #30451: Accessing some Xmega memory sections gives not
supported error
* stk500v2.c: Handle all Xmega memory sections (except
"prodsig" which is not documented in AVR079)
* fileio.c: Treat the "boot", "application", and "apptable"
regions (which are actually subregions of "flash") all as
being flash, i.e. suppress trailing 0xFF bytes when reading
them
* avr.c: (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1075 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-03-29 14:32:18 +00:00
Rene Liebscher e28f48d296 patch #7720 Bug in EEPROM write
* avrftdi.c: fixed wrong buffer address initialization in paged_write

* fileio.c: added #include <stdint.h>


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1067 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-02-06 19:41:36 +00:00
Joerg Wunsch a74cd4d03d Fix a copy'n-paste-o.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1059 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-02-03 08:34:39 +00:00
Joerg Wunsch 86ad524ea2 Implement ELF file reading (finally). Requires libelf(3) to be
present on the host system.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1056 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-02-02 16:52:45 +00:00
Joerg Wunsch 8770c07d35 bug #34518: loading intel hex files > 64k using record-type 4
(Extended Linear Address Record)

Replace the change from r928 (handling of 0x8000000 offset in AVR32
files) by a completely different logic that no longer breaks hex files
for other devices starting with an offset; also apply a similar change
to S-record files, as well as when writing files.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1017 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-10-10 13:42:08 +00:00
Joerg Wunsch d742827da1 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 d640768544 Contributed by tixiv@gmx.net:
bug #33345: File auto detection as binary doesn't open
file in binary mode on Windows
* fileio.c: Move the decision about opening files in
binary mode until before the fopen() call.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@964 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-12 15:53:53 +00:00
Joerg Wunsch befb4dc9cc Redo most of r851 and r880, respectively, minus the bugs. ;-)
(Submitted by dhoerl)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@929 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-18 20:40:15 +00:00
Joerg Wunsch 4e53f3451e bug #28660: Problem with loading intel hex rom files that exceed
0x10000 bytes
* fileio.c: Revert the changes from r851 and r880, respectively.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@928 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-18 11:05:36 +00:00
David Hoerl 1bc01515e3 * fileio.c: ihex2bin did not properly handle files > 64K bytes
* usb_libusb.c: re-enabled usb_reset for Macs (no reset causes lots of failures)
* avrdude.1: spacing issue for ucr2 fixed.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@880 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-11-29 20:19:15 +00:00
David Hoerl 9eceda72a5 AVR32
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@851 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-10 20:09:55 +00:00
Joerg Wunsch 594e7e955c 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.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@816 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-03-22 21:28:46 +00:00
Joerg Wunsch 1a3155dd75 (Partially) submitted by John Voltz:
bug #20004: AVRDUDE update (-U) operations do not close files
* fileio.c (fmt_autodetect, fileio): fclose() files.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@801 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-02-19 10:49:55 +00:00
Joerg Wunsch b9691e51ba Submitted by <karl.yerkes@gmail.com>:
patch #6141: accept binary format immediate values

Detect a 0b prefix, and call strtoul() differently in that case.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@754 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-10-29 22:30:59 +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 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 76b13550bc CPP statements start in column #1.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@652 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-09-08 19:46:45 +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 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
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
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
Eric Weddington d3477ceaef * fileio.c:
* main.c:
    * ppiwin.c:
    * ser_posix.c:
    * stk500.c:
    Minor code cleanup to remove warnings.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@346 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-08-25 15:55:48 +00:00
Brian S. Dean b09107e9af Optimize flash memory handling a little bit by ignoring 0xff data that
resides above the last non-0xff data value in the address space.  Only
do this for flash memory since writing a 0xff to flash is a no-op.
This has the affect of creating smaller output files when dumping
memory contents from flash if the program in flash does not consume
the whole memory space.  It also results in shorter programming times
when avrdude is asked to load a file into flash that has lots of 0xff
filled data past the last non-0xff data value.

I think this is basically where Alexey was going with his s-record
routine, but this should have a similar affect for all the I/O
routines.  The main difference is that Alexey's also optimized 0xff
from the beginning of the address space and was not limited to flash.

I think that these optimizations should be limited to the flash since
it is currently the only memory that treats 0xff as special.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@331 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-05-22 02:33:17 +00:00
Brian S. Dean 701fb4acce Make the s-record output routine work like the raw and intel hex
output routines (don't optimize away 0xff data before and after non
0xff data).  Also, fix a bug where the data contents sometimes weren't
written out completely.

Initial bug reported by Tom Harris <TomH@optiscan.com>.  Fixes
provided by Alexey V.Levdikov <tsar@kemford.com>.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@330 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-05-22 00:46:59 +00:00
Brian S. Dean ba8da0de7a fileio.c : Remove superfluous assignment of 'fname'.
main.c : print out '<stdin>' and '<stdout>' instead of '-' when using
         stdio for I/O.

Thanks to Francisco T. A. Silva <ftas@geodigitus.com.br> for catching
this, and the error fixed by the previous commit as well.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@325 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-05-07 22:13:46 +00:00
Brian S. Dean 74bb2d7275 Unbreak using stdin/stdout for file input / output.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@324 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-05-07 00:14:03 +00:00
Eric Weddington 920eef8ef9 Fix for bug #3293. Set correct open mode for raw format for Windows.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@321 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-04-23 16:36:01 +00:00
Brian S. Dean f931f8cc72 Implement and "immediate mode" for file input - this allows one to
specify byte values on the command line instead of via a file.  This
can be good for specifying fuse bytes and eliminates the need to
create single-byte files or using interactive terminal mode for these
single-byte memories.  Requested by several folks on the mailing list.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@317 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-04-19 18:41:35 +00:00
Brian S. Dean 2c9a34523c Add Motorola S-record support.
Submitted by:		"Alexey V.Levdikov" <tsar@kemford.com>


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@200 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-02-20 03:53:49 +00:00
Theodore A. Roth 2c7934a1ca These changes add basic support for a autoconf/automake based build system.
* .cvsignore: Ignore autoconf files.
	* AUTHORS: New file.
	* ChangeLog: New file.
	* Makefile: Removed file.
	* Makefile.am: New file.
	* NEWS: New file.
	* README: New file.
	* bootstrap: New file.
	* configure.ac: New file.
	* avr.c: Include ac_cfg.h (generated by autoconf).
	* config.c: Include ac_cfg.h.
	Include config_gram.h instead of y.tab.h.
	* config.h: If HAS_YYSTYPE is not defined, define YYSTYPE.
	* config_gram.y: Include ac_cfg.h.
	* fileio.c: Include ac_cfg.h.
	* lexer.l: Include config_gram.h instead of y.tab.h.
	* lists.c: Include ac_cfg.h.
	* main.c: Include ac_cfg.h.
	* par.c: Include ac_cfg.h.
	* pgm.c: Include ac_cfg.h.
	* ppi.c: Include ac_cfg.h.
	* stk500.c: Include ac_cfg.h.
	* term.c: Include ac_cfg.h.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@192 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-02-14 20:34:03 +00:00
Brian S. Dean ee8bf2d5fc Makefile: include a target to automatically generate the dependency
list.

All others


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@177 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-02-08 04:17:25 +00:00
Brian S. Dean 08e8c6e8ee Re-license using the GNU GPL. Thanks to Ted Roth for the patch.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@172 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-02-06 19:08:33 +00:00
Brian S. Dean 1e0c4f8756 Get rid of the verbose printing of individual file CVS version ids.
This was intended to be used for identifying code in the field for
incoming bug reports, but I've never really found it all that useful.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@171 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-02-06 05:45:06 +00:00
Brian S. Dean 4d2df35736 Implement a way of tracking how many erase-rewrite cycles a part has
undergone.  This utilizes the last two bytes of EEPROM to maintain a
counter that is incremented each time the part is erased.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@138 81a1dc3b-b13d-400b-aceb-764788c761c2
2002-08-01 01:00:03 +00:00
Brian S. Dean fbbd6ce36e Update version number. Update copyright.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@118 81a1dc3b-b13d-400b-aceb-764788c761c2
2002-01-12 01:51:35 +00:00
Brian S. Dean fb233af934 This is a jajor re-write of the programming algorithms. The Atmel
serial programming instructions are not very orthoganal, i.e., the
"read fuse bits" instruction on an ATMega103 is an entirely different
opcode and data format from the _same_ instruction for an ATMega163!
Thus, it becomes impossible to have a single instruction encoding
(varying the data) across the chip lines.

This set of changes allows and requires instruction encodings to be
defined on a per-part basis within the configuration file.  Hopefully
I've defined the encoding scheme in a general enough way so it is
useful in describing the instruction formats for yet-to-be invented
Atmel chips.  I've tried hard to make it match very closely with the
specification in Atmel's data sheets for their parts.  It's a little
more verbose than what I initially hoped for, but I've tried to keep
it as concise as I could, while still remaining reasonably flexible.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@100 81a1dc3b-b13d-400b-aceb-764788c761c2
2001-11-21 02:46:55 +00:00
Brian S. Dean 3bae0d8d14 First cut at supporting the ATmega 103 which uses bank addressing and
has a 128K flash.

Due to the bank addressing required, interactive update of the flash
is not supported, though the eeprom can be updated interactively.
Both memories can be programmed via non-interactive mode.

Intel Hex Record type '04' is now generated as required for outputing
memory contents that go beyond 64K.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@78 81a1dc3b-b13d-400b-aceb-764788c761c2
2001-10-14 02:53:21 +00:00
Brian S. Dean f73b0f9eba Style fixes.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@77 81a1dc3b-b13d-400b-aceb-764788c761c2
2001-10-13 03:13:13 +00:00
Brian S. Dean 42a81370c7 Commit changes in preparation for support the ATMega line.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@76 81a1dc3b-b13d-400b-aceb-764788c761c2
2001-10-13 03:12:52 +00:00
Brian S. Dean 88b4c8c41f Remove debugging code - it served its purpose.
Update copyrights.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@72 81a1dc3b-b13d-400b-aceb-764788c761c2
2001-10-01 14:04:46 +00:00
Brian S. Dean 9003ed1183 Make the pin definitions configurable based on entries in a config
file.  This makes supporting other programmers much easier.

Rename AVRprog.pdf to avrprog.pdf.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@67 81a1dc3b-b13d-400b-aceb-764788c761c2
2001-09-19 17:04:25 +00:00