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.

TMS320F28388D: How to explain or solve Static code testing?

Part Number: TMS320F28388D

Tool/software:

Hi Experts,

I am asking for my customer.

When the customer used MISRA C 2012 to perform a static scan on the drilib library file, he found a lot of unused code. The customer had to fix these issues to meet certification requirements, and they asked us for explanations or to indicate unused code for what? They use Coverity to do Code static testing, you can check the below upload files to find the unused code, they need us provide explanation documentation, the following code will not cause functional safety risks. Do you have any insight or suggestion here? Thanks.

./cfs-file/__key/communityserver-discussions-components-files/171/_B065FA5E_-Microsoft-Word-_87656368_.docx

新建 Microsoft Word 文档.docx

  • The unused code issue example shown in the attached document appears to be related to the fact that not all the #defines in our register header files are used:

    misra_c_2012_rule_2_5_violation: Macro GPIO_GPATOGGLE_GPIO12 is defined but never used

    We generate these header files to contain every documented register and bit-field in the device, but the driverlib doesn't necessarily use them all. For example, with the GPIO12 macro above, it makes way more sense to write a function that calculates the GPIO bit mask based on the GPIO number rather than using every single generated #define in the code. So it's up to the customer to decide if it's necessary to remove every single one of these unused macros from the header files or to document this use case as an acceptable deviation to the standard.

    Whitney