Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update coverity violation for SMP #81

Conversation

chinglee-iot
Copy link
Owner

@chinglee-iot chinglee-iot commented Apr 25, 2023

Fix coverity violations for SMP diff part.

Description

Fix coverity violations for SMP diff part.
SMP diff part is generated by comparing the coverity report of single core and SMP.

The coverity violations with SMP are already fixed in the implementation. The coverify report only shows violations in single core ( common code ). Single core FreeRTOS are checked by another tool "Lint". The reason for violation is documented with lint suppression comment.

The following is a lint suppression example:

/*lint !e9079 All values returned by pvPortMalloc() have at least the alignment required 
 *by the MCU's stack and this allocation allocates a struct that has the alignment requirements of a pointer. */

The tasks.c coverity errors for single core

Checker Violations Category
MISRA C-2012 Directive 4.6 7 Advisory
MISRA C-2012 Rule 10.1 3 Required
MISRA C-2012 Rule 10.3 4 Required
MISRA C-2012 Rule 10.4 51 Required
MISRA C-2012 Rule 11.3 3 Required
MISRA C-2012 Rule 11.4 2 Advisory
MISRA C-2012 Rule 13.2 2 Required
MISRA C-2012 Rule 14.4 37 Required
MISRA C-2012 Rule 15.4 1 Advisory
MISRA C-2012 Rule 17.7 4 Required
MISRA C-2012 Rule 17.8 10 Advisory
MISRA C-2012 Rule 20.5 1 Advisory
MISRA C-2012 Rule 21.6 3 Required
MISRA C-2012 Rule 5.9 2 Advisory
MISRA C-2012 Rule 8.13 18 Advisory
MISRA C-2012 Rule 8.4 2 Required
MISRA C-2012 Rule 8.9 7 Advisory
MISRA C-2012 Rule 9.1 1 Mandatory

Test Steps

Generate SMP coverity report

  1. Clone the SMP integration FreeRTOS repo.
  2. cd FreeRTOS/Test/Coverity
  3. Update the compiler configuration in Coverity
    cov-configure --force --compiler cc --comptype gcc -- -std=gnu90
  4. Build the (pseudo) application
    cov-build --emit-complementary-info --dir cov-out make multicore1
    or
    cov-build --emit-complementary-info --dir cov-out make multicore2
  5. Go to the Coverity output directory (cov-out) and begin Coverity static analysis
    cd cov-out/
    cov-analyze --dir . --coding-standard-config ../coverity_misra.config
  6. Generate the report with the following command
    cov-format-errors --dir . --file "Source/tasks.c" --exclude-files '(/Test/|/Source/portable/)' --html-output html-out;

Generate single core coverity report

  1. Clone the SMP integration FreeRTOS repo.
  2. cd FreeRTOS/Test/Coverity
  3. Update the compiler configuration in Coverity
    cov-configure --force --compiler cc --comptype gcc -- -std=gnu90
  4. Build the (pseudo) application ( different make target )
    cov-build --emit-complementary-info --dir cov-out make singlecore
  5. Go to the Coverity output directory (cov-out) and begin Coverity static analysis
    cd cov-out/
    cov-analyze --dir . --coding-standard-config ../coverity_misra.config
  6. Generate the report with the following command
    cov-format-errors --dir . --file "Source/tasks.c" --exclude-files '(/Test/|/Source/portable/)' --html-output html-out;

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

tasks.c Outdated Show resolved Hide resolved
MISRA.md Outdated Show resolved Hide resolved
MISRA.md Outdated Show resolved Hide resolved
tasks.c Outdated Show resolved Hide resolved
tasks.c Outdated Show resolved Hide resolved
MISRA.md Outdated Show resolved Hide resolved
tasks.c Outdated Show resolved Hide resolved
MISRA.md Outdated Show resolved Hide resolved
@chinglee-iot chinglee-iot requested a review from ActoryOu April 27, 2023 12:29
chinglee-iot and others added 14 commits April 27, 2023 20:32
Signed-off-by: Gaurav Aggarwal <[email protected]>
Signed-off-by: Gaurav Aggarwal <[email protected]>
* Remove taskTASK_IS_YIELDING since it is not used anymore.
* Define taskYIELD_IF_USING_PREEMPTION for single core only. SMP uses
  prvYieldForTask or vTaskieldWithinAPI. The conditiion is not the same.
* Define taskSELECT_HIGHEST_PRIORITY_TASK for single core only. SMP
  doesn't support configUSE_PORT_OPTIMISED_TASK_SELECTION now.
@chinglee-iot chinglee-iot merged commit c4a8d7a into smp-dev-complete-merge-candidate-history May 16, 2023
@chinglee-iot chinglee-iot deleted the merge-main-misra-SMP-rebase20221130 branch May 17, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.