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.

TMS320F2800132: Using the linker to convert the calculated CRC in ASCII

Part Number: TMS320F2800132
Other Parts Discussed in Thread: C2000-CGT

Tool/software:

Hello,

I actually use the linker to calculate and store the CRC on some specific area.

I use the crc and crc_table operator according to the area I need to calculate and use this crc value at stratup to verify the code is OK.

I have created in the memory a "header" in ASCII that contains some information about the code, so opening the .out file the header is easily readable without any knowledge to convert hex to ascii etc...

My question is : is there a possibility using the linker to convert the differents CRC to ASCII and store it at a specific flash location?

It can probably be done using post build script but I do not have the knowledge to do this.

For information I use TI C2000-CGT compiler v22.6.1.LTS.

WIth best regards.

  • Hi Manu, 

    Apologies for the late response, let me loop the CRC experts for this.

    Thanks

    Aswin

  • Unfortunately, I don't understand this description ...

    I have created in the memory a "header" in ASCII that contains some information about the code, so opening the .out file the header is easily readable without any knowledge to convert hex to ascii etc...

    So I can't answer this question ...

    is there a possibility using the linker to convert the differents CRC to ASCII and store it at a specific flash location?

    But it might be helpful for me to describe how things typically work.

    I presume you use the crc_table operator as described in the sub-chapter titled Linker-Generated CRC Tables and CRC Over Memory Ranges in the C28x assembly tools manual.  In that case, the crc_table entry created by the linker is in an output section named .TI.crctab.  This is an initalized section like .const or .text.  I presume you allocate this section with a specification in the linker command file similar to ...

        .TI.crctab > MEMORY_RANGE_NAME_HERE

    When the linker is done, it creates an binary executable file.  The linker itself supports no other output formats.  But it is possible to create another file that represents the same information, but in a format called hexadecimal.  This is done with the hex conversion utility hex2000, which is also documented in the C28x assembly tools manual.  The hex conversion utility converts the contents of initialized sections, like .TI.crctab, to a hex format chosen by a command line option.  For a better understanding of a binary executable file and the related hex file, please see the article A Brief History of TI Object File Formats.  

    Thanks and regards,

    -George

  • Sory if it was not clear. I will try to clarify.

    I presume you use the crc_table operator as described in the sub-chapter titled Linker-Generated CRC Tables and CRC Over Memory Ranges in the C28x assembly tools manual.  In that case, the crc_table entry created by the linker is in an output section named .TI.crctab.  This is an initalized section like .const or .text.  I presume you allocate this section with a specification in the linker command file similar to ...

    Fullscreen
    1
    .TI.crctab > MEMORY_RANGE_NAME_HERE
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Yes, you are right.

    I use .TI.crctab and also another crc using TI.memcrc.

    In the .map file, I can get all the different CRC I use:

    LINKER GENERATED CRC TABLES

    _my_crc_table_for_safety @ 00080078 records: 1, size/record: 8, table size: 10
    .section_safety: algorithm=CRC32_PRIME(ID=0), page=0, load addr=00086708, size=00001572, CRC=b242174e
    _my_crc_table_for_safetyram @ 00080082 records: 1, size/record: 8, table size: 10
    safetyramfunc: algorithm=CRC32_PRIME(ID=0), page=0, load addr=000865f0, size=00000117, CRC=3117a639


    LINKER GENERATED MEMRANGE CRC TABLES

    flashbank0_checksum @ 00080068 records: 1, size/record: 6, table size: 12, algorithm=CRC32_PRIME(ID=0), CRC: bf37e83f
    FLASHBANK0_CODE: page=0, load addr=000800d8, size=00006518

    I have place the sections where the CRC are stored at the begining of the memory, now if I open the .out file using a text editor, where the CRC are stored I can only see some unreadable characters (probably NB²), because it is the "raw hex value". Using some hex to ascii converter I can see the CRC in the out file but it is not trivial due to the conversion and also due to how 32 bits are stored in the memory.

    What I would like is to convert the crc 32 bits value (for exemple b242174e) to a character string so that when I open the .out file using the text editor, I can see  "b242174e" instead of  NB².

    I hope this clarify.

    Regards.

  • As you have seen, it is difficult to directly inspect a .out file.  That's the main reason for the map file.  That said, I'll show you another way to see the CRC tables.

    Use the object file display utility ofd2000.  It is documented in the C28x assembly tools manual.  Run a command similar to ...

    ofd2000 --verbose --obj_display=none,sections --output=ofd_report.txt file.out

    Inspect the file ofd_report.txt.  Search for .TI.crctab.  You'll see something similar to:

        <6> ".TI.crctab"
           Load Address:        0x00108b2a    Run Address:        0x00108b2a
           Size:                0xa           Alignment:          2         
           Loaded Onto Device:  Yes           Address Unit Size:  16 bits   
           File Offset:         0x1888        # Relocs:           0         
           Section Type:        SHT_PROGBITS  ELF sh_flags:       0x2       
           ELF sh_flag:         SHF_ALLOC     TI ext_flags:       0x0

    The field File Offset is the byte offset in the .out file where this section begins.  The field Size is the length.  Use those values as inputs to a utility that dumps out binary files, such as the od command available on most Unix-like systems.

    Thanks and regards,

    -George

  • I get the idea but I would like to prevent any post-processing on the .out file.

    This will have to be used by non engineering team, that's 'why having it readable in the .out file with text editor will be the best for us, if possible, of course but I'm really not sure it is possible.

    As an alternative, actually I use the .map to get the crc value, then I use it in the source files to create a const char that I store in the begining of the memory (out the CRC calculated area to prevent crc to change again). But If it can be done directly by the linker, it will be easier.

    Regards 

  • But If it can be done directly by the linker, it will be easier.

    The only solution available in the linker is what you see in the map file.

    Consider this suggestion: Give the non-engineering team both the .out file and the map file, along with a short document that explains how to see the CRC value(s) in the map file.

    Thanks and regards,

    -George