Commit Graph

66 Commits

Author SHA1 Message Date
Joerg Wunsch 3f5e101f09 Fix various typos.
Submitted by Adrian Klieber
patch #9818: correct typos in SVN rev 1429



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1443 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:31:19 +00:00
Joerg Wunsch 061406c602 Fix compiler warnings
* misleading indentation after spin loop
* EM_AVR32 might be defined in system <libelf.h> already


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1431 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-11 09:41:15 +00:00
Joerg Wunsch 83ff6d306d bug #37441: lockbits in ATxmega + avrdude = problem
* fileio.c: replace strmcp(..., "lock") by strncmp(..., "lock", 4)
where applicable



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1338 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-10-15 20:01:12 +00:00
Rene Liebscher 8fd3870861 bug #42662 clang warnings under FreeBSD 10.x
* avrftdi.c: remove warnings
* buspirate.c: (Dito.)
* dfu.c: (Dito.)
* fileio.c: (Dito.)
* libavrdude.h: (Dito.)
* pickit2.c: (Dito.)
* safemode.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500v2.c: (Dito.)
* usb_libusb.c: (Dito.)
* usbasp.c: (Dito.)

* config_gram.y: fix problem when using parent part with usbpid lists
                 (existing list was extended not overwritten)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1328 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-07-16 20:02:01 +00:00
Axel Wachtler c6788bd795 added verbose level in avrdude_message()
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1321 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-06-13 20:07:40 +00:00
Joerg Wunsch d09bc2e1fb Join the former "public" header files (avr.h avrpart.h pindefs.h
serial.h fileio.h safemode.h update.h pgm_type.h config.h confwin.h
lists.h) into a single header that can be included by anyone wanting
to link against the library.

Adapt everything to cope with this situation.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1311 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-19 10:01:59 +00:00
Axel Wachtler eb5fcb581f Exchange of fprintf(stderr, ...) with avrdude_message(...).
This change was made for the shared library, since library functions
should not write to std-streams directly. Instead avrdude_message()
has to be implemented by the library user. For the avrdude application
this function is implemented in main.c.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1305 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-18 08:41:46 +00:00
Joerg Wunsch 8fa7417923 bug #40817: Elf file support (possibly) not working on 6.0.1 windows build
* fileio.c (fileio): open file in binary mode also for FMT_ELF




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1253 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-12-05 16:27:54 +00:00
Joerg Wunsch e814b615b2 * fileio.c (fileio): Don't exit(1) if something goes wrong; return
-1 instead.  Don't refer to obsolete option -f to specify the file
format.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1216 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-11 09:21:37 +00:00
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