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.

CCS/TMS320F2812: CRC Generation for Binary Code

Part Number: TMS320F2812


Tool/software: Code Composer Studio

Hello,

I am trying to generate CRC for the binary code. The goal is to calculate the "golden" CRC during compile and link process and save it to the end of the code or end of flash. During run time, the Flash will be CRC checked against the "golden" CRC value.

I saw two related posts here.

e2e.ti.com/.../117036

and

https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/108461#

However, it is not clear to me how the "golden" CRC value is calculated during link process. I can not find the readme file (LINKER_GENERATED_CRC_README.txt) mentioned in the above thread in the folder C:\ti\ccsv7\tools\compiler\ti-cgt-c2000_6.4.12. Can anybody shine some light on this? Thanks.

I am using TM320F2812, CCS V7.1.0.00016, Compiler TI v6.4.12, DSP/BIOS version 5.42.2.10.

  • Documentation of the CRC feature of the linker is available in the section titled Linker-Generated CRC Tables in the C28x assembly language tools manual.

    Thanks and regards,

    -George

  • Thanks for pointing out that manual. I looked through the document but did not find the answer I am looking for. The file is focusing on CRC check certain portion of the code/data. What I need to do is check the entire FLASH, i.e, address 0x3D8000 to 0x3F7FF7. The last couple of bytes are for storing the CRC. Can I reference the absolute addresses in the linker generated CRC feature? Thanks.
  • The granularity of control of the CRC feature in the linker is an output section, and not a memory range.  It does not support computing the CRC in the manner you describe.

    Thanks and regards,

    -George

  • Thanks for the quick response, George.

    If this means that we can not use the linker generated CRC, is there another way to do this? With ELF format, we used ielftool to calculate and insert the CRC value after ELF object file is generated. Do we have similar tool for the .COFF file we have for TMS320F2812? Thanks.

  • Gavin Bai said:
    If this means that we can not use the linker generated CRC, is there another way to do this?

    That's not what I meant.  You can certainly solve your problem with the CRC feature in the TI linker.  But it works differently from ielftool.

    I have never used ielftool.  But I read a bit about it on the IAR web site.  ielftool works on a memory range.  It is a separate utility that runs after the linker.  The TI solution works on one section at a time.  It is built-in to the linker.

    Gavin Bai said:
    Do we have similar tool for the .COFF file we have for TMS320F2812?

    No.

    At this point, I think your best choice is to adjust to how the CRC solution works in the TI linker.  Because the alternative is to create your own solution. 

    Thanks and regards,

    -George

  • Hi, George.

    You mentioned "the control of the CRC feature in the linker is an output section, and not a memory range. It does not support computing the CRC in the manner you describe." And "You can certainly solve your problem with the CRC feature in the TI linker. But it works differently from ielftool."

    What kind of approach should I take specify the Flash range I am interested? I need your help on this part. Thanks.
  • At this point, I think you could use a complete example.  CRC examples are not my expertise.  I suggest you install C2000Ware and start with the example in the directory similar to ...

    C:\ti\C2000Ware_1_00_02_00_Software\libraries\dsp\VCU\c28\examples\crc\2837x_vcu0_crc_wtables

    This is not for your exact device.  It uses the VCU, which a TMS320F2812 does not have.  But I understand it also computes the CRC using C code, in a manner similar to you what you would do.  So you can probably benefit from learning how that part of the example works.

    If you have questions regarding this example, then I suggest you start a new thread in the C2000 device forum.  Or, if you prefer, I can move this thread into that forum.

    Thanks and regards,

    -George