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.

MSP432E401Y: MSP432E401Y Linker generated CRC

Part Number: MSP432E401Y

Hello

I am working on a Nuclear Safety related embedded application using the TI MSP432.

I am trying to make use of the capability to create, using the linker a CRC for a zone of data in FLASH and to then be able to, during startup of the application, verify the target application calculated CRC for this same zone of data matches the CRC generated by the linker.

 

I have tried several different settings in the linker, one as shown below,

    .const  :   > 0x00080200, crc_table(crc_table_for_const,algorithm= CRC32_PRIME)

    .TI.crctab  : > FLASH

 

In the Application loaded to target I am using the TI Runtime API for the CRC as shown below.

Ps…I have tried many settings….

    //params.byteSwapInput = CRC_BYTESWAP_BYTES_AND_HALF_WORDS;   // nope

    //params.byteSwapInput = CRC_BYTESWAP_UNCHANGED;              // nope

    //params.byteSwapInput = CRC_BYTESWAP_HALF_WORDS;             // nope

    params.byteSwapInput = CRC_BYTESWAP_BYTES_IN_HALF_WORDS;      // nope

    params.returnBehavior = CRC_RETURN_BEHAVIOR_BLOCKING;

    params.polynomial = CRC_POLYNOMIAL_CRC_32_IEEE;

    params.dataSize = CRC_DATA_SIZE_32BIT;

    params.seed = 0xFFFFFFFF;

 

    status = CRC_calculateFull(handle, src, srcSize, &result);

 

No matter what settings I use I am not able to come up with the same CRC as calculated by the linker.

 

For ease of testing the data zone has been set to only 12 bytes of data.

It would be appreciated if I could get pointed in the right direction here, perhaps I need details on the calculation used by the linker?

Thank You In Advance.

  • Hi,

      Reading this post, https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/863682/ccs-msp430fr6043-matching-the-hardware-crc32-method-and-linker-crc32_prime, CRC32_PRIME uses the below polynomial. 

    MSP432E supports both CRC-32 (0x4C11DB7) and CRC-32C (0x1EDC6F41) as listed in Wikipedia 

    Can you use other online CRC calculation tool to see if you can get the same signature as the linker. I just wanted to make sure the linker is generating the same signature as other tools.

    There is an example to use CRC32 in C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\dk-tm4c129x\crc32. 

  • Hello, thanks you for your reply.

    I simplified the data being used, using only 2-32 bit words now.

    0x0000,0000

    0x1111,1111

    The online crccalc.com gives me CRC-32 of 0xA90A2536 for these values.

    The Linker using CRC32_PRIME gives me a value of 0x0000,0000 0xBDB3,4FEB

    The TI API for the MPS432E4 using CRC_POLYNOMIAL_CRC_32_IEEE gives me a crc of 0xD4B7F4B2?

    Its a little all over the map?

    Any advice?

    I have no access to C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\dk-tm4c129x\crc32

    Thanks in Advance.

    Perry

  • I simplified the data being used, using only 2-32 bit words now.

    0x0000,0000

    0x1111,1111

    The online crccalc.com gives me CRC-32 of 0xA90A2536 for these values.

    Hi,

      That is not what I get in both https://crccalc.com/ and http://www.sunshine2k.de/coding/javascript/crc/crc_js.html

    In https://crccalc.com/. You need to use the result with RefIn=false, Refout=false and XorOut=0x0. See below. This is matching MSP432P hardware.

    In http://www.sunshine2k.de/coding/javascript/crc/crc_js.html. See below. This is matching the hardware too. 

    The Linker using CRC32_PRIME gives me a value of 0x0000,0000 0xBDB3,4FEB

    The result should be 32bits. Where is the 0x00000000 coming from?

    The TI API for the MPS432E4 using CRC_POLYNOMIAL_CRC_32_IEEE gives me a crc of 0xD4B7F4B2?

    I also get the same result which is correct. See below g_ui32Result=0xD4B7F4B2 in the expression window and the simple source code. 

  • Hi Charles

    Thanks for the response and information, yes for the small sample 0x0000,0000 and 0x1111,1111 with the I get the value 0xD4B7F4B2 for both the online crc and the TI on taret API when called during runtime, my issue is now getting the linker to produce during link time the same CRC and embedding this into the build file.

    Following the TI Arm Assembly Language Tools User's Guide (spnu118z.pdf)section 8.9 Linker-Generated CRC Tables, and using the options CRC32_PRIME and CRC32_C , and as referenced the table this build function produces is defined in crc_tbl.h, it creates a 64 bit CRC, yet when I use these two options only the first 32 bits are 0, the last 32 are 

    CRC32:PRIME = 0xBDB34FEB

    CRC32_C = 0x959D569E

    linker settings as shown above and repeated below

    .const  :   > 0x00080200, crc_table(crc_table_for_const,algorithm= CRC32_PRIME)

        .TI.crctab  : > FLASH

    /*********************************************************/

    typedef struct crc_record {

    uint64_t crc_value;

    uint32_t crc_alg_ID; /* CRC algorithm ID */

    uint32_t addr; /* Starting address */

    uint32_t size; /* size of data in bytes */

    uint32_t padding; /* explicit padding so layout is the same */ /* for ELF */ }

    CRC_RECORD;

    So my issue is getting the linker to produce the same?

    Thanks

    Perry

  • Hi Perry,

      I will need to pass your question about the linker generated CRC to our compiler team. What is confirmed is that the hardware is producing the expected signature compared to the online CRC tools. 

  • I presume you use the TI proprietary Arm compiler.  The short name for it is armcl.

    perhaps I need details on the calculation used by the linker?

    Please search the TI ARM assembly tools manual for the sub-chapter titled Linker-Generated CRC Tables.  Also look at the compiler RTS header files related to CRC.  They are in a directory location similar to:

    C:\ti\ccs1200\ccs\tools\compiler\ti-cgt-arm_20.2.7.LTS\include

    Inspect the files crc_tbl.h and crc_defines.h.  The file crc_defines.h has these lines ...

    /*****************************************************************************/
    /* CRC Algorithm Specifiers                                                  */
    /*                                                                           */
    /* The following specifications, based on the above cited document, are used */
    /* by the linker to generate CRC values.                                     */
    /*                                                                           */
    /*                                                                           */
    /* ID  Name          Order  Polynomial   Initial     Ref Ref  CRC XOR   Zero */
    /*                                       Value       In  Out  Value     Pad  */
    /*-------------------------------------------------------------------------- */
    /* 0, "CRC32_PRIME",    32, 0x04c11db7,  0x00000000,  0,  0, 0x00000000,  1  */
    /* 1, "CRC16_802_15_4", 16, 0x00001021,  0x00000000,  0,  0, 0x00000000,  1  */
    /* 2, "CRC16_ALT",      16, 0x00008005,  0x00000000,  0,  0, 0x00000000,  1  */
    /* 3, "CRC8_PRIME",      8, 0x00000007,  0x00000000,  0,  0, 0x00000000,  1  */
    /* 11,"CRC32",          32, 0x1edc6f41,  0x00000000,  0,  0, 0x00000000,  1  */
    /* 12,"CRC24_FLEXRAY",  24, 0x005d6dcb,  0x00000000,  0,  0, 0x00000000,  1  */
    

    Thanks and regards,

    -George