View previous topic :: View next topic |
Author |
Message |
ferlyn
Joined: 13 Oct 2010 Posts: 5
|
CRC16 for program integrity |
Posted: Wed Oct 13, 2010 9:29 pm |
|
|
Hi,
I'm trying to perform a CRC16 on the program memory (14bit-core Flash). However, all the sample code/documents I found was CRC16 on 8bit data.
Anyone with sample code/documents/ideas for performing crc16 on 14bit data (Program memory/Flash)??
I tried to modify the int16 generate_16bit_crc(char* data, int16 length, int16 pattern) function found in the PIC drivers folder. However the result does not tally with the crc16 generated by #rom getenv("Program_memory")-1 = crc16. Anyone with sucessfully history??
Thanks in advance.... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 13, 2010 9:43 pm |
|
|
Look at this file:
Quote: |
c:\program files\picc\examples\ex_checksum.c
|
If that doesn't help, then post your compiler version. |
|
|
ferlyn
Joined: 13 Oct 2010 Posts: 5
|
|
Posted: Wed Oct 13, 2010 11:45 pm |
|
|
Hi,
Thanks for the advise...
ex_checksum.c is using
#rom getenv("Program_memory")-1 = CHECKSUM
I already tested the checksum method, it is working.
however, i would like to use
#rom getenv("Program_memory")-1 = crc16 |
|
|
ferlyn
Joined: 13 Oct 2010 Posts: 5
|
|
Posted: Fri Oct 15, 2010 12:29 am |
|
|
Hi,
Anyone with sucessful history on using
"#rom getenv("Program_memory")-1 = crc16"
for checking program memory??? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Oct 15, 2010 12:21 pm |
|
|
You could have stated your problem better. I thought this was just some
invention of yours. In fact, it's in the manual. Your real question is,
"Does anyone know the algorithm that the CCS compiler uses to generate
the crc16 as described in the #ROM section of the manual ?".
Once I figured out what you wanted, I had a hunch. I used Google to
search the CCS website, exclusive of the forum, using this string:
Quote: | site:ccsinfo.com -forum crc16 |
Then I got this:
http://www.ccsinfo.com/pdfs/CRC_Source_Code.pdf
This looks like it might be what you want. I don't guarantee it, but it
looks like a good bet. |
|
|
|