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 TMS570LS0332

Other Parts Discussed in Thread: TMS570LS0332, HALCOGEN

Hi,

I am using the TMS570LS0332 in my design. I would like to calculate the CRC of my code similar to CRC calculation of TMS570LS0332 and append the calculated CRC at the end of the file. 

How to implement this? Is there any option in code composer studio?

Thanks & Best Regards,

Sreekanth Challa

  • You can do this with the linker. See section 8.9 of the ARM Assembly Language Tools User's Guide.

  • Hi Bob Crosby,

    Thanks for your feed back. I could change the linker file and calculate the CRC of the section of my code.

    I am calculating the CRC on same section of code in the micro controller using CRC block.  But they do not match for some reason.

    The linker file change for CRC calculation::

    .text    : START( ulFlashStartAddr ) {} palign=8 > FLASH0 crc_table(_my_crc_table_for_a1c1, algorithm=TMS570_CRC64_ISO)

                  END( ulFlashEndAddr )

    The uc Code for CRC calculation::

    uint64 SL_CRC_Calculate (uint64 * startAddr, uint32 count64)

    {

    uint32 count = 0u;

    CRC_CTRL0 |= 0x00000001U; /* Reset the CRC Module */

    CRC_CTRL0 &= 0xFFFFFFFEU;

    CRC_CTRL2 |= 0x00000003U; /* Configure to Full CPU Mode */

    for (count=0u; count < count64; count++) {

    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> Comment_2*/

    CRC_SIGREG = *startAddr;

    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> Comment_2*/

    startAddr++;

    }

       return(CRC_SIGREG);

    }

    Thanks & Best regards,

    sreekanth challa

  • Maybe this application note will help SPNA235

  • Hi Bob,

    Thanks for your feedback. I could solve the problem.

    The SafeTI library demo code provided for TMS570LS04x microcontrollers has bug in file sys_startup.c file.

    crcAtInit_FLASH = SL_CRC_Calculate((uint64 *)((uint32)&ulFlashStartAddr), ((((uint32)&ulFlashEndAddr)-((uint32)&ulFlashStartAddr)) >> 6));

    It should be right shifted by only 3, not 6. (Flash size in bytes/8). 

    Thanks & Best Regards,

    Sreekanth reddy challa

  • Thank you for pointing out that error. I will pass this on to the safety library software team so they can correct this.
  • Hi Bob,

    The same is the case for VIM RAM as well.

    crcAtInit_VIMRAM = SL_CRC_Calculate(((uint64 *)0xFFF82000), 256);

    The actual VIMRAM size is 96 words starting from 0xFFF82000. So 256 should be replaced with 48. (i.e., 96/2).

    How can i calculate the CRC of the VIMRAM address at compile time? because the address is 0xFFF82000.

    Thanks & Best Regards,

    Sreekanth Challa

  • Good question. If using HALCoGen, try this:

    I added one line to the file sys_vim.c

    /* USER CODE BEGIN (0) */
    #pragma DATA_SECTION(s_vim_init,"VIM_TABLE")
    /* USER CODE END */
    

    and added these two lines to the link command file sys_link.cmd

    /* USER CODE BEGIN (4) */
    	VIM_TABLE : ALIGN(8) {} > FLASH0 crc_table(vim_table_crc)
    	.TI.crctab: {} > FLASH0
    /* USER CODE END */
    

  • The bug you reported is filed as SDOCM00122769. Unfortunately we just missed catching the release of version 2.03.01. We will have to fix this in the following release.