Correct checksum calculation; failure to account for the value of the
record type was causing non-zero record types to be calculated incorrectly. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@43 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
979d0d0254
commit
3d43a61bcc
4
fileio.c
4
fileio.c
|
@ -125,7 +125,7 @@ int b2ihex ( unsigned char * inbuf, int bufsize,
|
||||||
n = 0;
|
n = 0;
|
||||||
nextaddr = 0;
|
nextaddr = 0;
|
||||||
fprintf ( outf, ":%02X%04X01", n, nextaddr );
|
fprintf ( outf, ":%02X%04X01", n, nextaddr );
|
||||||
cksum += n + ((nextaddr >> 8) & 0x0ff) + (nextaddr & 0x0ff);
|
cksum += n + ((nextaddr >> 8) & 0x0ff) + (nextaddr & 0x0ff) + 1;
|
||||||
cksum = -cksum;
|
cksum = -cksum;
|
||||||
fprintf ( outf, "%02X\n", cksum );
|
fprintf ( outf, "%02X\n", cksum );
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ int ihex2b ( char * infile, FILE * inf,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start computing a checksum */
|
/* start computing a checksum */
|
||||||
cksum = n + ((nextaddr >> 8 ) & 0x0ff) + (nextaddr & 0x0ff);
|
cksum = n + ((nextaddr >> 8 ) & 0x0ff) + (nextaddr & 0x0ff) + rectype;
|
||||||
|
|
||||||
for (i=0; i<n; i++) {
|
for (i=0; i<n; i++) {
|
||||||
if (sscanf((char *)&buffer[i*2+9], "%02x", &b) != 1) {
|
if (sscanf((char *)&buffer[i*2+9], "%02x", &b) != 1) {
|
||||||
|
|
Loading…
Reference in New Issue