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.

Compiler/MSP430F5438A: Appending CRC to the output file.

Part Number: MSP430F5438A

Tool/software: TI C/C++ Compiler

Hello Team,

I have a requirement to calculate the CRC for the Application after the compilation and insert the CRC in the final output file at fixed or calculated location and use that CRC to compare with CRC computed on the run time.

I was wondering if there is a way of appending CRC to the final output file. I dont want to use the linker generated CRC tables.

I'm using CCS V9.2 and Compiler 18.12.3.

  • Hey Ashish,

    I don't believe this is possible for the entire application like this...  After reading some other E2E posts on the topic, it seems that CCS can only automatically calculate CRC for different sections while linking and store them as a CRC table.  Here is a thread explaining this: https://e2e.ti.com/support/tools/ccs/f/81/t/825402 

    There is also more information in this document in section 8.9 Linker generated CRC tables.  

    I'm also going to move this thread to the code composer forum for confirmation of this.  

    Thanks,

    JD

  • I confirm that the reply by Mr. Crutchfield is correct.

    Thanks and regards,

    -George

  • Thanks JD/George for the answer.

    I tried using linker generated CRC table, but have few doubts. 

    I have following section and memory defined in linker

    MEMORY

    {

    SFR : origin = 0x0000, length = 0x0010

    PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0

    PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100

    RAM : origin = 0x1C00, length = 0x4000

    INFOA : origin = 0x1980, length = 0x0080

    INFOB : origin = 0x1900, length = 0x0080

    INFOC : origin = 0x1880, length = 0x0080

    INFOD : origin = 0x1800, length = 0x0080

    CRCSEC : origin = 0x5C00, length = 0x0040

    FLASH : origin = 0x5C40, length = 0xA340

    FLASH2 : origin = 0x10000,length = 0x2B000

    ......

    }

    SECTIONS

    {

    ....

    .text : {} >> FLASH | FLASH2, crc_table(__ops_crc) /* Code */

    text:_isr : {} > FLASH, crc_table(__ops_crc) /* ISR Code space */

    .const : {} >> FLASH | FLASH2, crc_table(__ops_crc) /* Constant data */

    ....

    }

    This way i was able to generate the CRC for the sections but it generated 3 records for the CRC with 3 different value. So my questions are

    1. How to generate a single CRC for all the section for which i need CRC.

    2. What is the relation between those 3 CRC in above case.

    Thanks,

    Ashish

  • Your table __ops_crc has 3 entries, each with (pointer, length, CRC). You should walk through them, and compute/compare each CRC. [Ref MSP430 Tools (SLAU131V) Sec 8.9.4.] The F5438A has a CRC unit (CRC-CCITT) which can do much of the heavy lifting.

    CRCs are generated by section, to avoid the problem of gaps (indeterminate contents) between sections. There exists no single CRC for the entire image, since it's a group of fragments, not a single unit.

  • The reply posted by Bruce McKenney47378 is correct.  For more details, please search the MSP430 assembly tools manual for the sub-chapter titled Linker-Generated CRC Tables.

    Thanks and regards,

    -George

**Attention** This is a public forum