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: Misra checking

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: CODECOMPOSER

Tool/software: Code Composer Studio

Hello all, 

I am interested to perform static code analysis (Misra checking) on my code only without any other files from TivaWare. 

as i used to do.. I just write : 

#pragma diag_push
#pragma CHECK_MISRA("none")

#include all the needed headers here 

#pragma diag_pop 

but this is not working .. when i try to build a selected file i have no warnings on the output even there is a misra violations. 

there is something else to mention.. i just change the define in the compiler options to (  --define=ccs=\"ccs\"  ) in  order to build with misra checks enabled

(see related thread here: 

Regards,

Sarea

  • Unfortunately, I am unable to reproduce the problem.  For this source file ...

    sarea hariri said:
    when i try to build a selected file i have no warnings on the output even there is a misra violations. 

    Please submit a test case as described in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Thanks George, 

    compiler version:  TI v16.9.6.LTS [TI v18.1.1.LTS]

    Here is the build console output: 


    **** Build of configuration Debug for project AutosarCanStack ****

    "C:\\ti\\ccsv8\\utils\\bin\\gmake" -k -j 8 arch/arm-cortexM4/drivers/Can.obj -O

    Building file: "../arch/arm-cortexM4/drivers/Can.c"
    Invoking: ARM Compiler
    "C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/Users/visitor/Documents/CODECOMPOSER 8/AutosarCanStack" --include_path="C:/ti/TivaWare_C_Series-2.1.4.178" --include_path="C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include" --define=PART_TM4C123GH6PM --define=ccs=\"ccs\" -g --gcc --preproc_with_comment --preproc_with_compile --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --check_misra="required" --obj_directory="arch/arm-cortexM4/drivers" "../arch/arm-cortexM4/drivers/Can.c"
    Finished building: "../arch/arm-cortexM4/drivers/Can.c"

    **** Build Finished ****

    Here is the Test case file:

    Can.pp.txt

    Regards, 

    Sarea

  • Thank you for submitting a test case.  I can reproduce the problem.  I filed CODEGEN-4912 in the SDOWP system to have it addressed.  You are welcome to follow it with the SDOWP link below in my signature.

    The problem is in the standard RTS header file stddef.h.  It is missing a #pragma diag_pop.  Towards the end of the file you see these lines ...

    #pragma diag_push
    #pragma CHECK_MISRA("-19.10") /* need types as macro arguments */
    
    #ifdef __TI_LLVM__
    #  define offsetof(_type, _ident) __builtin_offsetof(_type, _ident)
    #else
    #  ifndef __TMS320C55X__
    #      define offsetof(_type, _ident) \
             ((size_t)__intaddr__(&(((_type *)0)->_ident)))
    #  else /* __TMS320C55X__ */
    #    define offsetof(_type, _ident) \
        (__intaddr__( ((char *) &((_type *)0)->_ident) - ((char *) 0) ))
    #  endif /* __TMS320C55X__ */
    #endif
    

    The #pragma diag_push at the start of these lines has no corresponding #pragma diag_pop.  As a workaround, add one right after those lines.

    I apologize for the error.

    Thanks and regards,

    -George