LAUNCHXL2-570LC43: TMS570 Linker Generated CRC Table

Part Number: LAUNCHXL2-570LC43


Hello,

I followed SPNA235–August 2016 in order to create linker generated CRC table. Such like this:

.text : {} palign=8, fill=0xffffffff, crc_table(textCrcTable, algorithm=TMS570_CRC64_ISO) > FLASH0 | FLASH 1

After that in the source code (.c) I declared an extern variable like this: 

extern const CRC_TABLE textCrcTable;

By this way I reach the CRC value generated by the linker. However, when I execute rule check for MISRA C 2012 there is an issue occured "The 'textCrcTable' object has no definition." although I am using in the function defined in the same source file.

The rule dictates "An identifier with external linkage shall have exactly one external definition."

I have used this kind of access to the variable since the document SPNA235–August 2016 states that:

->There are several ways to define and access the CRC tables created by the linker. The following definition for a CRC table within the C code is recommended: 

extern const CRC_TABLE _my_crc_table; 

 

Could you help me to implement any other way that passes MISRA rule check?

Thank you.

 

  • when I execute rule check for MISRA C 2012 there is an issue occured "The 'textCrcTable' object has no definition."

    Are the Misra_C rules included or excluded in your project compilation? By default, all the Misra C rules are excluded.

  • a variable or function declared to be accessible across different files (external linkage) must have its actual implementation (definition) appear only once in the entire program to avoid linker errors and undefined behavior, even if declared many times using extern.

  • Thank you for your response.

    The issue is that the linker generates a CRC table and places it in flash memory in a specific section. According to the reference document, it is suggested that the data in this section can be accessed by declaring an extern variable with the same name as the table. So, you declare an extern variable but the definition does not exist in the source code. Since the linker already defined the value of this variable and stored. Also, if you make the definition of this variable you lost the data that linker has written. 

    So I m looking for a way to access the data placed in the flash memory apart from generating this extern problem.

    For MISRA check I m using another static analysis tool. But the violation the tool reporting is understandable.