mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-18 11:24:42 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
078a334625 |
@@ -6,5 +6,4 @@ Contributors:
|
|||||||
|
|
||||||
Joerg Wunsch <j@uriah.heep.sax.de>
|
Joerg Wunsch <j@uriah.heep.sax.de>
|
||||||
Eric Weddington <eric@umginc.net>
|
Eric Weddington <eric@umginc.net>
|
||||||
Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,158 +1,3 @@
|
|||||||
2003-04-17 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* configure.ac: Set version to 4.1.0.
|
|
||||||
* doc/avrdude.texi: Add note about avr910 programmer type.
|
|
||||||
|
|
||||||
2003-04-17 Eric B. Weddington <eric@umginc.net>
|
|
||||||
|
|
||||||
* NEWS: Replace TBD with new release version.
|
|
||||||
|
|
||||||
2003-04-17 Eric B. Weddington <eric@umginc.net>
|
|
||||||
|
|
||||||
* avrdude.conf.in: Change name of pony programmer to pony-stk200
|
|
||||||
to better describe the hardware (PonyProg is software that works
|
|
||||||
with various hardware).
|
|
||||||
|
|
||||||
2003-04-16 Eric B. Weddington <eric@umginc.net>
|
|
||||||
|
|
||||||
* avrdude.conf.in: Add support for ATtiny26
|
|
||||||
Submitted by Artur Lipowski <LAL@pro.onet.pl>
|
|
||||||
* NEWS: List new devices supported: ATtiny26
|
|
||||||
|
|
||||||
2003-04-16 Eric B. Weddington <eric@umginc.net>
|
|
||||||
|
|
||||||
* avrdude.conf.in: Add support for ATmega8535
|
|
||||||
Submitted by Alexander Peter <apeter@gmx.de>
|
|
||||||
* NEWS: List new devices supported: ATmega8535
|
|
||||||
|
|
||||||
2003-04-09 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avr910.c: Reading a 16 bit word in paged load needs to swap the
|
|
||||||
bytes since the 'R' command returns MSB first and the internal buffer
|
|
||||||
stores LSB first.
|
|
||||||
|
|
||||||
2003-04-07 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* stk500.c: Don't print out read/write byte progress unless the verbose
|
|
||||||
option is given.
|
|
||||||
|
|
||||||
2003-04-05 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avr910.c: Re-add the avr910 byte read/write methods which were
|
|
||||||
removed in my previous patch. Terminal mode read/writes are broken
|
|
||||||
without those methods. D'oh!
|
|
||||||
|
|
||||||
2003-04-05 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avr910.c: Refactor to allow probing for auto addr increment. If auto
|
|
||||||
incr supported by programmer hw, don't send addr for every byte.
|
|
||||||
|
|
||||||
2003-04-03 Eric B. Weddington <eric@umginc.net>
|
|
||||||
|
|
||||||
* confwin.c: Fix bug that allows garbage for non-existent user
|
|
||||||
config filename on Windows.
|
|
||||||
|
|
||||||
2003-03-24 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* NEWS: Add note about avr910 support.
|
|
||||||
|
|
||||||
2003-03-23 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avr.c (avr_write): Add call to pgm->write_setup() before the write
|
|
||||||
loop.
|
|
||||||
* avr910.c: Change all show_func_info() calls to no_show_func_info().
|
|
||||||
Add read/write to/from flash/eeprom memory functionality.
|
|
||||||
* pgm.c: Initialize pgm->write_setup.
|
|
||||||
* pgm.h: Add write_setup field to PROGRAMMER structure.
|
|
||||||
* ser_posix.c: Remove unneeded cast in verbosity code.
|
|
||||||
|
|
||||||
2003-03-23 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* ser_posix.c: Limit verbose output to 2 chars.
|
|
||||||
|
|
||||||
2003-03-23 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* ser_posix.c: Add verbose level > 3 output for send and recv functions.
|
|
||||||
|
|
||||||
2003-03-23 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avr.c: Add avr_read_byte_default().
|
|
||||||
Have avr_read_byte() call pgm->read_byte() or avr_read_byte_default().
|
|
||||||
Add avr_write_byte_default().
|
|
||||||
Have avr_write_byte() call pgm->write_byte or avr_write_byte_default().
|
|
||||||
* pgm.c: Initialize pgm->write_byte and pgm->read_byte.
|
|
||||||
* pgm.h: Add write_byte and read_byte fields to struct programmer_t.
|
|
||||||
|
|
||||||
2003-03-17 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avrdude.conf.in: Fix typo for devicecode deprecation comment.
|
|
||||||
|
|
||||||
2003-03-17 Eric B. Weddington <eric@umginc.net>
|
|
||||||
|
|
||||||
* avrdude.conf.in: Add Bascom SAMPLE programmer.
|
|
||||||
Submitted by Larry Barello <larryba@barrello.net>
|
|
||||||
|
|
||||||
2003-03-16 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avr.c (avr_read): Use pgm->read_sig_bytes to read signature bytes if
|
|
||||||
available.
|
|
||||||
* avr910.c (avr910_vfy_cmd_sent): New function.
|
|
||||||
(avr910_chip_erase): Add support for chip erase.
|
|
||||||
(avr910_enter_prog_mode): New function.
|
|
||||||
(avr910_leave_prog_mode): New function.
|
|
||||||
(avr910_initialize): Add code to select device type and enter prog mode.
|
|
||||||
(avr910_close): Leave programming mode before closing serial port.
|
|
||||||
(avr910_read_sig_bytes): New function.
|
|
||||||
(avr910_initpgm): Add avr910_read_sig_bytes method to pgm initializer.
|
|
||||||
* avrdude.conf.in: Add note about deprecating devicecode.
|
|
||||||
Change all occurences of devicecode to stk500_devcode.
|
|
||||||
Add avr910_devcode to a few parts for testing.
|
|
||||||
* avrpart.h (struct avrpart): Change devicecode field to stk500_devcode.
|
|
||||||
(struct avrpart): Add avr910_devcode field.
|
|
||||||
* config_gram.y: Add K_STK500_DEVCODE and K_AVR910_DEVCODE tokens.
|
|
||||||
Generate an error if devicecode is found in the config file.
|
|
||||||
Handle parsing of avr910_devcode and stk500_devcode.
|
|
||||||
* lexer.l: Handle parsing of avr910_devcode and stk500_devcode.
|
|
||||||
* pgm.c: Initialize pgm->read_sig_bytes field.
|
|
||||||
* pgm.h: Add pgm->read_sig_bytes field.
|
|
||||||
* stk500.c: Use stk500_devcode instead of devicecode.
|
|
||||||
|
|
||||||
2003-03-16 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* avrdude.conf.in: Add avr910 and pavr programmers.
|
|
||||||
* config_gram.y: Add parsing of avr910 programmer.
|
|
||||||
* lexer.l: Add avr910 token.
|
|
||||||
* avr910.c: [this is still work in progress]
|
|
||||||
Add some debug output.
|
|
||||||
Add probe for programmer presense.
|
|
||||||
* main.c: Set port to default_serial if programmer type is avr910.
|
|
||||||
|
|
||||||
2003-03-13 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* ser_posix.c, ser_win32.c, serial.h:
|
|
||||||
Change baud from int to long to avoid a 16-bit int overflow.
|
|
||||||
|
|
||||||
2003-03-12 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* Makefile.am (avrdude_SOURCES): Add avr910.[ch], serial.h and
|
|
||||||
ser_posix.c files.
|
|
||||||
* avr910.c: New file (stubs for avr910 serial programmer).
|
|
||||||
* avr910.h: New file.
|
|
||||||
* ser_posix.c: New file.
|
|
||||||
* ser_win32.c: New file (just stubs for now).
|
|
||||||
* serial.h: New file.
|
|
||||||
* stk500.c: Move all the code for accessing the posix serial ports
|
|
||||||
into ser_posix. This will make a native win32 port easier and allows
|
|
||||||
the avr910 programmer to share the serial code.
|
|
||||||
|
|
||||||
2003-03-12 Theodore A. Roth <troth@openavr.org>
|
|
||||||
|
|
||||||
* configure.ac (AC_INIT): Set version to 4.0.0cvs since we're done
|
|
||||||
with 4.0.0 release.
|
|
||||||
|
|
||||||
2003-03-12
|
|
||||||
* AVRDUDE 4.0.0 has been released (cvs release tag is "release_4_0_0").
|
|
||||||
|
|
||||||
2003-03-11 Theodore A. Roth <troth@openavr.org>
|
2003-03-11 Theodore A. Roth <troth@openavr.org>
|
||||||
|
|
||||||
* Makefile.am: Add CLEANFILES to remove all files from a make.
|
* Makefile.am: Add CLEANFILES to remove all files from a make.
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ avrdude_SOURCES = \
|
|||||||
lexer.l \
|
lexer.l \
|
||||||
avr.c \
|
avr.c \
|
||||||
avr.h \
|
avr.h \
|
||||||
avr910.c \
|
|
||||||
avr910.h \
|
|
||||||
avrpart.h \
|
avrpart.h \
|
||||||
config.c \
|
config.c \
|
||||||
config.h \
|
config.h \
|
||||||
@@ -69,9 +67,6 @@ avrdude_SOURCES = \
|
|||||||
ppi.c \
|
ppi.c \
|
||||||
ppi.h \
|
ppi.h \
|
||||||
ppiwin.c \
|
ppiwin.c \
|
||||||
serial.h \
|
|
||||||
ser_posix.c \
|
|
||||||
ser_win32.c \
|
|
||||||
stk500.c \
|
stk500.c \
|
||||||
stk500.h \
|
stk500.h \
|
||||||
stk500_private.h \
|
stk500_private.h \
|
||||||
|
|||||||
12
avrdude/NEWS
12
avrdude/NEWS
@@ -6,21 +6,11 @@ Approximate change log for AVRDUDE by version.
|
|||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
Version 4.1.0
|
|
||||||
|
|
||||||
* Add support for the Bascom SAMPLE programmer. Submitted by
|
|
||||||
Larry Barello <larryba@barrello.net>
|
|
||||||
|
|
||||||
* Add support for avr910 type programmers (mcu00100, pavr avr910, etc).
|
|
||||||
|
|
||||||
* Support new devices: ATmega8535, ATtiny26
|
|
||||||
|
|
||||||
|
|
||||||
Version 4.0.0
|
Version 4.0.0
|
||||||
|
|
||||||
* Now support Linux - added by "Theodore A. Roth" <troth@openavr.org>
|
* Now support Linux - added by "Theodore A. Roth" <troth@openavr.org>
|
||||||
|
|
||||||
* Now support Windows - added by "Eric B. Weddington" <eric@umginc.net>
|
* Now support Windows - added by "E. Weddington" <eric@umginc.net>
|
||||||
|
|
||||||
* Use 'configure' scripts to tailor the code to the system avrdude
|
* Use 'configure' scripts to tailor the code to the system avrdude
|
||||||
is getting ready to be compiled on - added by "Theodore A. Roth"
|
is getting ready to be compiled on - added by "Theodore A. Roth"
|
||||||
|
|||||||
@@ -287,8 +287,11 @@ int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
/*
|
||||||
unsigned long addr, unsigned char * value)
|
* read a byte of data from the indicated memory region
|
||||||
|
*/
|
||||||
|
int avr_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||||
|
unsigned long addr, unsigned char * value)
|
||||||
{
|
{
|
||||||
unsigned char cmd[4];
|
unsigned char cmd[4];
|
||||||
unsigned char res[4];
|
unsigned char res[4];
|
||||||
@@ -337,21 +340,6 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* read a byte of data from the indicated memory region
|
|
||||||
*/
|
|
||||||
int avr_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|
||||||
unsigned long addr, unsigned char * value)
|
|
||||||
{
|
|
||||||
if (pgm->read_byte) {
|
|
||||||
return pgm->read_byte(pgm, p, mem, addr, value);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return avr_read_byte_default(pgm, p, mem, addr, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the entirety of the specified memory type into the
|
* Read the entirety of the specified memory type into the
|
||||||
* corresponding buffer of the avrpart pointed to by 'p'. If size =
|
* corresponding buffer of the avrpart pointed to by 'p'. If size =
|
||||||
@@ -397,11 +385,6 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(mem->desc, "signature") == 0) {
|
|
||||||
if (pgm->read_sig_bytes) {
|
|
||||||
return pgm->read_sig_bytes(pgm, p, mem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printed = 0;
|
printed = 0;
|
||||||
|
|
||||||
@@ -477,7 +460,10 @@ int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
/*
|
||||||
|
* write a byte of data at the specified address
|
||||||
|
*/
|
||||||
|
int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||||
unsigned long addr, unsigned char data)
|
unsigned long addr, unsigned char data)
|
||||||
{
|
{
|
||||||
unsigned char cmd[4];
|
unsigned char cmd[4];
|
||||||
@@ -662,21 +648,6 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* write a byte of data at the specified address
|
|
||||||
*/
|
|
||||||
int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|
||||||
unsigned long addr, unsigned char data)
|
|
||||||
{
|
|
||||||
if (pgm->write_byte) {
|
|
||||||
return pgm->write_byte(pgm, p, mem, addr, data);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return avr_write_byte_default(pgm, p, mem, addr, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the whole memory region of the specified memory from the
|
* Write the whole memory region of the specified memory from the
|
||||||
* corresponding buffer of the avrpart pointed to by 'p'. Write up to
|
* corresponding buffer of the avrpart pointed to by 'p'. Write up to
|
||||||
@@ -733,10 +704,6 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgm->write_setup) {
|
|
||||||
pgm->write_setup(pgm, p, m);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<wsize; i++) {
|
for (i=0; i<wsize; i++) {
|
||||||
data = m->buf[i];
|
data = m->buf[i];
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
|||||||
673
avrdude/avr910.c
673
avrdude/avr910.c
@@ -1,673 +0,0 @@
|
|||||||
/*
|
|
||||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
|
||||||
* Copyright (C) 2003 Theodore A. Roth <troth@openavr.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* avrdude interface for Atmel Low Cost Serial programmers which adher to the
|
|
||||||
* protocol described in application note avr910.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ac_cfg.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "avr.h"
|
|
||||||
#include "pgm.h"
|
|
||||||
#include "avr910.h"
|
|
||||||
#include "serial.h"
|
|
||||||
|
|
||||||
extern char * progname;
|
|
||||||
extern int do_cycles;
|
|
||||||
|
|
||||||
static char has_auto_incr_addr;
|
|
||||||
|
|
||||||
/* These two defines are only for debugging. Will remove them once it starts
|
|
||||||
working. */
|
|
||||||
|
|
||||||
#define show_func_info() \
|
|
||||||
fprintf(stderr, "%s: line %d: called %s()\n", \
|
|
||||||
__FILE__, __LINE__, __FUNCTION__)
|
|
||||||
|
|
||||||
#define no_show_func_info()
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_send(PROGRAMMER * pgm, char * buf, size_t len)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
return serial_send(pgm->fd, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_recv(PROGRAMMER * pgm, char * buf, size_t len)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
return serial_recv(pgm->fd, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_drain(PROGRAMMER * pgm, int display)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
return serial_drain(pgm->fd, display);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
|
|
||||||
{
|
|
||||||
char c;
|
|
||||||
|
|
||||||
avr910_recv(pgm, &c, 1);
|
|
||||||
if (c != '\r') {
|
|
||||||
fprintf(stderr, "%s: error: programmer did not respond to command: %s\n",
|
|
||||||
progname, errmsg);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_rdy_led(PROGRAMMER * pgm, int value)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_err_led(PROGRAMMER * pgm, int value)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_pgm_led(PROGRAMMER * pgm, int value)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_vfy_led(PROGRAMMER * pgm, int value)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* issue the 'chip erase' command to the AVR device
|
|
||||||
*/
|
|
||||||
static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
avr910_send(pgm, "e", 1);
|
|
||||||
avr910_vfy_cmd_sent(pgm, "chip erase");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_enter_prog_mode(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
avr910_send(pgm, "P", 1);
|
|
||||||
avr910_vfy_cmd_sent(pgm, "enter prog mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_leave_prog_mode(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
avr910_send(pgm, "L", 1);
|
|
||||||
avr910_vfy_cmd_sent(pgm, "leave prog mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* issue the 'program enable' command to the AVR device
|
|
||||||
*/
|
|
||||||
static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* apply power to the AVR processor
|
|
||||||
*/
|
|
||||||
static void avr910_powerup(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* remove power from the AVR processor
|
|
||||||
*/
|
|
||||||
static void avr910_powerdown(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* initialize the AVR device and prepare it to accept commands
|
|
||||||
*/
|
|
||||||
static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|
||||||
{
|
|
||||||
char id[8];
|
|
||||||
char sw[2];
|
|
||||||
char hw[2];
|
|
||||||
char buf[10];
|
|
||||||
char type;
|
|
||||||
unsigned char c;
|
|
||||||
int dev_supported = 0;
|
|
||||||
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Get the programmer identifier. Programmer returns exactly 7 chars
|
|
||||||
_without_ the null.*/
|
|
||||||
|
|
||||||
avr910_send(pgm, "S", 1);
|
|
||||||
memset (id, 0, sizeof(id));
|
|
||||||
avr910_recv(pgm, id, sizeof(id)-1);
|
|
||||||
|
|
||||||
/* Get the HW and SW versions to see if the programmer is present. */
|
|
||||||
|
|
||||||
avr910_send(pgm, "V", 1);
|
|
||||||
avr910_recv(pgm, sw, sizeof(sw));
|
|
||||||
|
|
||||||
avr910_send(pgm, "v", 1);
|
|
||||||
avr910_recv(pgm, hw, sizeof(hw));
|
|
||||||
|
|
||||||
/* Get the programmer type (serial or parallel). Expect serial. */
|
|
||||||
|
|
||||||
avr910_send(pgm, "p", 1);
|
|
||||||
avr910_recv(pgm, &type, 1);
|
|
||||||
|
|
||||||
fprintf(stderr, "Found programmer: Id = \"%s\"; type = %c\n", id, type);
|
|
||||||
fprintf(stderr, " Software Version = %c.%c; ", sw[0], sw[1]);
|
|
||||||
fprintf(stderr, "Hardware Version = %c.%c\n", hw[0], hw[1]);
|
|
||||||
|
|
||||||
/* See if programmer supports autoincrement of address. */
|
|
||||||
|
|
||||||
avr910_send(pgm, "a", 1);
|
|
||||||
avr910_recv(pgm, &has_auto_incr_addr, 1);
|
|
||||||
if (has_auto_incr_addr == 'Y')
|
|
||||||
fprintf(stderr, "Programmer supports auto addr increment.\n");
|
|
||||||
|
|
||||||
/* Get list of devices that the programmer supports. */
|
|
||||||
|
|
||||||
avr910_send(pgm, "t", 1);
|
|
||||||
fprintf(stderr, "\nProgrammer supports the following devices:\n");
|
|
||||||
while (1) {
|
|
||||||
avr910_recv(pgm, &c, 1);
|
|
||||||
if (c == 0)
|
|
||||||
break;
|
|
||||||
fprintf(stderr, " Device code: 0x%02x\n", c);
|
|
||||||
|
|
||||||
/* FIXME: Need to lookup devcode and report the device. */
|
|
||||||
|
|
||||||
if (p->avr910_devcode == c)
|
|
||||||
dev_supported = 1;
|
|
||||||
};
|
|
||||||
fprintf(stderr,"\n");
|
|
||||||
|
|
||||||
if (!dev_supported) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: error: selected device is not supported by programmer: %s\n",
|
|
||||||
progname, p->id);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tell the programmer which part we selected. */
|
|
||||||
|
|
||||||
buf[0] = 'T';
|
|
||||||
buf[1] = p->avr910_devcode;
|
|
||||||
|
|
||||||
avr910_send(pgm, buf, 2);
|
|
||||||
avr910_vfy_cmd_sent(pgm, "select device");
|
|
||||||
|
|
||||||
avr910_enter_prog_mode(pgm);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_save(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_restore(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_disable(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_enable(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
/* Do nothing. */
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* transmit an AVR device command and return the results; 'cmd' and
|
|
||||||
* 'res' must point to at least a 4 byte data buffer
|
|
||||||
*/
|
|
||||||
static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
|
||||||
unsigned char res[4])
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
for (i=0; i<4; i++) {
|
|
||||||
fprintf(stderr, "cmd[%d] = 0x%02x\n", i, cmd[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_open(PROGRAMMER * pgm, char * port)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
strcpy(pgm->port, port);
|
|
||||||
pgm->fd = serial_open(port, 19200);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* drain any extraneous input
|
|
||||||
*/
|
|
||||||
avr910_drain (pgm, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void avr910_close(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
avr910_leave_prog_mode(pgm);
|
|
||||||
|
|
||||||
serial_close(pgm->fd);
|
|
||||||
pgm->fd = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_display(PROGRAMMER * pgm, char * p)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void avr910_set_addr(PROGRAMMER * pgm, unsigned long addr)
|
|
||||||
{
|
|
||||||
unsigned char cmd[3];
|
|
||||||
|
|
||||||
cmd[0] = 'A';
|
|
||||||
cmd[1] = (addr >> 8) & 0xff;
|
|
||||||
cmd[2] = addr & 0xff;
|
|
||||||
|
|
||||||
avr910_send(pgm, cmd, sizeof(cmd));
|
|
||||||
avr910_vfy_cmd_sent(pgm, "set addr");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For some reason, if we don't do this when writing to flash, the first byte
|
|
||||||
* of flash is not programmed. I susect that the board got out of sync after
|
|
||||||
* the erase and sending another command gets us back in sync. -TRoth
|
|
||||||
*/
|
|
||||||
static void avr910_write_setup(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
|
||||||
{
|
|
||||||
if (strcmp(m->desc, "flash") == 0) {
|
|
||||||
avr910_send(pgm, "y", 1);
|
|
||||||
avr910_vfy_cmd_sent(pgm, "clear LED");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned long addr, unsigned char value)
|
|
||||||
{
|
|
||||||
unsigned char cmd[2];
|
|
||||||
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
if (strcmp(m->desc, "flash") == 0) {
|
|
||||||
if (addr & 0x01) {
|
|
||||||
cmd[0] = 'C'; /* Write Program Mem high byte */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cmd[0] = 'c';
|
|
||||||
}
|
|
||||||
|
|
||||||
addr >>= 1;
|
|
||||||
}
|
|
||||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
|
||||||
cmd[0] = 'D';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd[1] = value;
|
|
||||||
|
|
||||||
avr910_set_addr(pgm, addr);
|
|
||||||
|
|
||||||
avr910_send(pgm, cmd, sizeof(cmd));
|
|
||||||
avr910_vfy_cmd_sent(pgm, "write byte");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned long addr, unsigned char * value)
|
|
||||||
{
|
|
||||||
static int cached = 0;
|
|
||||||
static unsigned char cvalue;
|
|
||||||
static unsigned long caddr;
|
|
||||||
|
|
||||||
if (cached && ((caddr + 1) == addr)) {
|
|
||||||
*value = cvalue;
|
|
||||||
cached = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unsigned char buf[2];
|
|
||||||
|
|
||||||
avr910_set_addr(pgm, addr >> 1);
|
|
||||||
|
|
||||||
avr910_send(pgm, "R", 1);
|
|
||||||
|
|
||||||
/* Read back the program mem word (MSB first) */
|
|
||||||
avr910_recv(pgm, buf, sizeof(buf));
|
|
||||||
|
|
||||||
if ((addr & 0x01) == 0) {
|
|
||||||
*value = buf[1];
|
|
||||||
cached = 1;
|
|
||||||
cvalue = buf[0];
|
|
||||||
caddr = addr;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*value = buf[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned long addr, unsigned char * value)
|
|
||||||
{
|
|
||||||
avr910_set_addr(pgm, addr);
|
|
||||||
avr910_send(pgm, "d", 1);
|
|
||||||
avr910_recv(pgm, value, 1);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned long addr, unsigned char * value)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
if (strcmp(m->desc, "flash") == 0) {
|
|
||||||
return avr910_read_byte_flash(pgm, p, m, addr, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(m->desc, "eeprom") == 0) {
|
|
||||||
return avr910_read_byte_eeprom(pgm, p, m, addr, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
int page_size, int n_bytes)
|
|
||||||
{
|
|
||||||
unsigned char cmd[] = {'c', 'C'};
|
|
||||||
unsigned char buf[2];
|
|
||||||
unsigned int addr = 0;
|
|
||||||
unsigned int max_addr = n_bytes;
|
|
||||||
|
|
||||||
avr910_write_setup(pgm, p, m);
|
|
||||||
|
|
||||||
avr910_set_addr(pgm, addr>>1);
|
|
||||||
|
|
||||||
while (addr < max_addr) {
|
|
||||||
buf[0] = cmd[addr & 0x01];
|
|
||||||
buf[1] = m->buf[addr];
|
|
||||||
avr910_send(pgm, buf, sizeof(buf));
|
|
||||||
avr910_vfy_cmd_sent(pgm, "write byte");
|
|
||||||
|
|
||||||
addr++;
|
|
||||||
|
|
||||||
if ((has_auto_incr_addr != 'Y') && ((addr & 0x01) == 0)) {
|
|
||||||
avr910_set_addr(pgm, addr>>1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
|
|
||||||
AVRMEM * m, int page_size, int n_bytes)
|
|
||||||
{
|
|
||||||
unsigned char cmd[2];
|
|
||||||
unsigned int addr = 0;
|
|
||||||
unsigned int max_addr = n_bytes;
|
|
||||||
|
|
||||||
avr910_set_addr(pgm, addr);
|
|
||||||
|
|
||||||
cmd[0] = 'D';
|
|
||||||
|
|
||||||
while (addr < max_addr) {
|
|
||||||
cmd[1] = m->buf[addr];
|
|
||||||
avr910_send(pgm, cmd, sizeof(cmd));
|
|
||||||
avr910_vfy_cmd_sent(pgm, "write byte");
|
|
||||||
|
|
||||||
addr++;
|
|
||||||
|
|
||||||
if (has_auto_incr_addr != 'Y') {
|
|
||||||
avr910_set_addr(pgm, addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
int page_size, int n_bytes)
|
|
||||||
{
|
|
||||||
if (strcmp(m->desc, "flash") == 0) {
|
|
||||||
return avr910_paged_write_flash(pgm, p, m, page_size, n_bytes);
|
|
||||||
}
|
|
||||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
|
||||||
return avr910_paged_write_eeprom(pgm, p, m, page_size, n_bytes);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
int page_size, int n_bytes)
|
|
||||||
{
|
|
||||||
unsigned char cmd;
|
|
||||||
int rd_size;
|
|
||||||
unsigned int addr = 0;
|
|
||||||
unsigned int max_addr;
|
|
||||||
unsigned char buf[2];
|
|
||||||
|
|
||||||
if (strcmp(m->desc, "flash") == 0) {
|
|
||||||
cmd = 'R';
|
|
||||||
rd_size = 2; /* read two bytes per addr */
|
|
||||||
}
|
|
||||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
|
||||||
cmd = 'd';
|
|
||||||
rd_size = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
|
|
||||||
max_addr = n_bytes/rd_size;
|
|
||||||
|
|
||||||
avr910_set_addr(pgm, addr);
|
|
||||||
|
|
||||||
while (addr < max_addr) {
|
|
||||||
avr910_send(pgm, &cmd, 1);
|
|
||||||
if (cmd == 'R') {
|
|
||||||
/* The 'R' command returns two bytes, MSB first, we need to put the data
|
|
||||||
into the memory buffer LSB first. */
|
|
||||||
avr910_recv(pgm, buf, 2);
|
|
||||||
m->buf[addr*2] = buf[1]; /* LSB */
|
|
||||||
m->buf[addr*2+1] = buf[0]; /* MSB */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
avr910_recv(pgm, &m->buf[addr], 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
addr++;
|
|
||||||
|
|
||||||
if (has_auto_incr_addr != 'Y') {
|
|
||||||
avr910_set_addr(pgm, addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return addr * rd_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Signature byte reads are always 3 bytes. */
|
|
||||||
|
|
||||||
static int avr910_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
if (m->size < 3) {
|
|
||||||
fprintf(stderr, "%s: memsize too small for sig byte read", progname);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
avr910_send(pgm, "s", 1);
|
|
||||||
avr910_recv(pgm, m->buf, 3);
|
|
||||||
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void avr910_initpgm(PROGRAMMER * pgm)
|
|
||||||
{
|
|
||||||
no_show_func_info();
|
|
||||||
|
|
||||||
strcpy(pgm->type, "avr910");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* mandatory functions
|
|
||||||
*/
|
|
||||||
pgm->rdy_led = avr910_rdy_led;
|
|
||||||
pgm->err_led = avr910_err_led;
|
|
||||||
pgm->pgm_led = avr910_pgm_led;
|
|
||||||
pgm->vfy_led = avr910_vfy_led;
|
|
||||||
pgm->initialize = avr910_initialize;
|
|
||||||
pgm->display = avr910_display;
|
|
||||||
pgm->save = avr910_save;
|
|
||||||
pgm->restore = avr910_restore;
|
|
||||||
pgm->enable = avr910_enable;
|
|
||||||
pgm->disable = avr910_disable;
|
|
||||||
pgm->powerup = avr910_powerup;
|
|
||||||
pgm->powerdown = avr910_powerdown;
|
|
||||||
pgm->program_enable = avr910_program_enable;
|
|
||||||
pgm->chip_erase = avr910_chip_erase;
|
|
||||||
pgm->cmd = avr910_cmd;
|
|
||||||
pgm->open = avr910_open;
|
|
||||||
pgm->close = avr910_close;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* optional functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
pgm->write_setup = avr910_write_setup;
|
|
||||||
pgm->write_byte = avr910_write_byte;
|
|
||||||
pgm->read_byte = avr910_read_byte;
|
|
||||||
|
|
||||||
pgm->paged_write = avr910_paged_write;
|
|
||||||
pgm->paged_load = avr910_paged_load;
|
|
||||||
|
|
||||||
pgm->read_sig_bytes = avr910_read_sig_bytes;
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
|
||||||
* Copyright (C) 2003 Theodore A. Roth <troth@openavr.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#ifndef __avr910_h__
|
|
||||||
#define __avr910_h__
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
void avr910_initpgm (PROGRAMMER * pgm);
|
|
||||||
|
|
||||||
#endif /* __avr910_h__ */
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
# programmer
|
# programmer
|
||||||
# id = <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted strings
|
# id = <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted strings
|
||||||
# desc = <description> ; # quoted string
|
# desc = <description> ; # quoted string
|
||||||
# type = par | stk500 | avr910; # programmer type
|
# type = par | stk500 ; # programmer type
|
||||||
# vcc = <num1> [, <num2> ... ] ; # pin number(s)
|
# vcc = <num1> [, <num2> ... ] ; # pin number(s)
|
||||||
# reset = <num> ; # pin number
|
# reset = <num> ; # pin number
|
||||||
# sck = <num> ; # pin number
|
# sck = <num> ; # pin number
|
||||||
@@ -30,9 +30,7 @@
|
|||||||
# part
|
# part
|
||||||
# id = <id> ; # quoted string
|
# id = <id> ; # quoted string
|
||||||
# desc = <description> ; # quoted string
|
# desc = <description> ; # quoted string
|
||||||
# devicecode = <num> ; # deprecated, use stk500_devcode
|
# devicecode = <num> ; # numeric
|
||||||
# stk500_devcode = <num> ; # numeric
|
|
||||||
# avr910_devcode = <num> ; # numeric
|
|
||||||
# chip_erase_delay = <num> ; # micro-seconds
|
# chip_erase_delay = <num> ; # micro-seconds
|
||||||
# pagel = <num> ; # pin name in hex, i.e., 0xD7
|
# pagel = <num> ; # pin name in hex, i.e., 0xD7
|
||||||
# bs2 = <num> ; # pin name in hex, i.e., 0xA0
|
# bs2 = <num> ; # pin name in hex, i.e., 0xA0
|
||||||
@@ -205,18 +203,6 @@ programmer
|
|||||||
type = stk500;
|
type = stk500;
|
||||||
;
|
;
|
||||||
|
|
||||||
programmer
|
|
||||||
id = "avr910";
|
|
||||||
desc = "Atmel Low Cost Serial Programmer";
|
|
||||||
type = avr910;
|
|
||||||
;
|
|
||||||
|
|
||||||
programmer
|
|
||||||
id = "pavr";
|
|
||||||
desc = "Jason Kyle's pAVR Serial Programmer";
|
|
||||||
type = avr910;
|
|
||||||
;
|
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
id = "stk200";
|
id = "stk200";
|
||||||
desc = "STK200";
|
desc = "STK200";
|
||||||
@@ -234,8 +220,8 @@ programmer
|
|||||||
# programming is currently in progress.
|
# programming is currently in progress.
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
id = "pony-stk200";
|
id = "pony";
|
||||||
desc = "Pony Prog STK200";
|
desc = "Pony Prog";
|
||||||
type = par;
|
type = par;
|
||||||
buff = 4, 5;
|
buff = 4, 5;
|
||||||
sck = 6;
|
sck = 6;
|
||||||
@@ -255,16 +241,6 @@ programmer
|
|||||||
miso = 11;
|
miso = 11;
|
||||||
;
|
;
|
||||||
|
|
||||||
programmer
|
|
||||||
id = "bascom";
|
|
||||||
desc = "Bascom SAMPLE programming cable";
|
|
||||||
type = par;
|
|
||||||
reset = 4;
|
|
||||||
sck = 5;
|
|
||||||
mosi = 2;
|
|
||||||
miso = 11;
|
|
||||||
;
|
|
||||||
|
|
||||||
programmer
|
programmer
|
||||||
id = "alf";
|
id = "alf";
|
||||||
desc = "Tony Friebel's Programmer";
|
desc = "Tony Friebel's Programmer";
|
||||||
@@ -296,7 +272,7 @@ programmer
|
|||||||
part
|
part
|
||||||
id = "t15";
|
id = "t15";
|
||||||
desc = "ATtiny15";
|
desc = "ATtiny15";
|
||||||
stk500_devcode = 0x13;
|
devicecode = 0x13;
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -383,8 +359,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "1200";
|
id = "1200";
|
||||||
desc = "AT90S1200";
|
desc = "AT90S1200";
|
||||||
stk500_devcode = 0x33;
|
devicecode = 0x33;
|
||||||
avr910_devcode = 0x13;
|
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -464,7 +439,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "4414";
|
id = "4414";
|
||||||
desc = "AT90S4414";
|
desc = "AT90S4414";
|
||||||
stk500_devcode = 0x50;
|
devicecode = 0x50;
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -524,7 +499,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "2313";
|
id = "2313";
|
||||||
desc = "AT90S2313";
|
desc = "AT90S2313";
|
||||||
stk500_devcode = 0x40;
|
devicecode = 0x40;
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -589,7 +564,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "2333";
|
id = "2333";
|
||||||
desc = "AT90S2333";
|
desc = "AT90S2333";
|
||||||
stk500_devcode = 0x42;
|
devicecode = 0x42;
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -751,7 +726,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "4433";
|
id = "4433";
|
||||||
desc = "AT90S4433";
|
desc = "AT90S4433";
|
||||||
stk500_devcode = 0x51;
|
devicecode = 0x51;
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -832,7 +807,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "4434";
|
id = "4434";
|
||||||
desc = "AT90S4434";
|
desc = "AT90S4434";
|
||||||
stk500_devcode = 0x52;
|
devicecode = 0x52;
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -912,8 +887,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "8515";
|
id = "8515";
|
||||||
desc = "AT90S8515";
|
desc = "AT90S8515";
|
||||||
stk500_devcode = 0x60;
|
devicecode = 0x60;
|
||||||
avr910_devcode = 0x38;
|
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -987,7 +961,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "8535";
|
id = "8535";
|
||||||
desc = "AT90S8535";
|
desc = "AT90S8535";
|
||||||
stk500_devcode = 0x61;
|
devicecode = 0x61;
|
||||||
chip_erase_delay = 20000;
|
chip_erase_delay = 20000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -1047,7 +1021,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "m103";
|
id = "m103";
|
||||||
desc = "ATMEGA103";
|
desc = "ATMEGA103";
|
||||||
stk500_devcode = 0xB1;
|
devicecode = 0xB1;
|
||||||
chip_erase_delay = 112000;
|
chip_erase_delay = 112000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -1140,7 +1114,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "m128";
|
id = "m128";
|
||||||
desc = "ATMEGA128";
|
desc = "ATMEGA128";
|
||||||
stk500_devcode = 0xB2;
|
devicecode = 0xB2;
|
||||||
chip_erase_delay = 9000;
|
chip_erase_delay = 9000;
|
||||||
pagel = 0xD7;
|
pagel = 0xD7;
|
||||||
bs2 = 0xA0;
|
bs2 = 0xA0;
|
||||||
@@ -1261,7 +1235,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "m16";
|
id = "m16";
|
||||||
desc = "ATMEGA16";
|
desc = "ATMEGA16";
|
||||||
stk500_devcode = 0x82;
|
devicecode = 0x82;
|
||||||
pagel = 0xd7;
|
pagel = 0xd7;
|
||||||
bs2 = 0xa0;
|
bs2 = 0xa0;
|
||||||
chip_erase_delay = 9000;
|
chip_erase_delay = 9000;
|
||||||
@@ -1365,7 +1339,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "m163";
|
id = "m163";
|
||||||
desc = "ATMEGA163";
|
desc = "ATMEGA163";
|
||||||
stk500_devcode = 0x81;
|
devicecode = 0x81;
|
||||||
chip_erase_delay = 32000;
|
chip_erase_delay = 32000;
|
||||||
pagel = 0xd7;
|
pagel = 0xd7;
|
||||||
bs2 = 0xa0;
|
bs2 = 0xa0;
|
||||||
@@ -1479,7 +1453,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "m169";
|
id = "m169";
|
||||||
desc = "ATMEGA169";
|
desc = "ATMEGA169";
|
||||||
stk500_devcode = 0x85;
|
devicecode = 0x85;
|
||||||
chip_erase_delay = 32000;
|
chip_erase_delay = 32000;
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||||
"x x x x x x x x x x x x x x x x";
|
"x x x x x x x x x x x x x x x x";
|
||||||
@@ -1593,124 +1567,6 @@ part
|
|||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
|
||||||
#------------------------------------------------------------
|
|
||||||
# ATmega32
|
|
||||||
#------------------------------------------------------------
|
|
||||||
|
|
||||||
part
|
|
||||||
id = "m32";
|
|
||||||
desc = "ATMEGA32";
|
|
||||||
stk500_devcode = 0x91;
|
|
||||||
chip_erase_delay = 32000;
|
|
||||||
pagel = 0xd7;
|
|
||||||
bs2 = 0xa0;
|
|
||||||
reset = dedicated;
|
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
|
||||||
"x x x x x x x x x x x x x x x x";
|
|
||||||
|
|
||||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0",
|
|
||||||
"x x x x x x x x x x x x x x x x";
|
|
||||||
memory "eeprom"
|
|
||||||
paged = no; /* leave this "no" */
|
|
||||||
page_size = 4; /* for parallel programming */
|
|
||||||
size = 1024;
|
|
||||||
min_write_delay = 9000;
|
|
||||||
max_write_delay = 9000;
|
|
||||||
readback_p1 = 0xff;
|
|
||||||
readback_p2 = 0xff;
|
|
||||||
read = " 1 0 1 0 0 0 0 0",
|
|
||||||
" 0 0 x x x x a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
write = " 1 1 0 0 0 0 0 0",
|
|
||||||
" 0 0 x x x x a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "flash"
|
|
||||||
paged = yes;
|
|
||||||
size = 32768;
|
|
||||||
page_size = 128;
|
|
||||||
num_pages = 256;
|
|
||||||
min_write_delay = 4500;
|
|
||||||
max_write_delay = 9000;
|
|
||||||
readback_p1 = 0xff;
|
|
||||||
readback_p2 = 0xff;
|
|
||||||
read_lo = " 0 0 1 0 0 0 0 0",
|
|
||||||
" 0 0 a13 a12 a11 a10 a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
read_hi = " 0 0 1 0 1 0 0 0",
|
|
||||||
" 0 0 a13 a12 a11 a10 a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
|
||||||
" 0 0 x x x x x x",
|
|
||||||
" x x a5 a4 a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
|
|
||||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
|
||||||
" 0 0 x x x x x x",
|
|
||||||
" x x a5 a4 a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
|
|
||||||
writepage = " 0 1 0 0 1 1 0 0",
|
|
||||||
" 0 0 a13 a12 a11 a10 a9 a8",
|
|
||||||
" a7 a6 x x x x x x",
|
|
||||||
" x x x x x x x x";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "lfuse"
|
|
||||||
size = 1;
|
|
||||||
min_write_delay = 2000;
|
|
||||||
max_write_delay = 2000;
|
|
||||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
|
||||||
"x x x x x x x x o o o o o o o o";
|
|
||||||
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
|
||||||
"x x x x x x x x i i i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "hfuse"
|
|
||||||
size = 1;
|
|
||||||
min_write_delay = 2000;
|
|
||||||
max_write_delay = 2000;
|
|
||||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
|
||||||
"x x x x x x x x o o o o o o o o";
|
|
||||||
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
|
||||||
"x x x x x x x x i i i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "lock"
|
|
||||||
size = 1;
|
|
||||||
min_write_delay = 2000;
|
|
||||||
max_write_delay = 2000;
|
|
||||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
|
||||||
"x x x x x x x x x x o o o o o o";
|
|
||||||
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
|
||||||
"x x x x x x x x 1 1 i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "signature"
|
|
||||||
size = 3;
|
|
||||||
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
|
|
||||||
"x x x x x x a1 a0 o o o o o o o o";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "calibration"
|
|
||||||
size = 1;
|
|
||||||
read = "0 0 1 1 1 0 0 0 0 0 x x x x x x",
|
|
||||||
"0 0 0 0 0 0 0 0 o o o o o o o o";
|
|
||||||
;
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
# ATmega8
|
# ATmega8
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
@@ -1718,7 +1574,7 @@ part
|
|||||||
part
|
part
|
||||||
id = "m8";
|
id = "m8";
|
||||||
desc = "ATMEGA8";
|
desc = "ATMEGA8";
|
||||||
stk500_devcode = 0x70;
|
devicecode = 0x70;
|
||||||
pagel = 0xd7;
|
pagel = 0xd7;
|
||||||
bs2 = 0xc2;
|
bs2 = 0xc2;
|
||||||
chip_erase_delay = 9000;
|
chip_erase_delay = 9000;
|
||||||
@@ -1825,225 +1681,3 @@ part
|
|||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------
|
|
||||||
# ATmega8535
|
|
||||||
#------------------------------------------------------------
|
|
||||||
|
|
||||||
part
|
|
||||||
id = "m8535";
|
|
||||||
desc = "ATMEGA8535";
|
|
||||||
stk500_devcode = 0x64;
|
|
||||||
pagel = 0xd7;
|
|
||||||
bs2 = 0xa0;
|
|
||||||
chip_erase_delay = 9000;
|
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
|
||||||
"x x x x x x x x x x x x x x x x";
|
|
||||||
|
|
||||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
|
|
||||||
"x x x x x x x x x x x x x x x x";
|
|
||||||
|
|
||||||
memory "eeprom"
|
|
||||||
size = 512;
|
|
||||||
min_write_delay = 9000;
|
|
||||||
max_write_delay = 9000;
|
|
||||||
readback_p1 = 0xff;
|
|
||||||
readback_p2 = 0xff;
|
|
||||||
read = " 1 0 1 0 0 0 0 0",
|
|
||||||
" 0 0 x x x x x a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
write = " 1 1 0 0 0 0 0 0",
|
|
||||||
" 0 0 x x x x x a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
;
|
|
||||||
memory "flash"
|
|
||||||
paged = yes;
|
|
||||||
size = 8192;
|
|
||||||
page_size = 64;
|
|
||||||
num_pages = 128;
|
|
||||||
min_write_delay = 4500;
|
|
||||||
max_write_delay = 9000;
|
|
||||||
readback_p1 = 0xff;
|
|
||||||
readback_p2 = 0xff;
|
|
||||||
read_lo = " 0 0 1 0 0 0 0 0",
|
|
||||||
" 0 0 0 0 a11 a10 a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
read_hi = " 0 0 1 0 1 0 0 0",
|
|
||||||
" 0 0 0 0 a11 a10 a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
|
||||||
" 0 0 0 0 x x x x",
|
|
||||||
" x x x a4 a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
|
|
||||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
|
||||||
" 0 0 0 0 x x x x",
|
|
||||||
" x x x a4 a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
|
|
||||||
writepage = " 0 1 0 0 1 1 0 0",
|
|
||||||
" 0 0 0 0 a11 a10 a9 a8",
|
|
||||||
" a7 a6 a5 x x x x x",
|
|
||||||
" x x x x x x x x";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "lfuse"
|
|
||||||
size = 1;
|
|
||||||
min_write_delay = 2000;
|
|
||||||
max_write_delay = 2000;
|
|
||||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
|
||||||
"x x x x x x x x o o o o o o o o";
|
|
||||||
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
|
||||||
"x x x x x x x x i i i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "hfuse"
|
|
||||||
size = 1;
|
|
||||||
min_write_delay = 2000;
|
|
||||||
max_write_delay = 2000;
|
|
||||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
|
||||||
"x x x x x x x x o o o o o o o o";
|
|
||||||
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
|
||||||
"x x x x x x x x i i i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "lock"
|
|
||||||
size = 1;
|
|
||||||
min_write_delay = 2000;
|
|
||||||
max_write_delay = 2000;
|
|
||||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
|
||||||
"x x x x x x x x x x o o o o o o";
|
|
||||||
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
|
||||||
"x x x x x x x x 1 1 i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "calibration"
|
|
||||||
size = 1;
|
|
||||||
read = "0 0 1 1 1 0 0 0 0 0 x x x x x x",
|
|
||||||
"0 0 0 0 0 0 0 0 o o o o o o o o";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "signature"
|
|
||||||
size = 3;
|
|
||||||
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
|
|
||||||
"x x x x x x a1 a0 o o o o o o o o";
|
|
||||||
;
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------
|
|
||||||
# ATtiny26
|
|
||||||
#------------------------------------------------------------
|
|
||||||
|
|
||||||
part
|
|
||||||
id = "t26";
|
|
||||||
desc = "ATTINY26";
|
|
||||||
stk500_devcode = 0x21;
|
|
||||||
pagel = 0xb3;
|
|
||||||
bs2 = 0xb2;
|
|
||||||
chip_erase_delay = 9000;
|
|
||||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
|
||||||
"x x x x x x x x x x x x x x x x";
|
|
||||||
|
|
||||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
|
|
||||||
"x x x x x x x x x x x x x x x x";
|
|
||||||
|
|
||||||
memory "eeprom"
|
|
||||||
size = 128;
|
|
||||||
min_write_delay = 9000;
|
|
||||||
max_write_delay = 20000;
|
|
||||||
readback_p1 = 0xff;
|
|
||||||
readback_p2 = 0xff;
|
|
||||||
read = "1 0 1 0 0 0 0 0 x x x x x x x x",
|
|
||||||
"x a6 a5 a4 a3 a2 a1 a0 o o o o o o o o";
|
|
||||||
|
|
||||||
write = "1 1 0 0 0 0 0 0 x x x x x x x x",
|
|
||||||
"x a6 a5 a4 a3 a2 a1 a0 i i i i i i i i";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "flash"
|
|
||||||
paged = yes;
|
|
||||||
size = 2048;
|
|
||||||
page_size = 32;
|
|
||||||
num_pages = 64;
|
|
||||||
min_write_delay = 4500;
|
|
||||||
max_write_delay = 20000;
|
|
||||||
readback_p1 = 0xff;
|
|
||||||
readback_p2 = 0xff;
|
|
||||||
read_lo = " 0 0 1 0 0 0 0 0",
|
|
||||||
" x x x x x x a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
read_hi = " 0 0 1 0 1 0 0 0",
|
|
||||||
" x x x x x x a9 a8",
|
|
||||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
|
||||||
" o o o o o o o o";
|
|
||||||
|
|
||||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
|
||||||
" x x x x x x x x",
|
|
||||||
" x x x x a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
|
|
||||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
|
||||||
" x x x x x x x x",
|
|
||||||
" x x x x a3 a2 a1 a0",
|
|
||||||
" i i i i i i i i";
|
|
||||||
|
|
||||||
writepage = " 0 1 0 0 1 1 0 0",
|
|
||||||
" x x x x x x a9 a8",
|
|
||||||
" a7 a6 a5 a4 x x x x",
|
|
||||||
" x x x x x x x x";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "signature"
|
|
||||||
size = 3;
|
|
||||||
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
|
|
||||||
"0 0 0 0 0 0 a1 a0 o o o o o o o o";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "lock"
|
|
||||||
size = 1;
|
|
||||||
read = "0 1 0 1 1 0 0 0 x x x x x x x x",
|
|
||||||
"x x x x x x x x x x x x x x o o";
|
|
||||||
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 1 1 1 1 1 i i",
|
|
||||||
"x x x x x x x x x x x x x x x x";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "lfuse"
|
|
||||||
size = 1;
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
|
||||||
"x x x x x x x x i i i i i i i i";
|
|
||||||
|
|
||||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
|
||||||
"x x x x x x x x o o o o o o o o";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "hfuse"
|
|
||||||
size = 1;
|
|
||||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
|
||||||
"x x x x x x x x x x x i i i i i";
|
|
||||||
|
|
||||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
|
||||||
"x x x x x x x x x x x o o o o o";
|
|
||||||
;
|
|
||||||
|
|
||||||
memory "calibration"
|
|
||||||
size = 4;
|
|
||||||
read = "0 0 1 1 1 0 0 0 x x x x x x x x",
|
|
||||||
"0 0 0 0 0 0 a1 a0 o o o o o o o o";
|
|
||||||
;
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,8 +81,7 @@ typedef struct opcode {
|
|||||||
typedef struct avrpart {
|
typedef struct avrpart {
|
||||||
char desc[AVR_DESCLEN]; /* long part name */
|
char desc[AVR_DESCLEN]; /* long part name */
|
||||||
char id[AVR_IDLEN]; /* short part name */
|
char id[AVR_IDLEN]; /* short part name */
|
||||||
int stk500_devcode; /* stk500 device code */
|
int devicecode; /* Atmel STK500 device code */
|
||||||
int avr910_devcode; /* avr910 device code */
|
|
||||||
int chip_erase_delay; /* microseconds */
|
int chip_erase_delay; /* microseconds */
|
||||||
unsigned char pagel; /* for parallel programming */
|
unsigned char pagel; /* for parallel programming */
|
||||||
unsigned char bs2; /* for parallel programming */
|
unsigned char bs2; /* for parallel programming */
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "ppi.h"
|
#include "ppi.h"
|
||||||
#include "pgm.h"
|
#include "pgm.h"
|
||||||
#include "stk500.h"
|
#include "stk500.h"
|
||||||
#include "avr910.h"
|
|
||||||
#include "avr.h"
|
#include "avr.h"
|
||||||
|
|
||||||
extern char * progname;
|
extern char * progname;
|
||||||
@@ -73,8 +72,6 @@ static int parse_cmdbits(OPCODE * op);
|
|||||||
%token K_DEFAULT_SERIAL
|
%token K_DEFAULT_SERIAL
|
||||||
%token K_DESC
|
%token K_DESC
|
||||||
%token K_DEVICECODE
|
%token K_DEVICECODE
|
||||||
%token K_STK500_DEVCODE
|
|
||||||
%token K_AVR910_DEVCODE
|
|
||||||
%token K_EEPROM
|
%token K_EEPROM
|
||||||
%token K_ERRLED
|
%token K_ERRLED
|
||||||
%token K_FLASH
|
%token K_FLASH
|
||||||
@@ -104,7 +101,6 @@ static int parse_cmdbits(OPCODE * op);
|
|||||||
%token K_SCK
|
%token K_SCK
|
||||||
%token K_SIZE
|
%token K_SIZE
|
||||||
%token K_STK500
|
%token K_STK500
|
||||||
%token K_AVR910
|
|
||||||
%token K_TYPE
|
%token K_TYPE
|
||||||
%token K_VCC
|
%token K_VCC
|
||||||
%token K_VFYLED
|
%token K_VFYLED
|
||||||
@@ -288,12 +284,6 @@ prog_parm :
|
|||||||
}
|
}
|
||||||
} |
|
} |
|
||||||
|
|
||||||
K_TYPE TKN_EQUAL K_AVR910 {
|
|
||||||
{
|
|
||||||
avr910_initpgm(current_prog);
|
|
||||||
}
|
|
||||||
} |
|
|
||||||
|
|
||||||
K_DESC TKN_EQUAL TKN_STRING {
|
K_DESC TKN_EQUAL TKN_STRING {
|
||||||
strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
|
strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
|
||||||
current_prog->desc[PGM_DESCLEN-1] = 0;
|
current_prog->desc[PGM_DESCLEN-1] = 0;
|
||||||
@@ -413,24 +403,7 @@ part_parm :
|
|||||||
|
|
||||||
K_DEVICECODE TKN_EQUAL TKN_NUMBER {
|
K_DEVICECODE TKN_EQUAL TKN_NUMBER {
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
current_part->devicecode = $3->value.number;
|
||||||
"%s: error at %s:%d: devicecode is deprecated, use "
|
|
||||||
"stk500_devcode instead\n",
|
|
||||||
progname, infile, lineno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
} |
|
|
||||||
|
|
||||||
K_STK500_DEVCODE TKN_EQUAL TKN_NUMBER {
|
|
||||||
{
|
|
||||||
current_part->stk500_devcode = $3->value.number;
|
|
||||||
free_token($3);
|
|
||||||
}
|
|
||||||
} |
|
|
||||||
|
|
||||||
K_AVR910_DEVCODE TKN_EQUAL TKN_NUMBER {
|
|
||||||
{
|
|
||||||
current_part->avr910_devcode = $3->value.number;
|
|
||||||
free_token($3);
|
free_token($3);
|
||||||
}
|
}
|
||||||
} |
|
} |
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
AC_INIT(avrdude, 4.1.0, avrdude-dev@nongnu.org)
|
AC_INIT(avrdude, 4.0.0, avrdude-dev@nongnu.org)
|
||||||
|
|
||||||
AC_CANONICAL_BUILD
|
AC_CANONICAL_BUILD
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ static char *filename;
|
|||||||
|
|
||||||
void win_sys_config_set(char sys_config[PATH_MAX])
|
void win_sys_config_set(char sys_config[PATH_MAX])
|
||||||
{
|
{
|
||||||
sys_config[0] = 0;
|
|
||||||
|
|
||||||
/* Use Windows API call to search for the Windows default system config file.*/
|
/* Use Windows API call to search for the Windows default system config file.*/
|
||||||
SearchPath(NULL, "avrdude.conf", NULL, PATH_MAX, sys_config, &filename);
|
SearchPath(NULL, "avrdude.conf", NULL, PATH_MAX, sys_config, &filename);
|
||||||
return;
|
return;
|
||||||
@@ -40,8 +38,6 @@ void win_sys_config_set(char sys_config[PATH_MAX])
|
|||||||
|
|
||||||
void win_usr_config_set(char usr_config[PATH_MAX])
|
void win_usr_config_set(char usr_config[PATH_MAX])
|
||||||
{
|
{
|
||||||
usr_config[0] = 0;
|
|
||||||
|
|
||||||
/* Use Windows API call to search for the Windows default user config file. */
|
/* Use Windows API call to search for the Windows default user config file. */
|
||||||
SearchPath(NULL, "avrdude.rc", NULL, PATH_MAX, usr_config, &filename);
|
SearchPath(NULL, "avrdude.rc", NULL, PATH_MAX, usr_config, &filename);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -127,24 +127,17 @@ from the contents of a file, while interactive mode is useful for
|
|||||||
exploring memory contents, modifing individual bytes of eeprom,
|
exploring memory contents, modifing individual bytes of eeprom,
|
||||||
programming fuse/lock bits, etc.
|
programming fuse/lock bits, etc.
|
||||||
|
|
||||||
AVRDUDE supports three basic programmer types: Atmel's STK500, appnote
|
AVRDUDE supports two basic programmer types: Atmel's STK500 and the PPI
|
||||||
avr910 and the PPI (parallel port interface). PPI represents a class
|
(parallel port interface). PPI represents a class of simple programmers
|
||||||
of simple programmers where the programming lines are directly
|
where the programming lines are directly connected to the PC parallel
|
||||||
connected to the PC parallel port. Several pin configurations exist
|
port, while the STK500 uses the serial port to communicate with the PC
|
||||||
for several variations of the PPI programmers, and AVRDUDE can be be
|
|
||||||
configured to work with them by either specifying the appropriate
|
|
||||||
programmer on the command line or by creating a new entry in its
|
|
||||||
configuration file. All that's usually required for a new entry is to
|
|
||||||
tell AVRDUDE which pins to use for each programming function.
|
|
||||||
|
|
||||||
The STK500 and avr910 use the serial port to communicate with the PC
|
|
||||||
and contains on-board logic to control the programming of the target
|
and contains on-board logic to control the programming of the target
|
||||||
device. The fundamental difference between the two types lies in the
|
device. Several pin configurations exist for several variations of the
|
||||||
protocol used to control the programmer. The av910 protocol is very
|
PPI programmers, and AVRDUDE can be be configured to work with them by
|
||||||
simplistic and can easily be used as the basis for a simple, home made
|
either specifying the appropriate programmer on the command line or by
|
||||||
programer since the firmware is available online. On the other hand,
|
creating a new entry in its configuration file. All that's usually
|
||||||
the STK500 protocol is more robust and complicated and the firmware is
|
required for a new entry is to tell AVRDUDE which pins to use for each
|
||||||
not openly available.
|
programming function.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* History::
|
* History::
|
||||||
|
|||||||
@@ -125,8 +125,6 @@ default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; }
|
|||||||
default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; }
|
default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; }
|
||||||
default_serial { yylval=NULL; return K_DEFAULT_SERIAL; }
|
default_serial { yylval=NULL; return K_DEFAULT_SERIAL; }
|
||||||
devicecode { yylval=NULL; return K_DEVICECODE; }
|
devicecode { yylval=NULL; return K_DEVICECODE; }
|
||||||
stk500_devcode { yylval=NULL; return K_STK500_DEVCODE; }
|
|
||||||
avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; }
|
|
||||||
eeprom { yylval=NULL; return K_EEPROM; }
|
eeprom { yylval=NULL; return K_EEPROM; }
|
||||||
errled { yylval=NULL; return K_ERRLED; }
|
errled { yylval=NULL; return K_ERRLED; }
|
||||||
flash { yylval=NULL; return K_FLASH; }
|
flash { yylval=NULL; return K_FLASH; }
|
||||||
@@ -154,7 +152,6 @@ retry_pulse { yylval=NULL; return K_RETRY_PULSE; }
|
|||||||
serial { yylval=NULL; return K_SERIAL; }
|
serial { yylval=NULL; return K_SERIAL; }
|
||||||
size { yylval=NULL; return K_SIZE; }
|
size { yylval=NULL; return K_SIZE; }
|
||||||
stk500 { yylval=NULL; return K_STK500; }
|
stk500 { yylval=NULL; return K_STK500; }
|
||||||
avr910 { yylval=NULL; return K_AVR910; }
|
|
||||||
type { yylval=NULL; return K_TYPE; }
|
type { yylval=NULL; return K_TYPE; }
|
||||||
vcc { yylval=NULL; return K_VCC; }
|
vcc { yylval=NULL; return K_VCC; }
|
||||||
vfyled { yylval=NULL; return K_VFYLED; }
|
vfyled { yylval=NULL; return K_VFYLED; }
|
||||||
|
|||||||
@@ -610,8 +610,7 @@ int main(int argc, char * argv [])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strcmp(pgm->type, "STK500") == 0)
|
if (strcmp(pgm->type, "STK500") == 0) {
|
||||||
|| (strcmp(pgm->type, "avr910") == 0)){
|
|
||||||
if (port == default_parallel) {
|
if (port == default_parallel) {
|
||||||
port = default_serial;
|
port = default_serial;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,10 +89,6 @@ PROGRAMMER * pgm_new(void)
|
|||||||
*/
|
*/
|
||||||
pgm->paged_write = NULL;
|
pgm->paged_write = NULL;
|
||||||
pgm->paged_load = NULL;
|
pgm->paged_load = NULL;
|
||||||
pgm->write_setup = NULL;
|
|
||||||
pgm->write_byte = NULL;
|
|
||||||
pgm->read_byte = NULL;
|
|
||||||
pgm->read_sig_bytes = NULL;
|
|
||||||
|
|
||||||
return pgm;
|
return pgm;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,12 +66,6 @@ typedef struct programmer_t {
|
|||||||
int page_size, int n_bytes);
|
int page_size, int n_bytes);
|
||||||
int (*paged_load) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
int (*paged_load) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||||
int page_size, int n_bytes);
|
int page_size, int n_bytes);
|
||||||
void (*write_setup) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
|
||||||
int (*write_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned long addr, unsigned char value);
|
|
||||||
int (*read_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
|
||||||
unsigned long addr, unsigned char * value);
|
|
||||||
int (*read_sig_bytes) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
|
||||||
char config_file[PATH_MAX]; /* config file where defined */
|
char config_file[PATH_MAX]; /* config file where defined */
|
||||||
int lineno; /* config file line number */
|
int lineno; /* config file line number */
|
||||||
} PROGRAMMER;
|
} PROGRAMMER;
|
||||||
|
|||||||
@@ -1,350 +0,0 @@
|
|||||||
/*
|
|
||||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
|
||||||
* Copyright (C) 2003 Theodore A. Roth <troth@openavr.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Posix serial interface for avrdude.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
extern char *progname;
|
|
||||||
extern int verbose;
|
|
||||||
|
|
||||||
struct baud_mapping {
|
|
||||||
long baud;
|
|
||||||
speed_t speed;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* There are a lot more baud rates we could handle, but what's the point? */
|
|
||||||
|
|
||||||
static struct baud_mapping baud_lookup_table [] = {
|
|
||||||
{ 1200, B1200 },
|
|
||||||
{ 2400, B2400 },
|
|
||||||
{ 4800, B4800 },
|
|
||||||
{ 9600, B9600 },
|
|
||||||
{ 19200, B19200 },
|
|
||||||
{ 38400, B38400 },
|
|
||||||
{ 57600, B57600 },
|
|
||||||
{ 115200, B115200 },
|
|
||||||
{ 230400, B230400 },
|
|
||||||
{ 0, 0 } /* Terminator. */
|
|
||||||
};
|
|
||||||
|
|
||||||
static speed_t serial_baud_lookup(long baud)
|
|
||||||
{
|
|
||||||
struct baud_mapping *map = baud_lookup_table;
|
|
||||||
|
|
||||||
while (map->baud) {
|
|
||||||
if (map->baud == baud)
|
|
||||||
return map->speed;
|
|
||||||
map++;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "%s: serial_baud_lookup(): unknown baud rate: %ld",
|
|
||||||
progname, baud);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int serial_setattr(int fd, long baud)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
struct termios termios;
|
|
||||||
speed_t speed = serial_baud_lookup (baud);
|
|
||||||
|
|
||||||
if (!isatty(fd))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* initialize terminal modes
|
|
||||||
*/
|
|
||||||
rc = tcgetattr(fd, &termios);
|
|
||||||
if (rc < 0) {
|
|
||||||
fprintf(stderr, "%s: serial_setattr(): tcgetattr() failed, %s",
|
|
||||||
progname, strerror(errno));
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
termios.c_iflag = 0;
|
|
||||||
termios.c_oflag = 0;
|
|
||||||
termios.c_cflag = 0;
|
|
||||||
termios.c_cflag |= (CS8 | CREAD | CLOCAL);
|
|
||||||
termios.c_lflag = 0;
|
|
||||||
termios.c_cc[VMIN] = 1;
|
|
||||||
termios.c_cc[VTIME] = 0;
|
|
||||||
|
|
||||||
cfsetospeed(&termios, speed);
|
|
||||||
cfsetispeed(&termios, speed);
|
|
||||||
|
|
||||||
rc = tcsetattr(fd, TCSANOW, &termios);
|
|
||||||
if (rc < 0) {
|
|
||||||
fprintf(stderr, "%s: serial_setattr(): tcsetattr() failed, %s",
|
|
||||||
progname, strerror(errno));
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int serial_open(char * port, int baud)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* open the serial port
|
|
||||||
*/
|
|
||||||
fd = open(port, O_RDWR | O_NOCTTY /*| O_NONBLOCK*/);
|
|
||||||
if (fd < 0) {
|
|
||||||
fprintf(stderr, "%s: serial_open(): can't open device \"%s\": %s\n",
|
|
||||||
progname, port, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* set serial line attributes
|
|
||||||
*/
|
|
||||||
rc = serial_setattr(fd, baud);
|
|
||||||
if (rc) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: serial_open(): can't set attributes for device \"%s\"\n",
|
|
||||||
progname, port);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void serial_close(int fd)
|
|
||||||
{
|
|
||||||
/* FIXME: Should really restore the terminal to original state here. */
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int serial_send(int fd, char * buf, size_t buflen)
|
|
||||||
{
|
|
||||||
struct timeval timeout;
|
|
||||||
fd_set wfds;
|
|
||||||
int nfds;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
char * p = buf;
|
|
||||||
size_t len = buflen;
|
|
||||||
|
|
||||||
if (!len)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (verbose > 3)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s: Send: ", progname);
|
|
||||||
|
|
||||||
while (buflen) {
|
|
||||||
unsigned char c = *buf;
|
|
||||||
if (isprint(c)) {
|
|
||||||
fprintf(stderr, "%c ", c);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, ". ");
|
|
||||||
}
|
|
||||||
fprintf(stderr, "[%02x] ", c);
|
|
||||||
|
|
||||||
buf++;
|
|
||||||
buflen--;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
timeout.tv_sec = 0;
|
|
||||||
timeout.tv_usec = 500000;
|
|
||||||
|
|
||||||
while (len) {
|
|
||||||
FD_ZERO(&wfds);
|
|
||||||
FD_SET(fd, &wfds);
|
|
||||||
|
|
||||||
reselect:
|
|
||||||
nfds = select(fd+1, NULL, &wfds, NULL, &timeout);
|
|
||||||
if (nfds == 0) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: serial_send(): programmer is not responding\n",
|
|
||||||
progname);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else if (nfds == -1) {
|
|
||||||
if (errno == EINTR) {
|
|
||||||
goto reselect;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "%s: serial_send(): select(): %s\n",
|
|
||||||
progname, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = write(fd, p, 1);
|
|
||||||
if (rc < 0) {
|
|
||||||
fprintf(stderr, "%s: serial_send(): write error: %s\n",
|
|
||||||
progname, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int serial_recv(int fd, char * buf, size_t buflen)
|
|
||||||
{
|
|
||||||
struct timeval timeout;
|
|
||||||
fd_set rfds;
|
|
||||||
int nfds;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
char * p = buf;
|
|
||||||
size_t len = 0;
|
|
||||||
|
|
||||||
timeout.tv_sec = 5;
|
|
||||||
timeout.tv_usec = 0;
|
|
||||||
|
|
||||||
while (len < buflen) {
|
|
||||||
FD_ZERO(&rfds);
|
|
||||||
FD_SET(fd, &rfds);
|
|
||||||
|
|
||||||
reselect:
|
|
||||||
nfds = select(fd+1, &rfds, NULL, NULL, &timeout);
|
|
||||||
if (nfds == 0) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: serial_recv(): programmer is not responding\n",
|
|
||||||
progname);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else if (nfds == -1) {
|
|
||||||
if (errno == EINTR) {
|
|
||||||
goto reselect;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "%s: serial_recv(): select(): %s\n",
|
|
||||||
progname, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = read(fd, p, 1);
|
|
||||||
if (rc < 0) {
|
|
||||||
fprintf(stderr, "%s: serial_recv(): read error: %s\n",
|
|
||||||
progname, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
len++;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = buf;
|
|
||||||
|
|
||||||
if (verbose > 3)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s: Recv: ", progname);
|
|
||||||
|
|
||||||
while (len) {
|
|
||||||
unsigned char c = *p;
|
|
||||||
if (isprint(c)) {
|
|
||||||
fprintf(stderr, "%c ", c);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, ". ");
|
|
||||||
}
|
|
||||||
fprintf(stderr, "[%02x] ", c);
|
|
||||||
|
|
||||||
p++;
|
|
||||||
len--;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int serial_drain(int fd, int display)
|
|
||||||
{
|
|
||||||
struct timeval timeout;
|
|
||||||
fd_set rfds;
|
|
||||||
int nfds;
|
|
||||||
int rc;
|
|
||||||
unsigned char buf;
|
|
||||||
|
|
||||||
timeout.tv_sec = 0;
|
|
||||||
timeout.tv_usec = 250000;
|
|
||||||
|
|
||||||
if (display) {
|
|
||||||
fprintf(stderr, "drain>");
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
FD_ZERO(&rfds);
|
|
||||||
FD_SET(fd, &rfds);
|
|
||||||
|
|
||||||
reselect:
|
|
||||||
nfds = select(fd+1, &rfds, NULL, NULL, &timeout);
|
|
||||||
if (nfds == 0) {
|
|
||||||
if (display) {
|
|
||||||
fprintf(stderr, "<drain\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (nfds == -1) {
|
|
||||||
if (errno == EINTR) {
|
|
||||||
goto reselect;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "%s: serial_drain(): select(): %s\n",
|
|
||||||
progname, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = read(fd, &buf, 1);
|
|
||||||
if (rc < 0) {
|
|
||||||
fprintf(stderr, "%s: serial_drain(): read error: %s\n",
|
|
||||||
progname, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (display) {
|
|
||||||
fprintf(stderr, "%02x ", buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
|
||||||
* Copyright (C) 2003 Theodore A. Roth <troth@openavr.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Native Win32 serial interface for avrdude.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "serial.h"
|
|
||||||
|
|
||||||
extern char *progname;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
int serial_open(char * port, long baud)
|
|
||||||
{
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void serial_close(int fd)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int serial_send(int fd, char * buf, size_t buflen)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int serial_recv(int fd, char * buf, size_t buflen)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int serial_drain(int fd, int display)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
|
||||||
* Copyright (C) 2003 Theodore A. Roth <troth@openavr.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* This is the API for the generic serial interface. The implementations are
|
|
||||||
actually provided by the target dependant files:
|
|
||||||
|
|
||||||
ser_posix.c : posix serial interface.
|
|
||||||
ser_win32.c : native win32 serial interface.
|
|
||||||
|
|
||||||
The target file will be selected at configure time. */
|
|
||||||
|
|
||||||
#ifndef __serial_h__
|
|
||||||
#define __serial_h__
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
extern int serial_open(char * port, long baud);
|
|
||||||
extern void serial_close(int fd);
|
|
||||||
|
|
||||||
extern int serial_send(int fd, char * buf, size_t buflen);
|
|
||||||
extern int serial_recv(int fd, char * buf, size_t buflen);
|
|
||||||
extern int serial_drain(int fd, int display);
|
|
||||||
|
|
||||||
#endif /* __serial_h__ */
|
|
||||||
240
avrdude/stk500.c
240
avrdude/stk500.c
@@ -33,15 +33,17 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "avr.h"
|
#include "avr.h"
|
||||||
#include "pgm.h"
|
#include "pgm.h"
|
||||||
#include "stk500_private.h"
|
#include "stk500_private.h"
|
||||||
#include "serial.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern int verbose;
|
|
||||||
extern char * progname;
|
extern char * progname;
|
||||||
extern int do_cycles;
|
extern int do_cycles;
|
||||||
|
|
||||||
@@ -49,21 +51,153 @@ extern int do_cycles;
|
|||||||
static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value);
|
static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value);
|
||||||
|
|
||||||
|
|
||||||
static int stk500_send(PROGRAMMER * pgm, char * buf, size_t len)
|
static int stk500_send(PROGRAMMER * pgm, char * buf, int buflen)
|
||||||
{
|
{
|
||||||
return serial_send(pgm->fd, buf, len);
|
struct timeval timeout;
|
||||||
|
fd_set wfds;
|
||||||
|
int nfds;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!buflen)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
timeout.tv_sec = 0;
|
||||||
|
timeout.tv_usec = 500000;
|
||||||
|
|
||||||
|
while (buflen) {
|
||||||
|
FD_ZERO(&wfds);
|
||||||
|
FD_SET(pgm->fd, &wfds);
|
||||||
|
|
||||||
|
reselect:
|
||||||
|
nfds = select(pgm->fd+1, NULL, &wfds, NULL, &timeout);
|
||||||
|
if (nfds == 0) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: stk500_send(): programmer is not responding on %s\n",
|
||||||
|
progname, pgm->port);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else if (nfds == -1) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
goto reselect;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "%s: stk500_send(): select(): %s\n",
|
||||||
|
progname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = write(pgm->fd, buf, 1);
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "%s: stk500_send(): write error: %s\n",
|
||||||
|
progname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
buf++;
|
||||||
|
buflen--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int stk500_recv(PROGRAMMER * pgm, char * buf, size_t len)
|
|
||||||
|
static int stk500_recv(PROGRAMMER * pgm, char * buf, int n)
|
||||||
{
|
{
|
||||||
return serial_recv(pgm->fd, buf, len);
|
struct timeval timeout;
|
||||||
|
fd_set rfds;
|
||||||
|
int nfds;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
timeout.tv_sec = 5;
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
|
while (n) {
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
FD_SET(pgm->fd, &rfds);
|
||||||
|
|
||||||
|
reselect:
|
||||||
|
nfds = select(pgm->fd+1, &rfds, NULL, NULL, &timeout);
|
||||||
|
if (nfds == 0) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: stk500_recv(): programmer is not responding on %s\n",
|
||||||
|
progname, pgm->port);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else if (nfds == -1) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
goto reselect;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "%s: stk500_recv(): select(): %s\n",
|
||||||
|
progname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = read(pgm->fd, buf, 1);
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "%s: stk500_recv(): read error: %s\n",
|
||||||
|
progname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
buf++;
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int stk500_drain(PROGRAMMER * pgm, int display)
|
static int stk500_drain(PROGRAMMER * pgm, int display)
|
||||||
{
|
{
|
||||||
return serial_drain(pgm->fd, display);
|
struct timeval timeout;
|
||||||
|
fd_set rfds;
|
||||||
|
int nfds;
|
||||||
|
int rc;
|
||||||
|
unsigned char buf;
|
||||||
|
|
||||||
|
timeout.tv_sec = 0;
|
||||||
|
timeout.tv_usec = 250000;
|
||||||
|
|
||||||
|
if (display) {
|
||||||
|
fprintf(stderr, "drain>");
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
FD_SET(pgm->fd, &rfds);
|
||||||
|
|
||||||
|
reselect:
|
||||||
|
nfds = select(pgm->fd+1, &rfds, NULL, NULL, &timeout);
|
||||||
|
if (nfds == 0) {
|
||||||
|
if (display) {
|
||||||
|
fprintf(stderr, "<drain\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (nfds == -1) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
goto reselect;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "%s: stk500_drain(): select(): %s\n",
|
||||||
|
progname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = read(pgm->fd, &buf, 1);
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "%s: stk500_drain(): read error: %s\n",
|
||||||
|
progname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (display) {
|
||||||
|
fprintf(stderr, "%02x ", buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -384,7 +518,7 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|||||||
*/
|
*/
|
||||||
buf[0] = Cmnd_STK_SET_DEVICE;
|
buf[0] = Cmnd_STK_SET_DEVICE;
|
||||||
|
|
||||||
buf[1] = p->stk500_devcode;
|
buf[1] = p->devicecode;
|
||||||
buf[2] = 0; /* device revision */
|
buf[2] = 0; /* device revision */
|
||||||
|
|
||||||
if ((p->flags & AVRPART_SERIALOK) && (p->flags & AVRPART_PARALLELOK))
|
if ((p->flags & AVRPART_SERIALOK) && (p->flags & AVRPART_PARALLELOK))
|
||||||
@@ -605,10 +739,72 @@ static void stk500_enable(PROGRAMMER * pgm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int stk500_setattr(int fd)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
struct termios termios;
|
||||||
|
|
||||||
|
if (!isatty(fd))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* initialize terminal modes
|
||||||
|
*/
|
||||||
|
rc = tcgetattr(fd, &termios);
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "%s: stk500_setattr(): tcgetattr() failed, %s",
|
||||||
|
progname, strerror(errno));
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
termios.c_iflag = 0;
|
||||||
|
termios.c_oflag = 0;
|
||||||
|
termios.c_cflag = 0;
|
||||||
|
termios.c_cflag |= (CS8 | CREAD | CLOCAL);
|
||||||
|
termios.c_lflag = 0;
|
||||||
|
termios.c_cc[VMIN] = 1;
|
||||||
|
termios.c_cc[VTIME] = 0;
|
||||||
|
|
||||||
|
cfsetospeed(&termios, B115200);
|
||||||
|
cfsetispeed(&termios, B115200);
|
||||||
|
|
||||||
|
rc = tcsetattr(fd, TCSANOW, &termios);
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "%s: stk500_setattr(): tcsetattr() failed, %s",
|
||||||
|
progname, strerror(errno));
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void stk500_open(PROGRAMMER * pgm, char * port)
|
static void stk500_open(PROGRAMMER * pgm, char * port)
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
strcpy(pgm->port, port);
|
strcpy(pgm->port, port);
|
||||||
pgm->fd = serial_open(port, 115200);
|
|
||||||
|
/*
|
||||||
|
* open the serial port
|
||||||
|
*/
|
||||||
|
pgm->fd = open(port, O_RDWR | O_NOCTTY /*| O_NONBLOCK*/);
|
||||||
|
if (pgm->fd < 0) {
|
||||||
|
fprintf(stderr, "%s: stk500_open(): can't open device \"%s\": %s\n",
|
||||||
|
progname, port, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set serial line attributes
|
||||||
|
*/
|
||||||
|
rc = stk500_setattr(pgm->fd);
|
||||||
|
if (rc) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: stk500_open(): can't set attributes for device \"%s\"\n",
|
||||||
|
progname, port);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* drain any extraneous input
|
* drain any extraneous input
|
||||||
@@ -623,7 +819,7 @@ static void stk500_open(PROGRAMMER * pgm, char * port)
|
|||||||
|
|
||||||
static void stk500_close(PROGRAMMER * pgm)
|
static void stk500_close(PROGRAMMER * pgm)
|
||||||
{
|
{
|
||||||
serial_close(pgm->fd);
|
close(pgm->fd);
|
||||||
pgm->fd = -1;
|
pgm->fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,9 +924,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (addr = 0; addr < n; addr += page_size) {
|
for (addr = 0; addr < n; addr += page_size) {
|
||||||
if (verbose) {
|
fprintf(stderr, "\r \r%6u", addr);
|
||||||
fprintf(stderr, "\r \r%6u", addr);
|
|
||||||
}
|
|
||||||
tries = 0;
|
tries = 0;
|
||||||
retry:
|
retry:
|
||||||
tries++;
|
tries++;
|
||||||
@@ -774,10 +968,8 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (verbose) {
|
fprintf(stderr, "\r \r%6u", addr-1);
|
||||||
fprintf(stderr, "\r \r%6u", addr-1);
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@@ -822,9 +1014,7 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (addr = 0; addr < n; addr += page_size) {
|
for (addr = 0; addr < n; addr += page_size) {
|
||||||
if (verbose) {
|
fprintf(stderr, "\r \r%6u", addr);
|
||||||
fprintf(stderr, "\r \r%6u", addr);
|
|
||||||
}
|
|
||||||
tries = 0;
|
tries = 0;
|
||||||
retry:
|
retry:
|
||||||
tries++;
|
tries++;
|
||||||
@@ -865,10 +1055,8 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (verbose) {
|
fprintf(stderr, "\r \r%6u", addr-1);
|
||||||
fprintf(stderr, "\r \r%6u", addr-1);
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user