FreeRTOS-Kernel is MISRA C:2012 compliant. This directory contains a project to run Synopsys Coverity for checking MISRA compliance.
Note Coverity version 2023.6.1 incorrectly infers the type of
pdTRUEandpdFALSEas boolean because of their names, resulting in multiple false positive warnings about type mismatch. We replacepdTRUEwithpdPASSandpdFALSEwithpdFAILto avoid these false positive warnings. This workaround will not be needed after Coverity fixes the issue of incorrectly inferring the type ofpdTRUEandpdFALSEas boolean.
Deviations from the MISRA C:2012 guidelines are documented in MISRA.md and coverity_misra.config files.
Coverity can be run on any platform mentioned here. The following are the prerequisites to generate coverity report:
cmake --version).git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git ./FreeRTOS-KernelGo to the root directory of the FreeRTOS-Kernel repo and run the following commands in a terminal:
cov-configure --force --compiler cc --comptype gcc
build directory:Single core FreeRTOS:
cmake -B build -S examples/coverity
SMP FreeRTOS:
cmake -B build -S examples/coverity -DFREERTOS_SMP_EXAMPLE=1
cd build/ cov-build --emit-complementary-info --dir cov-out make coverity
cov-out) and begin Coverity static analysis:cov-analyze --dir ./cov-out \
--coding-standard-config ../examples/coverity/coverity_misra.config \
--tu-pattern "file('[A-Za-z_]+\.c') && ( ! file('main.c') ) && ( ! file('port.c') )"
cov-format-errors --dir ./cov-out --html-output html-output
HTML report should now be generated in a directory named html-output.