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 example README #1020

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 27 additions & 17 deletions examples/cmake_example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@
/* Standard includes. */
#include <stdio.h>

void exampleTask( void * parameters )
/*-----------------------------------------------------------*/

static void exampleTask( void * parameters );

/*-----------------------------------------------------------*/

static void exampleTask( void * parameters )
{
/* Unused parameters. */
( void ) parameters;
Expand All @@ -61,15 +67,15 @@ void main( void )
static StaticTask_t exampleTaskTCB;
static StackType_t exampleTaskStack[ configMINIMAL_STACK_SIZE ];

printf( "Example FreeRTOS Project\n" );
( void ) printf( "Example FreeRTOS Project\n" );

xTaskCreateStatic( exampleTask,
"example",
configMINIMAL_STACK_SIZE,
NULL,
configMAX_PRIORITIES - 1,
&( exampleTaskStack[ 0 ] ),
&( exampleTaskTCB ) );
( void ) xTaskCreateStatic( exampleTask,
"example",
configMINIMAL_STACK_SIZE,
NULL,
configMAX_PRIORITIES - 1U,
&( exampleTaskStack[ 0 ] ),
&( exampleTaskTCB ) );

/* Start the scheduler. */
vTaskStartScheduler();
Expand All @@ -81,12 +87,16 @@ void main( void )
}
/*-----------------------------------------------------------*/

void vApplicationStackOverflowHook( TaskHandle_t xTask,
char * pcTaskName )
{
/* Check pcTaskName for the name of the offending task,
* or pxCurrentTCB if pcTaskName has itself been corrupted. */
( void ) xTask;
( void ) pcTaskName;
}
#if ( configCHECK_FOR_STACK_OVERFLOW > 0 )

void vApplicationStackOverflowHook( TaskHandle_t xTask,
char * pcTaskName )
{
/* Check pcTaskName for the name of the offending task,
* or pxCurrentTCB if pcTaskName has itself been corrupted. */
( void ) xTask;
( void ) pcTaskName;
}

#endif /* #if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) */
/*-----------------------------------------------------------*/
7 changes: 3 additions & 4 deletions examples/coverity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ run [Synopsys Coverity](https://www.synopsys.com/software-integrity/security-tes
for checking MISRA compliance.

> **Note**
Coverity version 2022.6.1 incorrectly infers the type of `pdTRUE` and `pdFALSE`
Coverity version 2023.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
Expand Down Expand Up @@ -40,15 +40,14 @@ commands in a terminal:
3. Build the (pseudo) application:
~~~
cd build/
cov-build --emit-complementary-info --dir cov-out make
cov-build --emit-complementary-info --dir cov-out make coverity
~~~
4. 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')
--tu-pattern "file('[A-Za-z_]+\.c')"
~~~
5. Generate the HTML report:
~~~
Expand Down
Loading