FreeRTOS-Kernel conforms to MISRA C:2012 guidelines, with the deviations listed below. Compliance is checked with Coverity static analysis. Since the FreeRTOS kernel is designed for small-embedded devices, it needs to have a very small memory footprint and has to be efficient. To achieve that and to increase the performance, it deviates from some MISRA rules. The specific deviations, suppressed inline, are listed below.
Additionally, MISRA configuration contains project wide deviations.
To find the violation references in the source files run grep on the source code with ( Assuming rule 8.4 violation; with justification in point 1 ):
grep 'MISRA Ref 8.4.1' . -rI
MISRA C:2012 Rule 8.4: A compatible declaration shall be visible when an object or function with external linkage is defined.
Ref 8.4.1
Ref 8.4.2
MISRA C:2012 Rule 8.6: An identifier with external linkage shall have exactly one external definition.
Ref 8.6.1
MISRA C:2012 Rule 11.3: A cast shall not be performed between a pointer to object type and a pointer to a different object type.
Ref 11.3.1
MISRA C:2012 Rule 11.5: A conversion should not be performed from pointer to void into pointer to object. This rule prohibits conversion of a pointer to void into a pointer to object because it may result in an incorrectly aligned pointer leading to undefined behavior.
Ref 11.5.1
Ref 11.5.2
Ref 11.5.3
Ref 11.5.4
Ref 11.5.5
Copy below content to misra.conf
to run Coverity on FreeRTOS-Kernel.
// MISRA C-2012 Rules { version : "2.0", standard : "c2012", title: "Coverity MISRA Configuration", deviations : [ // Disable the following rules. { deviation: "Directive 4.8", reason: "HeapRegion_t and HeapStats_t are used only in heap files but declared in portable.h which is included in multiple source files. As a result, these definitions appear in multiple source files where they are not used." }, { deviation: "Directive 4.9", reason: "FreeRTOS-Kernel is optimised to work on small micro-controllers. To achieve that, function-like macros are used." }, { deviation: "Rule 1.2", reason: "The __attribute__ tags are used via macros which are defined in port files." }, { deviation: "Rule 3.1", reason: "We post HTTP links in code comments which contain // inside comments blocks." }, { deviation: "Rule 8.7", reason: "API functions are not used by the library outside of the files they are defined; however, they must be externally visible in order to be used by an application." } ] }