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.

Compiler: CHECK_MISRA with TI-RTOS

Other Parts Discussed in Thread: CC1350

Tool/software: TI C/C++ Compiler

Hi,

Version Info

CCS Version: 6.2.0.00050
Compiler Version: TI ARM v.16.9.1LTS
XDCTools Version: 3.32.1.22
TI-RTOS for CC13xx and CC26xx Version: 2.21.0.06

Background

I am attempting to use MISRA-C:2004 rule checking with a TI-RTOS based project. My primary interest is ensuring the application code is passing checks and not any TI-RTOS code. Presently I am attempting to do this using '#pragma CHECK_MISRA("none")' and '#pragma RESET_MISRA("all")' around all includes of TI-RTOS files. Presently it would appear as if this #pragma is not being recognized.

Steps Taken

  • Created a new CC1350LaunchPad TI-RTOS project
    • File -> New -> CCS Project -> Target: CC1350F128, Name: misra, Project templates and examples -> TI-RTOS Examples -> CC1350 LaunchPad -> Driver Examples -> Empty Examples -> Empty Project -> 'Finish'
  • Enable all MISRA-C:2004 checks
    • Project properties -> Build -> ARM Compiler -> Advanced Options -> MISRA-C:2004 -> 'All'
  • Modify empty.c to check 'none' MISRA-C:2004
  • Line 1:


#pragma CHECK_MISRA("none")

Question

Is it still possible to utilize the MISRA pragams with a TI-RTOS project or is there another approach to "exclude" MISRA checking outside of application code?

Thank you for any help or insight!

Best Regards,

Mark-

  • That version of the TI ARM compiler does accept both pragma CHECK_MISRA and pragma RESET_MISRA. What leads you to believe the compiler does not accept one or the other? Do you get an error message? Do you get a MISRA warning you didn't expect? Could you post a complete test case that demonstrates the problem? Don't forget to show your complete command-line options for the compiler. You can most easily get the options from the build console window.
  • Hi Archaeologist,

    I believe this is more my misunderstanding of how the pragma/build process works with MISRA checking. My initial interpretation was the CHECK_MISRA("none") would also apply to the #include(d) files as well in that same file, but I admittedly have no good reason for making this assumption. The results indicate an exclude of MISRA checking within each distinct file is required instead of being 'applied' to any included files.

    After completing the Steps Taken shown above, a right-click of empty.c and 'Build Selected File(s)...' results in 3146 warnings (mostly all MISRA-C related) none of which I would have initially expected.  My expectation building only a file with a #CHECK_MISRA("none") at the top is that there would be 0 warnings.

    Is there a way to remove theses MISRA warnings from the included files and only show them for 'my' application code?

    The first few lines of the build console for empty.c are provided below.

    **** Build of configuration Debug for project empty_misra_test ****
    
    "C:\\ti62\\ccsv6\\utils\\bin\\gmake" -k empty.obj
    
    'Building file: ../empty.cfg'
    
    'Invoking: XDCtools'
    
    "C:/ti62/xdctools_3_32_01_22_core/xs" --xdcpath="C:/TI/tirex-content/tirtos_cc13xx_cc26xx_2_21_00_06/packages;C:/TI/tirex-content/tirtos_cc13xx_cc26xx_2_21_00_06/products/tidrivers_cc13xx_cc26xx_2_21_00_04/packages;C:/TI/tirex-content/tirtos_cc13xx_cc26xx_2_21_00_06/products/bios_6_46_01_37/packages;C:/TI/tirex-content/tirtos_cc13xx_cc26xx_2_21_00_06/products/uia_2_01_00_01/packages;C:/ti62/ccsv6/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.arm.elf.M3 -p ti.platforms.simplelink:CC1350F128 -r release -c "C:/ti62/ccsv6/tools/compiler/ti-cgt-arm_16.9.1.LTS" --compileOptions "-mv7M3 --code_state=16 --float_support=vfplib -me --include_path=\"C:/Users/a0273016/Documents/DFA/Misc/SA/workspace/empty_misra_test\" --include_path=\"C:/TI/tirex-content/tirtos_cc13xx_cc26xx_2_21_00_06/products/cc13xxware_2_04_03_17272\" --include_path=\"C:/ti62/ccsv6/tools/compiler/ti-cgt-arm_16.9.1.LTS/include\" --define=ccs -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --check_misra=\"all,-2.2\"  " "../empty.cfg"
    

    Best Regards,

    Mark-

  • I apologize for the delay.

    Mark Swanson said:
    Is there a way to remove theses MISRA warnings from the included files and only show them for 'my' application code?

    Unfortunately, there is no way to do that at present.  So entry TIRTOS-908 was filed to have this issue addressed.  Exactly how this issue will be addressed, or when, I am presently unable to say.

    Thanks and regards,

    -George

  • Thank you George and Archaeologist for the replies!

    Best Regards,

    Mark-