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.

CRC Calculation of Application Memory, Cortex-M3



After going through the manuals for the TMS470 Code Generation Tools (marked as 4.7, though using tools 4.6.6 with Cortex-M3), I am unable to find any information on using the Linker to calculate the CRC of the code/data going into FLASH memory.  Is there another tool/script that TI offers to calculate and insert this value?  If not, is there a 3rd party tool that is typically used?  Is support for this planned in the future?

  • This support is added in v4.9.0 of the TMS470 codegen tools. If you have CCSv4, you can download this version via Update manager (Help->Software Updates->Find and Install).

  • Ok, I have read through the documentation and finally understand the tables generated by the linker.

    Now, I just need to get my crc algorithm working.  I noticed that the header file gives 4 algorithms, one of which being CRC16_ALT.  I selected this option in the linker command file and it seems to generate a valid CRC table and record (though I have no way to verify the actual CRC).

    I chose this algorithm because I'm guessing it matches the CRC16 algorithm contained in the LM3S9B96 ROM.  The LM3S9B96 ROM User's Guide says the algorithm is CRC-16-IBM (x^16 + x^15 + x^2 + 1).  Wikipedia lists the CRC-16-IBM as 0x8005, which is the polynomial indicated by the comment in the crc_tbl.h file. 

    Can anyone verify that the two algorithms are a match?  If they are not a match, is there an algorithm that matches the one stored in the LM3S9B96 ROM function?  If not, will that be available in a future release?

    Also, why does TI not supply the function body for the default linker algorithm in the documentation (or in the library)?  Is it a licensing issue?

  • You can find the updated ARM CRC documentation here:

    http://www.ti.com/lit/ug/spnu118j/spnu118j.pdf

    You will notice that the CRC16_ALT algorithm is not documented for ARM. I assume you found that algorithm in the C2000 documentation. The ARM CRC implementation was intended to be used on the TMS570 device using the builtin hardware.  The reason for not documenting the other algorithms was to avoid confusion on which one to choose for a device (for instance if hardware is not available then it is not exposed). While the CRC16_ALT algorithm is not documented, there is no technical reason why it cannot be used for ARM.

    I do not know if the CRC16_ALT algorithm supported by the linker is the same as the CRC-16-IBM algorithm. All the parameters we use are documented. I suggest you try an example and see if you get the same results between the two. You can also post this question on the Stellaris forums to get more information on the algorithm they use. We do not have plans to add support for additional CRC algorithms, but if there is one you need please post the request on the forum so we can track it.

    We do not provide a function in the RTS for calculating CRC's at runtime  because the one used in the linker relies on some internal infrastructure. It is also assumed that users will use optimized routines that take advantage of the hardware they are using.

  • I finally have been able to get the CRC algorithm to work.

    I used CRC_16ALT as the algorithm in the linker.  Then I used a source code generator script which generates the .h and .c file for this algorithm.  The name of the script is pycrc.py (mentioned in a forum post elsewhere) and seems to be based off the same article as the linker algorithm.  I configured the script based on the values listed in the linker CRC algorithm (--reflect-in=false --reflect-out=false, --model=crc-16).  The script can be found at http://www.tty1.net/pycrc/ .  I suspect that the CRC32_PRIME and CRC16_802_15_4 algorithms (mentioned in the 4.9.0 compiler readme doc) could be made to work as well.  I probably will actually switch to one of these.

    I was not able to get the TMS570_CRC64_ISO to work with pycrc - I assume that the TI algorithm is somewhat specialized for the MCRC module mentioned in the linker manual.

    As a feature request, I do think it would make much sense for TI to provide a CRC algorithm in the linker that matches the CRC algorithm in the Stellaris ROM, please!