CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Anybody understand #ID CHECKSUM?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stevev
Guest







Anybody understand #ID CHECKSUM?
PostPosted: Sun Feb 23, 2003 3:38 pm     Reply with quote

Does anyone know how to calculate a value at run time for a 16F877 which computes a ROM checksum which matches the value set by #ID CHECKSUM?

There are some old posts to c-code at Microchip but those links are broken. Here is what I'm trying to do, but the 'id' and 'calculated checksums don't match.

Thanks -steve-

verifyRom()
{
int16 romChecksum, flashChecksum;
int16 flash;

// -- get checksum from ID bits (set by compiler/linker at build time)
romChecksum = getenv("ID");

flashChecksum = 0;

// -- compute checksum of FLASH program ROM to verify program good
for (flash=0; flash flashChecksum += read_program_eeprom(flash);

flashChecksum &= 0x7ff;

// -- show error message and halt if checksum's don't match!!
if (flashChecksum != romChecksum)
{
printf("BAD CHECKSUM");
}
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 12040
Tomi
Guest







Re: Anybody understand #ID CHECKSUM?
PostPosted: Mon Feb 24, 2003 9:32 am     Reply with quote

<font face="Courier New" size=-1>I think your problem is that you can not read ID locations at runtime (they are out of the normal memory address space).

:=Does anyone know how to calculate a value at run time for a 16F877 which computes a ROM checksum which matches the value set by #ID CHECKSUM?
:=
:=There are some old posts to c-code at Microchip but those links are broken. Here is what I'm trying to do, but the 'id' and 'calculated checksums don't match.
:=
:=Thanks -steve-
:=
:=verifyRom()
:={
:= int16 romChecksum, flashChecksum;
:= int16 flash;
:=
:= // -- get checksum from ID bits (set by compiler/linker at build time)
:= romChecksum = getenv("ID");
:=
:= flashChecksum = 0;
:=
:= // -- compute checksum of FLASH program ROM to verify program good
:= for (flash=0; flash<getenv("PROGRAM_MEMORY"); ++flash)
:= flashChecksum += read_program_eeprom(flash);
:=
:= flashChecksum &= 0x7ff;
:=
:= // -- show error message and halt if checksum's don't match!!
:= if (flashChecksum != romChecksum)
:= {
:= printf("BAD CHECKSUM");
:= }
:=} ___________________________
This message was ported from CCS's old forum
Original Post ID: 12056
stevev
Guest







Re: Anybody understand #ID CHECKSUM?
PostPosted: Tue Feb 25, 2003 1:39 pm     Reply with quote

I know that the config word for my fuses is 0x3F7E (at the bottom of the asm listing), so I tried subtracting (and adding too!) that from my checksums. I also have masked to 14-bits the sum, taken 1s complement and masked again to 14-bits ( as suggested by the MicroChip tech note) but this STILL doesn't give any values that match #ID CHECKSUM.

Does anybody verify their flash ROM contents match what was compiled? Doing this is a requirement for our product certification.

I'd appreciate any ideas or alternative methods that people are using to verify their ROMs.

Thanks again, -steve-
:=<font face="Courier New" size=-1>I think your problem is that you can not read ID locations at runtime (they are out of the normal memory address space).
:=
:=:=Does anyone know how to calculate a value at run time for a 16F877 which computes a ROM checksum which matches the value set by #ID CHECKSUM?
:=:=
:=:=There are some old posts to c-code at Microchip but those links are broken. Here is what I'm trying to do, but the 'id' and 'calculated checksums don't match.
:=:=
:=:=Thanks -steve-
___________________________
This message was ported from CCS's old forum
Original Post ID: 12091
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Anybody understand #ID CHECKSUM?
PostPosted: Tue Feb 25, 2003 1:53 pm     Reply with quote

:=I know that the config word for my fuses is 0x3F7E (at the bottom of the asm listing), so I tried subtracting (and adding too!) that from my checksums. I also have masked to 14-bits the sum, taken 1s complement and masked again to 14-bits ( as suggested by the MicroChip tech note) but this STILL doesn't give any values that match #ID CHECKSUM.
:=
:=Does anybody verify their flash ROM contents match what was compiled? Doing this is a requirement for our product certification.
:=
:=I'd appreciate any ideas or alternative methods that people are using to verify their ROMs.
--------------------------------------------------------------

Here is a MicroChip appnote on checksums. It requires running
an external DOS program to modify the HEX file. The program
is also available on the following page.
<a href="http://www.microchip.com/1000/suppdoc/appnote/all/tb026/index.htm" TARGET="_blank">http://www.microchip.com/1000/suppdoc/appnote/all/tb026/index.htm</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12093
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group