[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avrdude-dev] [bug #47780] Single byte read/dump results in zero byte fi
From: |
anonymous |
Subject: |
[avrdude-dev] [bug #47780] Single byte read/dump results in zero byte file written |
Date: |
Mon, 25 Apr 2016 05:07:29 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 |
URL:
<http://savannah.nongnu.org/bugs/?47780>
Summary: Single byte read/dump results in zero byte file
written
Project: AVR Downloader/UploaDEr
Submitted by: None
Submitted on: Mon 25 Apr 2016 05:07:28 AM UTC
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Originator Name: Paul Daniels
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
When attempting to dump the single OSCCAL/calibration byte from a Tiny10, a
zero byte file is written.
Apologies if this is a PEBCAK situation.
example:
# avrdude -p attiny10 -c usbtiny -U calibration:r:cal:h
# ls -la cal
-rw-rw-r-- 0 pld pld 9 Apr 25 14:55 cal
problem source:
In file avr.c, function int avr_mem_hiaddr(AVRMEM * mem), the for() loop
terminates prematurely due to memsize being 1, meaning the initial comparison
is 0>0 which of course is false.
for (i=mem->size-1; i>0; i--)
***proposed fix #1, handle the corner case directly, add the test before the
for() loop.
if ((mem->size == 1) && (mem->buf[0] != 0xff)) return 1;
The problem with this is that it technically violates the word-size return
results expected from avr_mem_hiaddr().
# cat cal
0x70
***proposed fix #2, change the for() loop comparison to;
for (i=mem->size-1; i>=0; i--)
The problem with this is that it'll return a size of '2', and write 2 bytes
to the file, for what is actually a single byte result.
# cat cal
0x70,0x3b
Regards,
Paul.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?47780>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [avrdude-dev] [bug #47780] Single byte read/dump results in zero byte file written,
anonymous <=