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.

CCS/TM4C123GH6PM: help needed in CCS

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hi everybody,

i am at the beginning of using MISRA for static code analysis .. i have a trouble with large number of warnings because of header files included 

is there any way to apply MISRA  checking on the code of certain file or disable checking for some headers 

thanks 

Sarea

  • sarea hariri said:
    is there any way to apply MISRA  checking on the code of certain file

    You can control the build options on a file by file basis, and thereby apply the --check_misra option selectively.  Please see the File Specific Options section of the article Projects and Build Handbook for CCS.  

    sarea hariri said:
    or disable checking for some headers 

    Unfortunately, there is no way to control that with build options  The best you can do is change the source code around the inclusion of the problem header files.  Do something similar to the following ...

    #pragma diag_push
    #pragma CHECK_MISRA("none")
    #include "hdr1.h"
    #include "hdr2.h"
    #include "hdr3.h"
    #pragma diag_pop
    

    This code disables MISRA checks for those header files, and then restores those checks for the rest of the source file.

    Thanks and regards,

    -George

  • George

    well, after trying the piece of code you provided above .. it works but i also have a problems since it still checking misra rules on the c file included in the projects .. i have now lots of warnings in the startup.c and the c files other than main.c
    any idea for set the checking on a certain file like main.c and skipping others ?

    many thanks,
    Sarea
  • sarea hariri said:
    any idea for set the checking on a certain file like main.c and skipping others ?

    Remove the --check_misra option from the project build settings.  Then, using the File Specific Options feature I mention in my previous post, add it back to the files you want checked.

    Thanks and regards,

    -George