avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] 6.0.1 - STK500v2 page write broken for pages greater than


From: natan keddem
Subject: [avrdude-dev] 6.0.1 - STK500v2 page write broken for pages greater than 256b?
Date: Fri, 27 Sep 2013 17:02:50 -0400

I was looking into making an ATK500v2 compatible bootloader for a
xmega128a1u and ran into a few issues.  I am assuming the the blocksize
parameter in the .conf is meant to be used as a max transmission size on
the serial line for data.  It appears like the code always utilizes a
calculated block size.  See code snippet in stk500v2.c:
    if ((maxaddr - addr) < page_size)
      block_size = maxaddr - addr;
    else
      block_size = page_size;

It doesn't seem to take the block size from the .conf file.  It also
appears to make the block size the same size as the page size.  This is a
problem because the STK500v2 standard doesn't allow transmission greater
than 275b.  This appears to be even lower in avrdude, with a buffer size of
only 256b for the body portion.  Therefore the protocol will need to send
pages in multiple transactions and alert the programmer at the other end
when to make page writes.

I added command codes to the xmega in the .conf and other functionality
seems to work other than reading\writing flash so far.  The program seems
to crash and act weirdly when trying to flash the unit.  This is
understandable considering there isn't any sanity checks on the size of
page size or block size in terms of maxes. The mem copy for the data uses
the block size directly causing an overflow for large values:

    memcpy(buf+10,m->buf+addr, block_size);

Am I totally off base here?  I am a bit new to all this code obviously and
may have misread something....


reply via email to

[Prev in Thread] Current Thread [Next in Thread]