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.

MSPM0G3507: Hardware based crc calculation in combination with linker generated crc checksum in hex File

Part Number: MSPM0G3507


Tool/software:

Dear Supportteam,

I'm actually trying to activate the crc checksum algorithm over my text file section of linker file.

What is clear for me, is how to activate and to configure the linker command file.

for example:

    .text   : palign(8) {} > FLASH | FLASH2, crc_table(crc_table_for_text,algorithm= CRC32_PRIME)
What I'm unsure is how to implement it correctly on MSPM0G3507 by using the hardware crc component.
As far as I understand, I have first to initialize the crc component:
void BSL_CRC_Init(void)
{
    /* Reset and enable power to CRC */
    DL_CRC_reset(BSL_CRC);
    DL_CRC_enablePower(BSL_CRC);
    while (DL_CRC_isPowerEnabled(BSL_CRC) != true) {
    }

    /* Initialize the CRC module */
    DL_CRC_init(BSL_CRC, DL_CRC_32_POLYNOMIAL, DL_CRC_BIT_REVERSED,
        DL_CRC_INPUT_ENDIANESS_LITTLE_ENDIAN, DL_CRC_OUTPUT_BYTESWAP_DISABLED);
}
But then the questions begin.
1) Is CRC32_PRIME the same as DL_CRC_32_POLYNOMIAL
2) How to call the calculation correct, is this the correct method which is indirect given in BSL example?
uint32_t BSL_CI_calculateCRC(uint8_t *data, uint32_t dataSize)
{
    uint32_t bufferIndex = (uint32_t) 0;

    /* Set the Seed value to reset the calculation */
    DL_CRC_setSeed32(BSL_CRC, BSL_CRC_SEED);

    /* Feed the data to CRC module */
    for (bufferIndex = (uint32_t) 0; bufferIndex < dataSize; bufferIndex++) {
        DL_CRC_feedData8(BSL_CRC, data[bufferIndex]);
    }

    /* Return the 32 bit result */
    return (DL_CRC_getResult32(BSL_CRC));
}
Or does TI provide any example for this job?
How to get addresses and lengths, I found in another post:
How to fill gaps and unused Flash with known values? - Code Composer Studio forum - Code Composer StudioTm︎ - TI E2E support forums
This solved this question, but not how to implement the correct hardware crc usage.
  • Hello Siegfried,

    Hex file itself includes CRC value information. If you want to implement calculating the CRC value of data which you want to update to M0 through BSL by CRC hardware part, for comparing and checking whether the updated data is correct, maybe you refer to this example code: crc_calculate_checksum. 

    You can find it from latest version of M0 SDK: examples-> nortos -> LP_MSPM0G3507 -> driverlib. Hope this can help you.

    Best Regards,

    Janz Bai

  • Hello Janz,
    problem was with different configuration variants. Following combination works correct.

    in command file: .text   : palign(8) {} > FLASH | FLASH2, crc_table(crc_table_for_text,algorithm= CRC32_PRIME)

    CRC init in C-Code:

        DL_CRC_init(CRC, DL_CRC_32_POLYNOMIAL, DL_CRC_BIT_NOT_REVERSED,
            DL_CRC_INPUT_ENDIANESS_LITTLE_ENDIAN, DL_CRC_OUTPUT_BYTESWAP_DISABLED);

        DL_CRC_setSeed32(CRC, CRC_SEED);
    CRC_SEED  0x0
    leads to corresponding CRC chekcsums.
    Problem solved. 
    But still having the opinion, a correct overall example would be useful.
  • Hello Siegfried,

    Much thanks for your opinion, I will discuss with my colleague about this.

    Best Regards,

    Janz Bai