|
|
View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
[Solved] CRC calculation over ROM/Flash range? |
Posted: Sat Dec 07, 2019 4:47 am |
|
|
Is there a way to get the CRC routines to work over a ROM/Flash range? _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Last edited by allenhuffman on Sat Dec 07, 2019 2:43 pm; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sat Dec 07, 2019 6:06 am |
|
|
Not too sure what you mean, but data is data. Every bit of every byte of memory is accessible in any PIC...you can do what you want with it.
Maybe explain better or make me anoth rpot of coffee..still dark and cold here..
Jay |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
|
Posted: Sat Dec 07, 2019 12:09 pm |
|
|
I thought the hardware architecture might prevent me from accessing it directly? I tried using the CCS CRC routines and giving it a flash address with no success. But it was around 5am after an all night coding session, so maybe I’ll have better luck when I revisit today.
After I program flash, I’d like to run a CRC check of what I programmed and validate it. I can read flash into RAM and check that, which works, but when I try to do the same check to the address it just read, I don’t get the same results.
Maybe I am not understanding the width parameter, and it has to be different when using the flash? _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ? |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
|
Posted: Sat Dec 07, 2019 1:08 pm |
|
|
Maybe this is what I need:
#ROM address = crc16(start, end) - This will put a value at address that is a crc16 of all the program memory from start to end.
But, I am hoping to find a way to make a routine that will return the CRC of a specified range of Flash, so if we use our boot loader code to put a data table in program memory, dynamically, we can then verify the table after we write it . _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
|
Posted: Sat Dec 07, 2019 1:25 pm |
|
|
Yes, I have a C implementation from here. I was wanting to use the hardware CRC unit in the PIC. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Sat Dec 07, 2019 2:34 pm |
|
|
The supplied CRC code is for a buffer in RAM.
However you can 'train' the CRC together.
What you do, is read a block from your ROM. Put this into RAM, and call the
CRC function to get a result. Then read the next block, and put the result from
the first block as the seed for this. Repeat for all the blocks. Result is the
total CRC. |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
|
Posted: Sat Dec 07, 2019 2:43 pm |
|
|
Thanks. That's how I was having to do it, but I was hoping the HW CRC had a way to just point it at a Flash address and it could do it directly. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ? |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 552 Location: Des Moines, Iowa, USA
|
|
Posted: Sat Dec 07, 2019 6:09 pm |
|
|
How does one make the crc routine continue so you can do it over several blocks of memory? I tried passing in the previous crc into the crc_init() like I do in my C version, but that did not produce expected results. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ? |
|
|
|
|
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
|