You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FreeRTOS-Kernel/examples/coverity
chinglee-iot 5dbfd380f0
Add coverity example (#870)
* Add coverity example

* Update for CI

* Fix for CI 2

* Update kernel_misra.config

* Rename coverity example to coverity

* Update FreeRTOSConfig.h for coverity project

* Update MISRA.md

* Move coverity config to coverity_misra.config

* Update coverity misra config

* Add README.md file

* Update FreeRTOSConfig.h for coverity

* Fix uncrustify and spell

* Update README.md for relative link path

Update README.md for relative link path

* Update README.md for relative link 2

* Update MISRA.md for relateive path

* Fix for format

* Update coverity_misra.config

* Update configuration folder

* Update README.md for link

* Code review suggestions

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
1 year ago
..
CMakeLists.txt Add coverity example (#870) 1 year ago
FreeRTOSConfig.h Add coverity example (#870) 1 year ago
README.md Add coverity example (#870) 1 year ago
coverity_misra.config Add coverity example (#870) 1 year ago

README.md

MISRA Compliance for FreeRTOS-Kernel

FreeRTOS-Kernel is MISRA C:2012 compliant. This directory contains a project to run Synopsys Coverity for checking MISRA compliance.

Note Coverity version 2022.6.1 incorrectly infers the type of pdTRUE and pdFALSE as boolean because of their names, resulting in multiple false positive warnings about type mismatch. We replace pdTRUE with pdPASS and pdFALSE with pdFAIL to avoid these false positive warnings. This workaround will not be needed after Coverity fixes the issue of incorrectly inferring the type of pdTRUE and pdFALSE as boolean.

Deviations from the MISRA C:2012 guidelines are documented in MISRA.md and coverity_misra.config files.

Getting Started

Prerequisites

Coverity can be run on any platform mentioned here. The following are the prerequisites to generate coverity report:

  1. CMake version > 3.13.0 (You can check whether you have this by typing cmake --version).
  2. GCC compiler.
    • See download and installation instructions here.
  3. Clone the repo using the following command:
    • git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git ./FreeRTOS-Kernel

Generating Report

Go to the root directory of the FreeRTOS-Kernel repo and run the following commands in a terminal:

  1. Update the compiler configuration in Coverity:
cov-configure --force --compiler cc --comptype gcc
  1. Create the build files using CMake in a build directory:
cmake -B build -S examples/coverity
  1. Build the (pseudo) application:
cd build/
cov-build --emit-complementary-info --dir cov-out make
  1. Go to the Coverity output directory (cov-out) and begin Coverity static analysis:
cd cov-out/
cov-analyze --dir ./cov-out \
  --coding-standard-config ../examples/coverity/coverity_misra.config \
  --tu-pattern "file('.*/FreeRTOS/Source/[A-Za-z_]*\.c')
  1. Generate the HTML report:
cov-format-errors --dir ./cov-out --html-output html-output

HTML report should now be generated in a directory named html-output.