This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
I'm using the LCF file with TI's compiler in Code Composer to generate a CRC value for comparing against the value generated by the safety library's "SL_CRC_Calculate" function. The two values are not matching due to the upper and lower words being swapped. Document "spna235" says that this is an intended feature of the TMS570_CRC64_ISO algorithm. Is there an algorithm I can use witch does not have this feature, or another way to correct the problem (besides swapping the byte order in code before comparing the values?)
Thank You
Code for question...
LCF Section directive
.text : {} palign=8, crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > FLASH0 | FLASH1
Runtime Check
retVal = ( _my_crc_table.recs[i].crc_value == SL_CRC_Calculate((uint64*)_my_crc_table.recs[i].addr,_my_crc_table.recs[i].size / 8u) );
Hello,
I don't think you need to swap the word for RM57 which is little endian device. For RM57, the lower 32-bit word is stored in lower portion of the address:
uint64 value = 0x0123456789abcdef; the assume the address for this 64-bit word is 0x08001500
0x89abcdef is store in 0x08001500
0x01234567 is stored at 0x08001504
The value returned from the SL_CALC_CRC() function is returned in the reverse order from the table generated by the linker. In the below images you can see (a) the RO and R1 registers storing the return value, (b) the memory storage location for the linker table and (c) a printf output of both values using %llx. After searching the forum a bit more, I found a few posts from years ago seeming to reference this, but no solution listed that uses the standard link file directive.
https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/339833?TMS570-CRC64-ISO
http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/104764/785765.aspx#785765
(A)
(B)
(C)
Thanks Matt.
I knew that swapping word is required for TMS570, but this is not applied to RM57 device.
Anyway, I will a test later.
I think this note... http://downloads.ti.com/docs/esd/SPNU118/a-note-on-the-tms570-crc64-iso-algorithm-stdz0756196.html says that the device registers are little endian, but it expects my compiler to be set for big endian. Based on the initial code samples I was using, I have the compiler set for little endian. Is this not the typical scenario for the RM57?
Thank-you,
Matt
Hello Matt,
I calculated the CRC using LCF, HW CRC module in full-CPU mode, and SDL function. I noticed that the LCF swaps the words before calculating the CRC.
The CRC values using HW CRC in full-CPU mode and SDL are same.
To compare the CRC values from LCF and SDL, you need to swap the upper word and lower word of CRC value from the LCF.
TMS570LC43x:
1. CRC using LCF:
CRC value = 0x1EB13F2C CA3C37CE, please swap the upper word and the lower word
2. CRC using SDL
CRC value = 0xCA3C37CE 1EB13F2C
RM57Lx
1. CRC using LCF: 0xCA3C38F2 is the lower word, and 0x1EBA8F97 is the upper work
CRC vlaue = 0x1EBA8F97 CA3C38F2 please swap the upper word and the lower word
2. CRC using SDL
CRC vlaue = 0xCA3C38F2 1EBA8F97