merge patches from arduino. add a note on how to load code into an

arduino. tested with a diecimilia.
ok ajacoutot
This commit is contained in:
ckuethe 2008-08-23 07:20:17 +00:00
parent 5481d79049
commit 07ef7149bc
4 changed files with 81 additions and 2 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.2 2008/08/21 14:20:12 ckuethe Exp $
# $OpenBSD: Makefile,v 1.3 2008/08/23 07:20:17 ckuethe Exp $
COMMENT= AVR microcontroller hardware in-system programmer
V= 5.5
DISTNAME= avrdude-${V}
DISTFILES+= avrdude-doc-${V}.pdf
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= devel
HOMEPAGE= http://www.nongnu.org/avrdude/

View File

@ -0,0 +1,60 @@
$OpenBSD: patch-stk500_c,v 1.1 2008/08/23 07:20:17 ckuethe Exp $
--- stk500.c.orig Sun Mar 25 22:14:35 2007
+++ stk500.c Fri Aug 22 20:52:56 2008
@@ -1220,7 +1220,49 @@ static void stk500_print_parms(PROGRAMMER * pgm)
stk500_print_parms1(pgm, "");
}
+/* Signature byte reads are always 3 bytes. */
+static int stk500_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
+{
+ unsigned char buf[32];
+ unsigned char tmp;
+ if (m->size < 3) {
+ fprintf(stderr, "%s: memsize too small for sig byte read", progname);
+ return -1;
+ }
+
+ buf[0] = Cmnd_STK_READ_SIGN;
+ buf[1] = Sync_CRC_EOP;
+
+ stk500_send(pgm, buf, 2);
+
+ if (stk500_recv(pgm, buf, 5) < 0)
+ return -1;
+ if (buf[0] == Resp_STK_NOSYNC) {
+ fprintf(stderr, "%s: stk500_cmd(): programmer is out of sync\n", progname);
+ return -1;
+ } else if (buf[0] != Resp_STK_INSYNC) {
+ fprintf(stderr,
+ "\n%s: stk500_read_sig_bytes(): (a) protocol error, "
+ "expect=0x%02x, resp=0x%02x\n",
+ progname, Resp_STK_INSYNC, buf[0]);
+ return -2;
+ }
+ if (buf[4] != Resp_STK_OK) {
+ fprintf(stderr,
+ "\n%s: stk500_read_sig_bytes(): (a) protocol error, "
+ "expect=0x%02x, resp=0x%02x\n",
+ progname, Resp_STK_OK, buf[4]);
+ return -3;
+ }
+
+ m->buf[0] = buf[1];
+ m->buf[1] = buf[2];
+ m->buf[2] = buf[3];
+
+ return 3;
+}
+
void stk500_initpgm(PROGRAMMER * pgm)
{
strcpy(pgm->type, "STK500");
@@ -1250,5 +1292,6 @@ void stk500_initpgm(PROGRAMMER * pgm)
pgm->set_varef = stk500_set_varef;
pgm->set_fosc = stk500_set_fosc;
pgm->set_sck_period = stk500_set_sck_period;
+ pgm->read_sig_bytes = stk500_read_sig_bytes;
pgm->page_size = 256;
}

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-stk500v2_c,v 1.1 2008/08/23 07:20:17 ckuethe Exp $
--- stk500v2.c.orig Tue Jan 30 05:41:53 2007
+++ stk500v2.c Fri Aug 22 20:52:56 2008
@@ -483,6 +483,10 @@ static int stk500v2_getsync(PROGRAMMER * pgm) {
if (pgmtype == PGMTYPE_JTAGICE_MKII)
return 0;
+ // my avrispmkii doesn't respond to the sync --dam@mellis.org
+ if (pgmtype == PGMTYPE_AVRISP_MKII)
+ return 0;
+
retry:
tries++;

View File

@ -4,3 +4,8 @@ serial programming protocol, it can program fuse and lock bits. AVRDUDE
also supplies a direct instruction mode allowing one to issue any
programming instruction to the AVR chip regardless of whether AVRDUDE
implements that specific feature of a particular chip.
If you're planning on programming *duino devices with avrdude, you'll want
to invoke it something like this:
avrdude -b19200 -P /dev/cuaU0 -c avrisp -p m169 -U flash:w:blink.hex