Commit Graph

82 Commits

Author SHA1 Message Date
Dawid Buchwald b6e72dce4c Implemented basic serial code refactoring for upcoming SerialUPDI implementation
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serial_refactoring@1511 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:27 +01:00
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 785b0cea55 patch #9819: Address several leaks in SVN rev 1429
Submitted by Adrian Klieber



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1435 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-14 22:34:45 +00:00
Joerg Wunsch 6543ee1df6 Submitted by Tom Carney:
patch #8219: Fix boot_start for xmega devices on jtagmkII
* jtagmkII.c (jtagmkII_initialize): Determine boarder between
application and boot area correctly.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1418 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-16 22:01:36 +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 2d2f71fb28 Removing exit calls from config parser
* config.h: cleanup, left only internally needed definitions
* config.c: removed exit calls, use yyerror and yywarning
* config_gram.y: (Dito.)
* lexer.l: (Dito.)
* libavrdude.h: removed internal definitions of config parser
* main.c: removed yyerror, it is now in config.c
* jtagmkII.c: added missing free in error case
* pgm.c: replaced exits by returns
* pickit2.c: add missing return



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1322 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-06-17 20:08:28 +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 57903bdeb8 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 f80f51f6a9 Change the second parameter of the ser_open method from "baud" into a
"union pinfo", so the USB parameters can be passed without hacks.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1276 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-21 13:44:11 +00:00
Joerg Wunsch c0d9de9b67 Fix byte-wise EEPROM and flash writes on Xmega
* jtagmkII_private.h (MTYPE_EEPROM_XMEGA): New memory type.
* jtagmkII.c (jtagmkII_write_byte): For Xmega EEPROM, use
memory type MTYPE_EEPROM_XMEGA; for flash writes, always
write 2 bytes starting on an even address.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1212 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-09-08 19:57:58 +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 46f7b6b470 Submitted by "Malte" and John McCorquodale:
patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
is enabled AND target has a very slow clock
* jtagmkII.c (jtagmkII_getsync): When leaving debugWIRE mode
temporarily, immediately retry with ISP, rather than leaving.
* stk500v2 (stk500v2_program_enable): Implemented similar logic
for the JTAGICE3.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1183 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-05-17 16:23:55 +00:00
Joerg Wunsch 76df1b5b6e Replace some stray calls to putchar() by putc(..., stderr).
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1131 81a1dc3b-b13d-400b-aceb-764788c761c2
2013-01-08 21:02:01 +00:00
Joerg Wunsch 93d4697961 bug #37942: Latest SVN can't program in dragon_jtag mode
* jtagmkII.c (jtagmkII_initialize): For Xmega devices, and
firmware >= 7.x, don't trigger a RESET, in order to work around a
firmware bug that appears to be present in at least firmware 7.24
for the Dragon.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1125 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-12-18 09:20:06 +00:00
Joerg Wunsch 2abf90726e * jtag3.c: Fill in the missing pieces for Xmega support (both,
PDI and JTAG).
* jtagmkII.c (jtagmkII_set_xmega_params): Use "fuse1" rather
than "fuse0" memory space to fill in the NVM offset from, as
there is no "fuse0" on some Xmega devices.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1111 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-29 13:31:11 +00:00
Joerg Wunsch 1af820c0b9 Change all the USB details (endpoint numbers, max transfer size etc.)
to a per-programmer adjustable value.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1108 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-26 16:24:56 +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 be820748f2 Return MTYPE_FLASH from jtagmkII_memtype() rather than
MTYPE_SPM for non-Xmega flash regions.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1096 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-07-25 14:56:39 +00:00
Joerg Wunsch b9a38193a0 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 36ca4dce5c Fix for previous fix: add memtype for "flash".
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1088 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-26 11:01:19 +00:00
Joerg Wunsch f2f59a2d2e * jtagmkII.c (jtagmkII_paged_load, jtagmkII_paged_write): fix bug
in memory type calculation for Xmega "boot" memory region.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1087 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-26 10:57:09 +00:00
Joerg Wunsch 3a4b48b583 bug #28744: Can't load bootloader to xmega128a1 (part 2, fix for
firmware >= V7.x)
* jtagmkII.c: Add firmware-version dependent handling of Xmega parameters.
V7.x firmware expects the NVM offsets being specified through the Xmega
parameters command, but left out as part of the memory address itself.
* jtagmkII_private.h: Add CMND_SET_XMEGA_PARAMS, and struct xmega_device_desc.
* config_gram.y: Add mcu_base keyword.
* avrpart.h: (Dito.)
* lexer.l: (Dito.)
* avrdude.conf.in (.xmega): add mcu_base, and data memory segment.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1078 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-04-13 15:25:41 +00:00
Joerg Wunsch df6f97d78c bug #28744: Can't load bootloader to xmega128a1 (part 1, fix for
firmware < V7.x)
* jtagmkII.c: When going to write to the boot section of flash,
use MTYPE_BOOT_FLASH rather than MTYPE_FLASH
* jtagmkII_private.h: add MTYPE_BOOT_FLASH constant



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1077 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-03-30 16:19:13 +00:00
Joerg Wunsch d3a655ae58 Shesh. The previous commit was a little premature. Drag the
"GO" code in again, but only activate it when programming an
Xmega device through PDI.

Wonderfully consistent tools.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1071 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-03-20 14:42:20 +00:00
Joerg Wunsch 229b7cd075 * jtagmkII.c (jtagmkII_close): The GO command before signing off
turned out to do more harm than good; on the Xmega, it caused exactly
the opposite reaction, the CPU stopped.  Even without it, after the
RESET command, the target is running already.  So, drop the GO.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1070 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-03-20 14:21:33 +00:00
Rene Liebscher c1095de822 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 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 1f8dc4dc52 bug #33114: Segfault after setting the DWEN fuse with Dragon
* jtagII.c (jtagmkII_getsync): Instead of exit()ing from
deep within the tree when detecting the "need debugWIRE"
situation, properly pass this up as a return code.
* jtagII_private.h (JTAGII_GETSYNC_FAIL_GRACEFUL): New constant.
* stk500v2.c (stk500v2_jtagmkII_open): Don't tell anything
anymore when receiving a JTAGII_GETSYNC_FAIL_GRACEFUL from
jtagmkII_getsync(); silently give up (all necessary has been
said already).



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@983 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-26 10:05:09 +00:00
Joerg Wunsch 161291f5ae Submitted by Timon Van Overveldt:
bug #30268: Debugwire broken in avrdude-5.10
* jtagmkII.c (jtagmkII_initialize): only try setting up a JTAG chain when
the programmer is using JTAG.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@973 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-08-16 18:47:52 +00:00
Joerg Wunsch 267697983f Bump timeout values to allow for slow clock speeds. Ideally, the
timeout should depend on the selected clock speed, but changing the
API for that would require quite some effort throughout the entire
code base.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@954 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-05-11 20:42:27 +00:00
Nils Springob 0c603e4791 * serial_open() calls will now return -1 on error (no call to exit())
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@948 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-10-22 14:29:56 +00:00
Joerg Wunsch 046db1aa07 If entering JTAG mode fails with a bad JTAG ID message, retry with
external reset applied (in case the target is in sleep mode or has
asserted the JTD bit).



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@926 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-17 17:31:10 +00:00
Joerg Wunsch e2abbd7d84 * avrdude.1: Update documentation to match the reality (device
support, memory areas).
* doc/avrdude.texi: Update documentation to match the
reality (device support, programmer support, memory areas).
Merge buspirate-specific comments from avrdude.1.
* jtagmkII.c: Add some firmware feature checks.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@913 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-14 13:46:02 +00:00
Joerg Wunsch 30be2be8ca Implement PDI mode support for the JTAG ICE mkII and the AVR Dragon.
(AVR Dragon not yet verified.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@912 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-13 17:34:18 +00:00
Joerg Wunsch 9dea1a623d * jtagmkII.c: Stylistic changes: move #defines out into
jtagmkII_private.h, drop all #if 0 blocks, fold overly long lines,
move the *_initpgm() functions to the end of the file; while being
here, remove all trailing whitespace.
* jtagmkII_private.h: move AVR32 #defines here.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@909 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-13 08:37:57 +00:00
Joerg Wunsch 5774debe8f After erasing an Xmega part, do *not* reinitialize the world, as a
subsequent programming operation will fail (for unknown reasons).
Actually, this was really only required for ancient AVRs, but doesn't
hurt on mega and tiny devices.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@904 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-11 16:04:29 +00:00
Joerg Wunsch 37fbb66f07 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 f7cb1f53ea Fix a few warnings that came up recently (some of them only triggered
by recent GCC versions).
* config_gram.y (parse_cmdbits): "brkt possibly used uninitialized"
(GCC errs here)
* jtagmkII.c (jtagmkII_reset32): "status possibly used uninitialized"
(I think GCC errs, too)
* buspirate.c: "pointers differ in signedness" (mismatch between
string processing and the use of "unsigned char" throughought the
AVRDUDE API)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@882 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-07 13:13:02 +00:00
Joerg Wunsch 23d95b80dd jtagmkII_smc_init32(): replace sleep() by usleep() for
win32 compatibility.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@881 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-01 08:55:33 +00:00
David Hoerl a5872f43f9 Small changes to remove warnings in avr32 code
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@871 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-12 22:33:49 +00:00
David Hoerl 53ac27af20 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
David Hoerl 185feee936 Removed some comments
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@863 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-10 23:44:06 +00:00
David Hoerl 859977db9a AVR32 verify and read now work
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@862 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-10 23:34:03 +00:00
David Hoerl 22d839cb0a AVR32
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@850 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-10 20:09:53 +00:00
Joerg Wunsch 0b871f2b6e * jtagmkI.c (jtagmkI_send): Replace %zd format by %u since not all
implementations do understand the C99 formatting options (sigh).
* jtagmkII.c (jtagmkII_send): (Ditto.)
* stk500v2.c (stk500v2_recv): (Ditto.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@836 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-07-10 22:39:37 +00:00
Joerg Wunsch a5f42858ea Contributed by Zoltan Laday:
patch #6825: xmega problems with JTAGICEmkII
* jtagmkII.c: Many fixes for Xmega devices.
* jtagmkII_private.h: Add various new constants required for
Xmega devices.
* avrdude.conf.in: New devices: ATXMEGA64A1, ATXMEGA192A1,
ATXMEGA256A1, ATXMEGA64A3, ATXMEGA128A3, ATXMEGA192A3,
ATXMEGA256A3, ATXMEGA256A3B, ATXMEGA16A4, ATXMEGA32A4,
ATXMEGA64A4, ATXMEGA128A4
* avr.c (avr_read, avr_write): Add more names for (Xmega)
memory areas that require paged operation.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@821 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-06-24 21:32:12 +00:00
Joerg Wunsch 3d87270ef2 Submitted by Ed Okerson:
* jtagmkII.c (jtagmkII_read_byte): Fix signature reading of
Xmega.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@810 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-02-27 08:29:30 +00:00
Joerg Wunsch 8b35dc3620 More fixes for Solaris, including fixes for the Sunpro compiler:
* avr.h: Remove stray semicolon.
* configure.ac: Add check for predefined types uint_t and ulong_t.
* confwin.c: Include "avrdude.h" on top to avoid empty translation
unit warning.
* ppwin.c: (Ditto.)
* ser_win32.c: (Ditto.)
* serbb_win32.c: (Ditto.)
* jtagmkII.c (jtagmkII_recv): remove unreachable "return".
* stk500.c (stk500_initialize): (Ditto.)
* par.c: Test for both, __sun__ and __sun to see whether we are
being compiled on Solaris.
* ppi.c: (Ditto.)
* stk500v2.c: Implement the DEBUG and DEBUGRECV macros in a way
that is compatible with the ISO C99 standard.
* usbtiny.c: Only typedef uint_t and ulong_t if they have not
been found already by the autoconf checks.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@804 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-02-23 22:04:57 +00:00