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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
c011734
Fix compile warnings and MISRA 2012 C Rule 1.1.
ActoryOu Nov 29, 2022
abc85d3
Fix MISRA C 2012 Directive 4.6.
ActoryOu Nov 29, 2022
3b05aba
Fix MISRA C 2012 Rule 1.1.
ActoryOu Nov 29, 2022
cb17335
Fix MISRA C 2012 Rule 17.3.
ActoryOu Nov 29, 2022
516fc6f
Fix MISRA C 2012 Rule 8.3.
ActoryOu Nov 29, 2022
3466371
Fix MISRA C 2012 Rule 8.4.
ActoryOu Nov 29, 2022
80785f9
Fix CHECKED_RETURN.
ActoryOu Nov 30, 2022
65fa1bb
Fix MISRA C 2012 Rule 10.1.
ActoryOu Nov 30, 2022
a9cbaa1
Fix MISRA C 2012 Rule 10.2.
ActoryOu Nov 30, 2022
1e14c65
Fix MISRA C 2012 Rule 10.3.
ActoryOu Nov 30, 2022
7857976
Fix MISRA C 2012 Rule 10.4.
ActoryOu Nov 30, 2022
e9d6e22
Fix MISRA C 2012 Rule 10.7.
ActoryOu Nov 30, 2022
d656d1d
Fix MISRA C 2012 Rule 10.8.
ActoryOu Nov 30, 2022
32295e7
Fix MISRA C 2012 Rule 11.3.
ActoryOu Nov 30, 2022
ee9a882
Fix MISRA C 2012 Rule 11.5.
ActoryOu Nov 30, 2022
e1a1db9
Fix MISRA C 2012 Rule 12.1.
ActoryOu Nov 30, 2022
7036d9d
Fix MISRA C 2012 Rule 13.3.
ActoryOu Nov 30, 2022
bc39734
Fix MISRA C 2012 Rule 14.3.
ActoryOu Nov 30, 2022
213e8f9
Fix MISRA C 2012 Rule 17.7.
ActoryOu Nov 30, 2022
b55b074
Fix MISRA C 2012 Rule 18.1.
ActoryOu Nov 30, 2022
178f9b9
Fix MISRA C 2012 Rule 8.13.
ActoryOu Nov 30, 2022
66665d2
Fix MISRA C 2012 Rule 8.5.
ActoryOu Nov 30, 2022
611cff6
Fix MISRA C 2012 Rule 8.6.
ActoryOu Nov 30, 2022
70903a3
Fix MISRA C 2012 Rule 8.9.
ActoryOu Nov 30, 2022
257c3e0
Fix MISRA C 2012 Rule 8.4.
ActoryOu Nov 30, 2022
f1ece17
Fix MISRA C 2012 Rule 8.5.
ActoryOu Nov 30, 2022
b73bf11
Fix MISRA C 2012 Rule 8.6.
ActoryOu Nov 30, 2022
59cf3f6
Revert unnecessary suppression.
ActoryOu Nov 30, 2022
5c6d77b
Add more description in MISRA.md
ActoryOu Nov 30, 2022
b278341
Fix formatting.
ActoryOu Nov 30, 2022
ef65fda
Fix MISRA.md
ActoryOu Nov 30, 2022
b998572
Fix comments.
ActoryOu Dec 5, 2022
646698d
Update MISRA.md for rule 8.9.
ActoryOu Dec 5, 2022
d29d3e2
Update MISRA.md for rule 8.5/8.6.
ActoryOu Dec 5, 2022
a244764
Wrap xYieldCount with configRUN_MULTIPLE_PRIORITIES. Fix comments.
ActoryOu Dec 5, 2022
99d3d54
Fix array-bounds compiler warning on gcc11+ in list.h (#580)
archigup Dec 15, 2022
6d65558
move the prototype for vApplicationIdleHook to task.h. (#600)
tcpluess Dec 19, 2022
aab4812
Update MISRA.md.
ActoryOu Dec 26, 2022
953f32e
Remove Dir 4.6 in MISRA.md.
ActoryOu Dec 28, 2022
bb6071e
Update equal priority task preemption (#603)
chinglee-iot Jan 6, 2023
8592fd2
Update FreeRTOS/FreeRTOS build checks (#613)
aggarg Jan 16, 2023
78319fd
Add ulTaskGetRunTimeCounter and ulTaskGetRunTimePercent (#611)
chrisnc Jan 19, 2023
260a37c
Fix some CMake documentation typos (#616)
davefiddes Jan 23, 2023
88674cb
Update the uxSchedulerSuspended after prvCheckForRunStateChange
chinglee-iot Jan 30, 2023
91c20f5
Added support of 64bit events. (#597)
Hadatko Feb 3, 2023
050cf0d
Introduce portMEMORY_BARRIER for Microblaze port. (#621)
bbain Feb 13, 2023
8252ede
Do not call exit() on MSVC Port when calling vPortEndScheduler (#624)
Ju1He1 Feb 15, 2023
ba1deb5
Update PR template to include checkbox for Unit Test related changes…
AniruddhaKanhere Feb 20, 2023
5d05601
Fix build failure introduced in PR #597 (#629)
aggarg Feb 23, 2023
8cd5451
Feature/fixing clang gnu compiler warnings (#620)
phelter Feb 23, 2023
cd87681
POSIX port fixes (#626)
jacky309 Feb 27, 2023
5fdbb7f
Cortex-M35P: Add Cortex-M35P port (#631)
urutva Feb 28, 2023
0a70ecb
Introduced Github Status Badge for Unit Tests (#634)
amazonKamath Feb 28, 2023
e6514fb
Remove C99 requirement from CMake file (#633)
aggarg Mar 2, 2023
c3e1df0
Add Thread Local Storage (TLS) support using Picolibc functions (#343)
keith-packard Mar 2, 2023
a9e1f66
Interrupt priority assert improvements for CM3/4/7 (#602)
chrisnc Mar 2, 2023
97acc2e
Introduced code coverage status badge (#635)
amazonKamath Mar 2, 2023
ddd50d9
added portPOINTER_SIZE_TYPE and SIZE_MAX definition to PIC24/dsPIC po…
n9wxu Mar 4, 2023
563c57e
Fix TLS and stack alignment when using picolibc (#637)
keith-packard Mar 6, 2023
7b26ea6
Enable building the GCC Cortex-R5 port without an FPU (#586)
paulbartell Mar 6, 2023
309a18a
Fix freertos_kernel cmake property, Posix Port (#640)
kstribrnAmzn Mar 7, 2023
55658e1
Add missing FreeRTOS+ defines
Mar 11, 2023
d4d5e43
Run kernel demos and unit tests for PR changes (#645)
aggarg Mar 17, 2023
4600c94
Merge branch 'smp-dev-complete-merge-candidate-history' into misra-SM…
chinglee-iot Mar 21, 2023
9488ba2
Add functions to get the buffers of statically created objects (#641)
Dazza0 Mar 22, 2023
99797e1
Cortex-M Assert when NVIC implements 8 PRIO bits (#639)
kar-rahul-aws Mar 23, 2023
97e58da
Remove C90 requirement from CMakeLists (#649)
aggarg Mar 28, 2023
68f1053
Only add alignment padding when needed (#650)
aggarg Mar 28, 2023
1b8a424
add a missing comma (#651)
nbrunner Mar 29, 2023
aa987a3
fix conversion warning (#658)
votrungchi Apr 4, 2023
6cbb783
Merge branch 'smp-dev-complete-merge-candidate-history' into update-i…
chinglee-iot Apr 20, 2023
029ce2a
Merge branch 'smp-dev-complete-merge-candidate-history' into misra-SM…
chinglee-iot Apr 20, 2023
435c44a
Merge pull request #1 from chinglee-iot/misra-SMP-rebase20221130
ActoryOu Apr 20, 2023
686b6e6
ARMv7M: Adjust implemented priority bit assertions (#665)
paulbartell Apr 20, 2023
d8d2454
Update get idle tasks stats
chinglee-iot Apr 20, 2023
3101a1a
Define portBASE_TYPE in XMOS AICORE porting
chinglee-iot Apr 20, 2023
5c094b5
Update enter critical from ISR API
chinglee-iot Apr 20, 2023
714e543
Format portmacro.h in arm CM0 ports
paulbartell Apr 18, 2023
5f19e34
portable/ARM_CM0: Add xPortIsInsideInterrupt
paulbartell Apr 18, 2023
452b893
Merge branch 'smp-dev-update-xmos-aicore-conflict' into smp-dev-candi…
chinglee-iot Apr 21, 2023
bef099f
Merge branch 'update-increase-uxSchedulerSuspended-after' into smp-de…
chinglee-iot Apr 21, 2023
c4be682
Merge branch 'smp-dev-complete-merge-candidate-history' into merge-ma…
chinglee-iot Apr 21, 2023
1871ef5
Merge branch 'merge-main-misra-SMP-rebase20221130' into smp-dev-candi…
chinglee-iot Apr 21, 2023
7b9edd4
Merge pull request #2 from chinglee-iot/merge-main-misra-SMP-rebase20…
ActoryOu Apr 21, 2023
a5f1094
Fix get task stats
chinglee-iot Apr 21, 2023
8bfec72
Merge branch 'smp-dev-fix-idle-task-stats' into smp-dev-candidate-202…
chinglee-iot Apr 21, 2023
39b3bea
Fix missing configNUM_CORES
chinglee-iot Apr 21, 2023
c35632e
Merge branch 'smp-dev-fix-idle-task-stats' into smp-dev-candidate-202…
chinglee-iot Apr 21, 2023
9d21b07
Merge branch 'main' into smp-dev-compelete-merge-main-20230424
chinglee-iot Apr 24, 2023
91ff650
Merge branch 'smp-dev-complete-merge-candidate-history' into smp-dev-…
chinglee-iot Apr 24, 2023
3cc732a
Merge branch 'smp-dev-complete-merge-candidate-history' into smp-dev-…
chinglee-iot Apr 24, 2023
5b0bda3
Merge branch 'smp-dev-compelete-merge-main-20230424' into smp-dev-can…
chinglee-iot Apr 24, 2023
f6ec3c7
Fix uncrustify
chinglee-iot Apr 24, 2023
8037d3b
Update lexicon
chinglee-iot Apr 24, 2023
4e2c58d
Remove tailing space
chinglee-iot Apr 24, 2023
c659463
Fix ulTotalRunTime and ulTaskSwitchedInTime
chinglee-iot Apr 24, 2023
8748c6e
Ignore XMOS AICORE header check
chinglee-iot Apr 24, 2023
c30474a
Merge branch 'smp-dev-complete-fix-demos' into smp-dev-candidate-2023…
chinglee-iot Apr 25, 2023
a4f5274
Merge branch 'smp-dev-complete-fix-uncrustify' into smp-dev-candidate…
chinglee-iot Apr 25, 2023
6d2b442
Fix MSVC build init array
chinglee-iot Apr 25, 2023
c3fefa6
Fix MSVC building.
ActoryOu Apr 25, 2023
42b59b5
Merge branch 'misra-SMP-rebase20221130' into smp-dev-candidate-20230424
chinglee-iot Apr 25, 2023
4af4493
Merge branch 'smp-dev-complete-merge-candidate-history' into smp-dev-…
chinglee-iot Apr 25, 2023
9b9a9c7
Merge branch 'smp-dev-complete-merge-candidate-history' into merge-ma…
chinglee-iot Apr 25, 2023
791e0c9
Fix for c90 compiler
chinglee-iot Apr 25, 2023
a108e90
Merge main to misra smp rebase20221130 (#3)
chinglee-iot Apr 25, 2023
bcb60fc
Merge branch 'misra-SMP-rebase20221130' into smp-dev-candidate-20230424
chinglee-iot Apr 25, 2023
0fb7154
Merge branch 'smp-dev-complete-merge-candidate-history' into misra-SM…
chinglee-iot Apr 25, 2023
4c7a8da
Fix MISRA violation in get idle run time counter
chinglee-iot Apr 25, 2023
239051f
Merge remote-tracking branch 'actory/misra-SMP-rebase20221130' into m…
chinglee-iot Apr 25, 2023
b9470a3
Fix CI check error
chinglee-iot Apr 25, 2023
7b03893
Merge branch 'merge-main-misra-SMP-rebase20221130' into smp-dev-candi…
chinglee-iot Apr 25, 2023
86f37cb
Merge branch 'merge-main-misra-SMP-rebase20221130' into smp-dev-candi…
chinglee-iot Apr 25, 2023
56a9c7e
Fix single MISRA violation
chinglee-iot Apr 25, 2023
ea595d9
Update for std C90
chinglee-iot Apr 26, 2023
a1eab5a
Fix uncrustify
chinglee-iot Apr 26, 2023
e590e34
Remove unnecessary MISRA suppression
chinglee-iot Apr 27, 2023
84b19fe
Remove unreferenced MISRA suppression in MISRA.md
chinglee-iot Apr 27, 2023
17e5526
Remove 11.3 supression
chinglee-iot Apr 27, 2023
58da3ff
Remove 11.3 in MISRA.md
chinglee-iot Apr 27, 2023
b3514bd
Add back the suppression for pxCurrentTCBs
chinglee-iot Apr 27, 2023
28fa919
Fix typo
chinglee-iot Apr 27, 2023
b8b6d95
Fix more coverity errors
chinglee-iot May 4, 2023
cf0d10f
Fix error
chinglee-iot May 4, 2023
16f7d73
Return pdTRUE or pdFALSE with macros
chinglee-iot May 4, 2023
d4d167a
Fix possible overrun in prvSelectHighestPriority task
chinglee-iot May 4, 2023
c515f6b
Remove const due to list operation
chinglee-iot May 4, 2023
f02ef03
Uncrustify tasks
chinglee-iot May 8, 2023
5c41147
Code review suggestions
aggarg May 15, 2023
dc01863
Code review suggestions - 2
aggarg May 15, 2023
4de5931
Update for misra rule 2.5
chinglee-iot May 15, 2023
7352171
Fix format
chinglee-iot May 15, 2023
12a0252
Add rule 8.7 and 11.5 in misra.config
chinglee-iot May 15, 2023
12d08d6
Fix uncrustify
chinglee-iot May 15, 2023
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
1 change: 1 addition & 0 deletions .github/lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ coproc
coprocessor
coprocessors
coreid
coverity
covfs
cp
cpacr
Expand Down
72 changes: 72 additions & 0 deletions MISRA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# MISRA Compliance

FreeRTOS-Kernel conforms to [MISRA C:2012](https://www.misra.org.uk/misra-c)
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](#misra-configuration) contains project
wide deviations.

### Suppressed with Coverity Comments
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
```

#### Rule 8.4

_Ref 8.4.1_

- MISRA C:2012 Rule 8.4: A compatible declaration shall be visible when an
object or function with external linkage is defined.
This rule requires that a compatible declaration is made available
in a header file when an object with external linkage is defined.
pxCurrentTCB(s) is defined with external linkage but it is only
referenced from the assembly code in the port files. Therefore, adding
a declaration in header file is not useful as the assembly code will
still need to declare it separately.

### MISRA configuration

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."
},
{
deviation: "Rule 11.5",
reason: "Allow casts from `void *`. List owner, pvOwner, is stored as `void *` and are cast to various types for use in functions."
}
]
}
```
47 changes: 42 additions & 5 deletions include/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
* \ingroup Tasks
*/
struct tskTaskControlBlock; /* The old naming convention is used to prevent breaking kernel aware debuggers. */
typedef struct tskTaskControlBlock * TaskHandle_t;
typedef struct tskTaskControlBlock * TaskHandle_t;
typedef const struct tskTaskControlBlock * ConstTaskHandle_t;

/*
* Defines the prototype to which the application task hook function must
Expand Down Expand Up @@ -193,7 +194,7 @@ typedef enum
*
* \ingroup TaskUtils
*/
#define tskNO_AFFINITY ( ( UBaseType_t ) -1U )
#define tskNO_AFFINITY ( ( UBaseType_t ) -1 )

/**
* task. h
Expand Down Expand Up @@ -271,7 +272,7 @@ typedef enum
#define taskSCHEDULER_RUNNING ( ( BaseType_t ) 2 )

/* Checks if core ID is valid. */
#define taskVALID_CORE_ID( xCoreID ) ( ( BaseType_t ) ( ( 0 <= xCoreID ) && ( xCoreID < configNUMBER_OF_CORES ) ) )
#define taskVALID_CORE_ID( xCoreID ) ( ( ( ( ( BaseType_t ) 0 <= ( xCoreID ) ) && ( ( xCoreID ) < ( BaseType_t ) configNUMBER_OF_CORES ) ) ) ? ( pdTRUE ) : ( pdFALSE ) )

/*-----------------------------------------------------------
* TASK CREATION API
Expand Down Expand Up @@ -746,7 +747,7 @@ typedef enum
* \defgroup vTaskAllocateMPURegions vTaskAllocateMPURegions
* \ingroup Tasks
*/
void vTaskAllocateMPURegions( TaskHandle_t xTask,
void vTaskAllocateMPURegions( TaskHandle_t xTaskToModify,
const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION;

/**
Expand Down Expand Up @@ -1363,7 +1364,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
* }
* }
*/
UBaseType_t vTaskCoreAffinityGet( const TaskHandle_t xTask );
UBaseType_t vTaskCoreAffinityGet( ConstTaskHandle_t xTask );
#endif

#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
Expand Down Expand Up @@ -3418,6 +3419,42 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNC
*/
void vTaskYieldWithinAPI( void );

/*
* This function is only intended for use when implementing a port of the scheduler
* and is only available when portCRITICAL_NESTING_IN_TCB is set to 1 or configNUMBER_OF_CORES
* is greater than 1. This function can be used in the implementation of portENTER_CRITICAL
* if port wants to maintain critical nesting count in TCB in single core FreeRTOS.
* It should be used in the implementation of portENTER_CRITICAL if port is running a
* multiple core FreeRTOS.
*/
void vTaskEnterCritical( void );

/*
* This function is only intended for use when implementing a port of the scheduler
* and is only available when portCRITICAL_NESTING_IN_TCB is set to 1 or configNUMBER_OF_CORES
* is greater than 1. This function can be used in the implementation of portEXIT_CRITICAL
* if port wants to maintain critical nesting count in TCB in single core FreeRTOS.
* It should be used in the implementation of portEXIT_CRITICAL if port is running a
* multiple core FreeRTOS.
*/
void vTaskExitCritical( void );

/*
* This function is only intended for use when implementing a port of the scheduler
* and is only available when configNUMBER_OF_CORES is greater than 1. This function
* should be used in the implementation of portENTER_CRITICAL_FROM_ISR if port is
* running a multiple core FreeRTOS.
*/
portBASE_TYPE vTaskEnterCriticalFromISR( void );

/*
* This function is only intended for use when implementing a port of the scheduler
* and is only available when configNUMBER_OF_CORES is greater than 1. This function
* should be used in the implementation of portEXIT_CRITICAL_FROM_ISR if port is
* running a multiple core FreeRTOS.
*/
void vTaskExitCriticalFromISR( portBASE_TYPE xSavedInterruptStatus );

/* *INDENT-OFF* */
#ifdef __cplusplus
}
Expand Down
Loading