Skip to content

Commit 3f24cde

Browse files
Merge branch 'main' into armv8-1-m-add-pacbti-support
2 parents ef388c1 + a49c35b commit 3f24cde

File tree

50 files changed

+275
-6503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+275
-6503
lines changed

.github/third_party_tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ team.
1111
| Tool | Website | Getting Started |
1212
|------|---------|-----------------|
1313
| Code Sonar | [Link](https://codesecure.com/our-products/codesonar/) | [Link](https://github.com/CodeSecure-SE/FreeRTOS-Kernel/blob/main/examples/codesonar/README.md) |
14-
| Coverity | [Link](https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html) | [Link](../examples/coverity/README.md) |
14+
| Coverity | [Link](https://www.blackduck.com/static-analysis-tools-sast/coverity.html) | [Link](../examples/coverity/README.md) |

examples/coverity/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MISRA Compliance for FreeRTOS-Kernel
22
FreeRTOS-Kernel is MISRA C:2012 compliant. This directory contains a project to
3-
run [Synopsys Coverity](https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html)
3+
run [Synopsys Coverity](https://www.blackduck.com/static-analysis-tools-sast/coverity.html)
44
for checking MISRA compliance.
55

66
> **Note**

include/mpu_prototypes.h

Lines changed: 156 additions & 59 deletions
Large diffs are not rendered by default.

include/mpu_wrappers.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@
8585
/* Privileged only wrappers for Task APIs. These are needed so that
8686
* the application can use opaque handles maintained in mpu_wrappers.c
8787
* with all the APIs. */
88+
#if ( configUSE_MPU_WRAPPERS_V1 == 1 )
89+
90+
/* These are not needed in v2 because they do not take a task
91+
* handle and therefore, no lookup is needed. Needed in v1 because
92+
* these are available as system calls in v1. */
93+
#define vTaskGetRunTimeStatistics MPU_vTaskGetRunTimeStatistics
94+
#define vTaskListTasks MPU_vTaskListTasks
95+
#define vTaskSuspendAll MPU_vTaskSuspendAll
96+
#define xTaskCatchUpTicks MPU_xTaskCatchUpTicks
97+
#define xTaskResumeAll MPU_xTaskResumeAll
98+
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
99+
88100
#define xTaskCreate MPU_xTaskCreate
89101
#define xTaskCreateStatic MPU_xTaskCreateStatic
90102
#define vTaskDelete MPU_vTaskDelete
@@ -165,11 +177,14 @@
165177
#define xTimerGetPeriod MPU_xTimerGetPeriod
166178
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
167179

180+
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
181+
#define xTimerGetReloadMode MPU_xTimerGetReloadMode
182+
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
183+
168184
/* Privileged only wrappers for Timer APIs. These are needed so that
169185
* the application can use opaque handles maintained in mpu_wrappers.c
170186
* with all the APIs. */
171187
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
172-
#define xTimerGetReloadMode MPU_xTimerGetReloadMode
173188
#define xTimerCreate MPU_xTimerCreate
174189
#define xTimerCreateStatic MPU_xTimerCreateStatic
175190
#define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer

include/portable.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@
8585
#define portARCH_NAME NULL
8686
#endif
8787

88+
#ifndef portBASE_TYPE_ENTER_CRITICAL
89+
#define portBASE_TYPE_ENTER_CRITICAL() taskENTER_CRITICAL()
90+
#endif
91+
92+
#ifndef portBASE_TYPE_EXIT_CRITICAL
93+
#define portBASE_TYPE_EXIT_CRITICAL() taskEXIT_CRITICAL()
94+
#endif
95+
8896
#ifndef configSTACK_DEPTH_TYPE
8997
#define configSTACK_DEPTH_TYPE StackType_t
9098
#endif

portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portmacro.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@
5757
#define portDONT_DISCARD __root
5858
/*-----------------------------------------------------------*/
5959

60-
#if ( configTOTAL_MPU_REGIONS == 16 )
61-
#error 16 MPU regions are not yet supported for this port.
62-
#endif
63-
/*-----------------------------------------------------------*/
64-
6560
/* ARMv8-M common port configurations. */
6661
#include "portmacrocommon.h"
6762
/*-----------------------------------------------------------*/

portable/ARMv8M/non_secure/portable/IAR/ARM_CM33_NTZ/portmacro.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,11 @@
6161
#include "portmacrocommon.h"
6262
/*-----------------------------------------------------------*/
6363

64-
#if ( configTOTAL_MPU_REGIONS == 16 )
65-
#error 16 MPU regions are not yet supported for this port.
66-
#endif
67-
6864
#ifndef configENABLE_MVE
6965
#define configENABLE_MVE 0
7066
#elif( configENABLE_MVE != 0 )
7167
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
7268
#endif
73-
7469
/*-----------------------------------------------------------*/
7570

7671
/**

portable/ARMv8M/non_secure/portable/IAR/ARM_CM35P/portmacro.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@
6161
#include "portmacrocommon.h"
6262
/*-----------------------------------------------------------*/
6363

64-
#if ( configTOTAL_MPU_REGIONS == 16 )
65-
#error 16 MPU regions are not yet supported for this port.
66-
#endif
67-
6864
#ifndef configENABLE_MVE
6965
#define configENABLE_MVE 0
7066
#elif( configENABLE_MVE != 0 )

portable/ARMv8M/non_secure/portable/IAR/ARM_CM55/portmacro.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@
6666
#include "portmacrocommon.h"
6767
/*-----------------------------------------------------------*/
6868

69-
#if ( configTOTAL_MPU_REGIONS == 16 )
70-
#error 16 MPU regions are not yet supported for this port.
71-
#endif
72-
/*-----------------------------------------------------------*/
73-
7469
/**
7570
* @brief Critical section management.
7671
*/

portable/ARMv8M/non_secure/portable/IAR/ARM_CM85/portmacro.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@
6666
#include "portmacrocommon.h"
6767
/*-----------------------------------------------------------*/
6868

69-
#if ( configTOTAL_MPU_REGIONS == 16 )
70-
#error 16 MPU regions are not yet supported for this port.
71-
#endif
72-
/*-----------------------------------------------------------*/
73-
7469
/**
7570
* @brief Critical section management.
7671
*/

portable/Common/mpu_wrappers.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,44 +508,46 @@
508508
/*-----------------------------------------------------------*/
509509

510510
#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
511-
void MPU_vTaskList( char * pcWriteBuffer ) /* FREERTOS_SYSTEM_CALL */
511+
void MPU_vTaskListTasks( char * pcWriteBuffer,
512+
size_t uxBufferLength ) /* FREERTOS_SYSTEM_CALL */
512513
{
513514
if( portIS_PRIVILEGED() == pdFALSE )
514515
{
515516
portRAISE_PRIVILEGE();
516517
portMEMORY_BARRIER();
517518

518-
vTaskList( pcWriteBuffer );
519+
vTaskListTasks( pcWriteBuffer, uxBufferLength );
519520
portMEMORY_BARRIER();
520521

521522
portRESET_PRIVILEGE();
522523
portMEMORY_BARRIER();
523524
}
524525
else
525526
{
526-
vTaskList( pcWriteBuffer );
527+
vTaskListTasks( pcWriteBuffer, uxBufferLength );
527528
}
528529
}
529530
#endif /* if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */
530531
/*-----------------------------------------------------------*/
531532

532533
#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
533-
void MPU_vTaskGetRunTimeStats( char * pcWriteBuffer ) /* FREERTOS_SYSTEM_CALL */
534+
void MPU_vTaskGetRunTimeStatistics( char * pcWriteBuffer,
535+
size_t uxBufferLength ) /* FREERTOS_SYSTEM_CALL */
534536
{
535537
if( portIS_PRIVILEGED() == pdFALSE )
536538
{
537539
portRAISE_PRIVILEGE();
538540
portMEMORY_BARRIER();
539541

540-
vTaskGetRunTimeStats( pcWriteBuffer );
542+
vTaskGetRunTimeStatistics( pcWriteBuffer, uxBufferLength );
541543
portMEMORY_BARRIER();
542544

543545
portRESET_PRIVILEGE();
544546
portMEMORY_BARRIER();
545547
}
546548
else
547549
{
548-
vTaskGetRunTimeStats( pcWriteBuffer );
550+
vTaskGetRunTimeStatistics( pcWriteBuffer, uxBufferLength );
549551
}
550552
}
551553
#endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */

portable/GCC/ARM_CM3/port.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ static void prvTaskExitError( void )
228228
void vPortSVCHandler( void )
229229
{
230230
__asm volatile (
231-
" ldr r3, pxCurrentTCBConst2 \n" /* Restore the context. */
232-
" ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */
231+
" ldr r3, =pxCurrentTCB \n" /* Restore the context. */
232+
" ldr r1, [r3] \n" /* Get the pxCurrentTCB address. */
233233
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
234234
" ldmia r0!, {r4-r11} \n" /* Pop the registers that are not automatically saved on exception entry and the critical nesting count. */
235235
" msr psp, r0 \n" /* Restore the task stack pointer. */
@@ -239,8 +239,7 @@ void vPortSVCHandler( void )
239239
" orr r14, #0xd \n"
240240
" bx r14 \n"
241241
" \n"
242-
" .align 4 \n"
243-
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
242+
" .ltorg \n"
244243
);
245244
}
246245
/*-----------------------------------------------------------*/
@@ -462,7 +461,7 @@ void xPortPendSVHandler( void )
462461
" mrs r0, psp \n"
463462
" isb \n"
464463
" \n"
465-
" ldr r3, pxCurrentTCBConst \n" /* Get the location of the current TCB. */
464+
" ldr r3, =pxCurrentTCB \n" /* Get the location of the current TCB. */
466465
" ldr r2, [r3] \n"
467466
" \n"
468467
" stmdb r0!, {r4-r11} \n" /* Save the remaining registers. */
@@ -483,8 +482,7 @@ void xPortPendSVHandler( void )
483482
" isb \n"
484483
" bx r14 \n"
485484
" \n"
486-
" .align 4 \n"
487-
"pxCurrentTCBConst: .word pxCurrentTCB \n"
485+
" .ltorg \n"
488486
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
489487
);
490488
}

portable/GCC/ARM_CM3_MPU/port.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ static void prvRestoreContextOfFirstTask( void )
695695
" msr msp, r0 \n" /* Set the msp back to the start of the stack. */
696696
" \n"
697697
/*------------ Program MPU. ------------ */
698-
" ldr r3, pxCurrentTCBConst2 \n" /* r3 = pxCurrentTCBConst2. */
698+
" ldr r3, =pxCurrentTCB \n" /* r3 = =pxCurrentTCB. */
699699
" ldr r2, [r3] \n" /* r2 = pxCurrentTCB. */
700700
" add r2, r2, #4 \n" /* r2 = Second item in the TCB which is xMPUSettings. */
701701
" \n"
@@ -716,7 +716,7 @@ static void prvRestoreContextOfFirstTask( void )
716716
" dsb \n" /* Force memory writes before continuing. */
717717
" \n"
718718
/*---------- Restore Context. ---------- */
719-
" ldr r3, pxCurrentTCBConst2 \n" /* r3 = pxCurrentTCBConst2. */
719+
" ldr r3, =pxCurrentTCB \n" /* r3 = =pxCurrentTCB. */
720720
" ldr r2, [r3] \n" /* r2 = pxCurrentTCB. */
721721
" ldr r1, [r2] \n" /* r1 = Location of saved context in TCB. */
722722
" \n"
@@ -732,8 +732,6 @@ static void prvRestoreContextOfFirstTask( void )
732732
" bx lr \n"
733733
" \n"
734734
" .ltorg \n" /* Assemble current literal pool to avoid offset-out-of-bound errors with lto. */
735-
" .align 4 \n"
736-
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
737735
);
738736
}
739737
/*-----------------------------------------------------------*/
@@ -988,7 +986,7 @@ void xPortPendSVHandler( void )
988986

989987
__asm volatile
990988
(
991-
" ldr r3, pxCurrentTCBConst \n" /* r3 = pxCurrentTCBConst. */
989+
" ldr r3, =pxCurrentTCB \n" /* r3 = =pxCurrentTCB. */
992990
" ldr r2, [r3] \n" /* r2 = pxCurrentTCB. */
993991
" ldr r1, [r2] \n" /* r1 = Location where the context should be saved. */
994992
" \n"
@@ -1012,7 +1010,7 @@ void xPortPendSVHandler( void )
10121010
" msr basepri, r0 \n"
10131011
" \n"
10141012
/*------------ Program MPU. ------------ */
1015-
" ldr r3, pxCurrentTCBConst \n" /* r3 = pxCurrentTCBConst. */
1013+
" ldr r3, =pxCurrentTCB \n" /* r3 = =pxCurrentTCB. */
10161014
" ldr r2, [r3] \n" /* r2 = pxCurrentTCB. */
10171015
" add r2, r2, #4 \n" /* r2 = Second item in the TCB which is xMPUSettings. */
10181016
" \n"
@@ -1033,7 +1031,7 @@ void xPortPendSVHandler( void )
10331031
" dsb \n" /* Force memory writes before continuing. */
10341032
" \n"
10351033
/*---------- Restore Context. ---------- */
1036-
" ldr r3, pxCurrentTCBConst \n" /* r3 = pxCurrentTCBConst. */
1034+
" ldr r3, =pxCurrentTCB \n" /* r3 = =pxCurrentTCB. */
10371035
" ldr r2, [r3] \n" /* r2 = pxCurrentTCB. */
10381036
" ldr r1, [r2] \n" /* r1 = Location of saved context in TCB. */
10391037
" \n"
@@ -1047,8 +1045,6 @@ void xPortPendSVHandler( void )
10471045
" bx lr \n"
10481046
" \n"
10491047
" .ltorg \n" /* Assemble current literal pool to avoid offset-out-of-bound errors with lto. */
1050-
" .align 4 \n"
1051-
"pxCurrentTCBConst: .word pxCurrentTCB \n"
10521048
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
10531049
);
10541050
}
@@ -1207,8 +1203,6 @@ BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */
12071203
" movne r0, #0 \n" /* CONTROL[0]!=0. Return false to indicate that the processor is not privileged. */
12081204
" moveq r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
12091205
" bx lr \n" /* Return. */
1210-
" \n"
1211-
" .align 4 \n"
12121206
::: "r0", "memory"
12131207
);
12141208
}

portable/GCC/ARM_CM4F/port.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ static void prvTaskExitError( void )
260260
void vPortSVCHandler( void )
261261
{
262262
__asm volatile (
263-
" ldr r3, pxCurrentTCBConst2 \n" /* Restore the context. */
264-
" ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */
263+
" ldr r3, =pxCurrentTCB \n" /* Restore the context. */
264+
" ldr r1, [r3] \n" /* Get the pxCurrentTCB address. */
265265
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
266266
" ldmia r0!, {r4-r11, r14} \n" /* Pop the registers that are not automatically saved on exception entry and the critical nesting count. */
267267
" msr psp, r0 \n" /* Restore the task stack pointer. */
@@ -270,8 +270,7 @@ void vPortSVCHandler( void )
270270
" msr basepri, r0 \n"
271271
" bx r14 \n"
272272
" \n"
273-
" .align 4 \n"
274-
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
273+
" .ltorg \n"
275274
);
276275
}
277276
/*-----------------------------------------------------------*/
@@ -511,7 +510,7 @@ void xPortPendSVHandler( void )
511510
" mrs r0, psp \n"
512511
" isb \n"
513512
" \n"
514-
" ldr r3, pxCurrentTCBConst \n" /* Get the location of the current TCB. */
513+
" ldr r3, =pxCurrentTCB \n" /* Get the location of the current TCB. */
515514
" ldr r2, [r3] \n"
516515
" \n"
517516
" tst r14, #0x10 \n" /* Is the task using the FPU context? If so, push high vfp registers. */
@@ -552,8 +551,7 @@ void xPortPendSVHandler( void )
552551
" \n"
553552
" bx r14 \n"
554553
" \n"
555-
" .align 4 \n"
556-
"pxCurrentTCBConst: .word pxCurrentTCB \n"
554+
" .ltorg \n"
557555
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
558556
);
559557
}

0 commit comments

Comments
 (0)