picberry icon indicating copy to clipboard operation
picberry copied to clipboard

INHX32 is not fully supported

Open marcoNexion opened this issue 7 years ago • 4 comments

Hi,

when read_inhx() function runs it fails in checksum comparison.

e.g.:

line 2530 (35 bytes): ':0B9D20004A943366CC831D3A74E8CBF4\r\n' byte_count = 0x0B address = 0x9D20 record_type = 0x00 (data) data = 0x944A @0x00004E90 data = 0x6633 @0x00004E91 data = 0x83CC @0x00004E92 data = 0x3A1D @0x00004E93 data = 0xE874 @0x00004E94 checksum = 0xCB Error: checksum does not match. Calculated = 0xBF, Read = 0xCB

In file, checksum is supposed to be 0xF4. In read_inhx(), checsum is computed as 0xCB.

When byte_count is odd, the for loop ignore the last char :

for(i = 0; i < byte_count/2; i++) {
nread = sscanf(&line[9+4*i], "%4hx", &data);
if (nread != 1) {
	cerr << "Error: cannot read data." << endl;
	return 0;
}
tmp = data;
data = (data >> 8) | (tmp << 8);
if (flags.debug) fprintf(stderr, "  data        = 0x%04X", data);
checksum_calculated += (data >> 8) & 0xFF;
checksum_calculated += data & 0xFF;

extended_address = ( ((uint32_t)base_address << 16) | address);
if (flags.debug)
	fprintf(stderr, " @0x%08X\n", extended_address/2+i);

mem->location[extended_address/2 + i - offset/2] = data;
mem->filled[extended_address/2 + i - offset/2] = 1;
filled_locations++;
}

A part of my hex file is :

:109D1000D4B37DFAEFC5913972E4D3BD61C29F25FA :0B9D20004A943366CC831D3A74E8CBF4 :049D2C002BD9E150FE :109D3000F90F23D9000ED880EE54000EED5425E221

May be I can link the code to fill 16bit location. But it does'nt seem possible with MPLAB C18.

Regards,

Marco

marcoNexion avatar Mar 09 '17 16:03 marcoNexion

Hi, I pushed a (possible) correction on branch wip_oddbytecount - commit #0b87aae, but I have no time to test it now. Can you test and report?

Thanks

WallaceIT avatar Mar 10 '17 21:03 WallaceIT

Yes i have done a correction too. I have to push it next time. I am faced with a new problem. Writing is OK but configuration words are not good.

Thanks for your efforts.

Marc

Le 10 mars 2017 22:30, "Francesco Valla" [email protected] a écrit :

Hi, I pushed a (possible) correction on branch wip_oddbytecount - commit #0b87aae, but I have no time to test it now. Can you test and report?

Thanks

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/WallaceIT/picberry/issues/5#issuecomment-285789982, or mute the thread https://github.com/notifications/unsubscribe-auth/AZFqzsUh6cPVQzrlP3qGEzQ1aqt-UPJgks5rkcD6gaJpZM4MYVsO .

marcoNexion avatar Mar 12 '17 19:03 marcoNexion

Good to hear that writing is OK! Are you considering register masking? Can you elaborate a bit on not good and/or post an example of incorrect writing of conf register?

Regards, F

WallaceIT avatar Mar 13 '17 20:03 WallaceIT

Hi Francesco,

I am out of my stuff until next friday. I will do what you propose the next time. I keep you informed.

Regards,

Marc

2017-03-13 21:25 GMT+01:00 Francesco Valla [email protected]:

Good to hear that writing is OK! Are you considering register masking? Can you elaborate a bit on not good and/or post an example of incorrect writing of conf register?

Regards, F

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/WallaceIT/picberry/issues/5#issuecomment-286232390, or mute the thread https://github.com/notifications/unsubscribe-auth/AZFqzr6lY53Yfvh-DRy59rBKquvqnRFqks5rlaY6gaJpZM4MYVsO .

marcoNexion avatar Mar 14 '17 08:03 marcoNexion