Tool/software:
Hi. In my code, I want to perform CRC calculation on FRAM section and then compare the calculated CRC value against a comparison CRC value, and perform further actions if the two values are same or not. I think, the problem I am having is, the comparison CRC value is stored in initialization values in FRAM segment. Therefore comparison value is included in the CRC calculation. I calculate CRC value and put it in. I calculate the CRC value again, it has changed. I put it in again. I calculate again, it changes again...
As a solution, I tried to create a separate memory segment sized 2 bytes to store the CRC comparison value but I have the same problem, because the initialization value for it, is still stored in FRAM. My question is, how can I seperate only that initialization value? But if you also have other suggestions, I am open for discussion.
Thanks.
I can't tell if you are computing the initial CRC value to store at compile time or at run time. I doubt if it is at compile time although it could be a post compilation step.
If at run time, this would seem to be exactly the sort of thing for information memory. No linker help needed.
Moving it to INFO section worked.
I am computing the CRC value in runtime and reading the computed value from CRCINIRES register. Then I modify the comparison value and rebuild it again. And the CRC value changes repeatedly as expected.
How else could I obtain the CRC value? Would there be a way to calculate it outside of CCS, from hex output file maybe?
I'm supposing you want to compute a CRC at build (compile) time then check it at run-time.
Take a look at the crc_table feature of the linker [Ref Linker UG (SLAU131U) Sec 8.9]. This asks the linker to generate (multiple) CRCs, one for each (requested) output section. It's a bit more complex than a single overall CRC, but it avoids headaches with alignment gaps and scatter-loading.
**Attention** This is a public forum