Merge branch 'main' into docs-fix-pr-process-typo

This commit is contained in:
xuh0923 2026-07-21 11:45:06 +08:00 • committed by GitHub
commit b382587894
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 296 additions and 59 deletions

View file

@ -369,6 +369,9 @@ BaseType_t MPU_xTimerGenericCommandFromISR( TimerHandle_t xTimer,
BaseType_t * const pxHigherPriorityTaskWoken, BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTimerDelete( TimerHandle_t xTimer,
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
/* MPU versions of event_group.h API functions. */ /* MPU versions of event_group.h API functions. */
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
const EventBits_t uxBitsToWaitFor, const EventBits_t uxBitsToWaitFor,

View file

@ -190,6 +190,7 @@
#define xTimerCreateStatic MPU_xTimerCreateStatic #define xTimerCreateStatic MPU_xTimerCreateStatic
#define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer #define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer
#define xTimerGenericCommandFromISR MPU_xTimerGenericCommandFromISR #define xTimerGenericCommandFromISR MPU_xTimerGenericCommandFromISR
#define xTimerDelete MPU_xTimerDelete
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
/* Map standard event_group.h API functions to the MPU equivalents. */ /* Map standard event_group.h API functions to the MPU equivalents. */

View file

@ -548,6 +548,14 @@ typedef enum
* The function parameters define the memory regions and associated access * The function parameters define the memory regions and associated access
* permissions allocated to the task. * permissions allocated to the task.
* *
* The parameter macros used in MemoryRegion_t.ulParameters are port specific.
* Some ports, including the Cortex-M3/4 MPU ports, use the portMPU_REGION_*
* values shown below.
* ARMv8-M MPU ports, such as CM23, CM33, CM52, CM55, CM85 and STAR_MC3, use
* the tskMPU_REGION_* values defined in this header; the port translates them
* into MPU register settings. Check the selected port's headers before selecting
* the region parameter macros.
*
* See xTaskCreateRestrictedStatic() for a version that does not use any * See xTaskCreateRestrictedStatic() for a version that does not use any
* dynamic memory allocation. * dynamic memory allocation.
* *
@ -639,6 +647,14 @@ typedef enum
* xTaskCreateRestrictedStatic() therefore allows a memory protected task to be * xTaskCreateRestrictedStatic() therefore allows a memory protected task to be
* created without using any dynamic memory allocation. * created without using any dynamic memory allocation.
* *
* The parameter macros used in MemoryRegion_t.ulParameters are port specific.
* Some ports, including the Cortex-M3/4 MPU ports, use the portMPU_REGION_*
* values shown below.
* ARMv8-M MPU ports, such as CM23, CM33, CM52, CM55, CM85 and STAR_MC3, use
* the tskMPU_REGION_* values defined in this header; the port translates them
* into MPU register settings. Check the selected port's headers before selecting
* the region parameter macros.
*
* @param pxTaskDefinition Pointer to a structure that contains a member * @param pxTaskDefinition Pointer to a structure that contains a member
* for each of the normal xTaskCreate() parameters (see the xTaskCreate() API * for each of the normal xTaskCreate() parameters (see the xTaskCreate() API
* documentation) plus an optional stack buffer and the memory region * documentation) plus an optional stack buffer and the memory region
@ -728,6 +744,14 @@ typedef enum
* @param[in] pxRegions A pointer to a MemoryRegion_t structure that contains the * @param[in] pxRegions A pointer to a MemoryRegion_t structure that contains the
* new memory region definitions. * new memory region definitions.
* *
* The parameter macros used in MemoryRegion_t.ulParameters are port specific.
* Some ports, including the Cortex-M3/4 MPU ports, use the portMPU_REGION_*
* values shown below.
* ARMv8-M MPU ports, such as CM23, CM33, CM52, CM55, CM85 and STAR_MC3, use
* the tskMPU_REGION_* values defined in this header; the port translates them
* into MPU register settings. Check the selected port's headers before selecting
* the region parameter macros.
*
* Example usage: * Example usage:
* @code{c} * @code{c}
* // Define an array of MemoryRegion_t structures that configures an MPU region * // Define an array of MemoryRegion_t structures that configures an MPU region

View file

@ -667,8 +667,13 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
* *
* See the xTimerChangePeriod() API function example usage scenario. * See the xTimerChangePeriod() API function example usage scenario.
*/ */
#define xTimerDelete( xTimer, xTicksToWait ) \ #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
BaseType_t xTimerDelete( TimerHandle_t xTimer,
TickType_t xTicksToWait );
#else
#define xTimerDelete( xTimer, xTicksToWait ) \
xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xTicksToWait ) ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xTicksToWait ) )
#endif
/** /**
* BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xTicksToWait ); * BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xTicksToWait );

View file

@ -47,6 +47,12 @@
#error Cortex-M23 does not have a Floating Point Unit (FPU) and therefore configENABLE_FPU must be set to 0. #error Cortex-M23 does not have a Floating Point Unit (FPU) and therefore configENABLE_FPU must be set to 0.
#endif #endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -590,15 +596,16 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " adds r2, r2, %0 \n" /* r2 = r2 + SECURE_CONTEXT_OFFSET. */
" ldr r1, [r2] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" bne free_secure_context \n" /* Branch if r1 != 0. */ " bne free_secure_context \n" /* Branch if r1 != 0. */
" bx lr \n" /* There is no secure context (xSecureContext is NULL). */ " bx lr \n" /* There is no secure context (xSecureContext is NULL). */
" free_secure_context: \n" " free_secure_context: \n"
" svc %0 \n" /* Secure context is freed in the supervisor call. */ " svc %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */ * header files. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " ldr r1, [r2, %0] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" it ne \n" " it ne \n"
" svcne %0 \n" /* Secure context is freed in the supervisor call. */ " svcne %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -40,6 +40,12 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
@ -512,8 +518,9 @@ SVC_Handler:
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
vPortFreeSecureContext: vPortFreeSecureContext:
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ adds r2, r2, #SECURE_CONTEXT_OFFSET /* r2 = r2 + SECURE_CONTEXT_OFFSET. */
ldr r1, [r2] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
bne free_secure_context /* Branch if r1 != 0. */ bne free_secure_context /* Branch if r1 != 0. */
bx lr /* There is no secure context (xSecureContext is NULL). */ bx lr /* There is no secure context (xSecureContext is NULL). */

View file

@ -41,6 +41,16 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext: vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */ /* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ ldr r1, [r2, #SECURE_CONTEXT_OFFSET] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
it ne it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */

View file

@ -3890,6 +3890,40 @@
#endif /* if ( configUSE_TIMERS == 1 ) */ #endif /* if ( configUSE_TIMERS == 1 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configUSE_TIMERS == 1 )
BaseType_t MPU_xTimerDelete( TimerHandle_t xTimer, TickType_t xTicksToWait ) /* PRIVILEGED_FUNCTION */
{
BaseType_t xReturn = pdFALSE;
TimerHandle_t xInternalTimerHandle = NULL;
int32_t lIndex;
lIndex = ( int32_t ) xTimer;
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
{
xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
if( xInternalTimerHandle != NULL )
{
xReturn = xTimerGenericCommandFromTask( xInternalTimerHandle,
tmrCOMMAND_DELETE,
0U, /* xOptionalValue */
NULL, /* pxHigherPriorityTaskWoken */
xTicksToWait );
if( xReturn != pdFALSE )
{
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
}
}
}
return xReturn;
}
#endif /* if ( configUSE_TIMERS == 1 ) */
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* MPU wrappers for event group APIs. */ /* MPU wrappers for event group APIs. */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -47,6 +47,12 @@
#error Cortex-M23 does not have a Floating Point Unit (FPU) and therefore configENABLE_FPU must be set to 0. #error Cortex-M23 does not have a Floating Point Unit (FPU) and therefore configENABLE_FPU must be set to 0.
#endif #endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -590,15 +596,16 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " adds r2, r2, %0 \n" /* r2 = r2 + SECURE_CONTEXT_OFFSET. */
" ldr r1, [r2] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" bne free_secure_context \n" /* Branch if r1 != 0. */ " bne free_secure_context \n" /* Branch if r1 != 0. */
" bx lr \n" /* There is no secure context (xSecureContext is NULL). */ " bx lr \n" /* There is no secure context (xSecureContext is NULL). */
" free_secure_context: \n" " free_secure_context: \n"
" svc %0 \n" /* Secure context is freed in the supervisor call. */ " svc %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */ * header files. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " ldr r1, [r2, %0] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" it ne \n" " it ne \n"
" svcne %0 \n" /* Secure context is freed in the supervisor call. */ " svcne %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */ * header files. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " ldr r1, [r2, %0] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" it ne \n" " it ne \n"
" svcne %0 \n" /* Secure context is freed in the supervisor call. */ " svcne %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */ * header files. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " ldr r1, [r2, %0] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" it ne \n" " it ne \n"
" svcne %0 \n" /* Secure context is freed in the supervisor call. */ " svcne %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */ * header files. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " ldr r1, [r2, %0] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" it ne \n" " it ne \n"
" svcne %0 \n" /* Secure context is freed in the supervisor call. */ " svcne %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */ * header files. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " ldr r1, [r2, %0] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" it ne \n" " it ne \n"
" svcne %0 \n" /* Secure context is freed in the supervisor call. */ " svcne %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */ * header files. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 ) #if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
( (
" .syntax unified \n" " .syntax unified \n"
" \n" " \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */ " ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */ " ldr r1, [r2, %0] \n" /* Read xSecureContext from the task's context. */
" cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */ " cmp r1, #0 \n" /* Raise svc if task's xSecureContext is not NULL. */
" it ne \n" " it ne \n"
" svcne %0 \n" /* Secure context is freed in the supervisor call. */ " svcne %1 \n" /* Secure context is freed in the supervisor call. */
" bx lr \n" /* Return. */ " bx lr \n" /* Return. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory" ::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -40,6 +40,12 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
@ -512,8 +518,9 @@ SVC_Handler:
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
vPortFreeSecureContext: vPortFreeSecureContext:
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ adds r2, r2, #SECURE_CONTEXT_OFFSET /* r2 = r2 + SECURE_CONTEXT_OFFSET. */
ldr r1, [r2] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
bne free_secure_context /* Branch if r1 != 0. */ bne free_secure_context /* Branch if r1 != 0. */
bx lr /* There is no secure context (xSecureContext is NULL). */ bx lr /* There is no secure context (xSecureContext is NULL). */

View file

@ -41,6 +41,16 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext: vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */ /* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ ldr r1, [r2, #SECURE_CONTEXT_OFFSET] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
it ne it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */

View file

@ -41,6 +41,16 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext: vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */ /* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ ldr r1, [r2, #SECURE_CONTEXT_OFFSET] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
it ne it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */

View file

@ -41,6 +41,16 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext: vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */ /* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ ldr r1, [r2, #SECURE_CONTEXT_OFFSET] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
it ne it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */

View file

@ -41,6 +41,16 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext: vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */ /* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ ldr r1, [r2, #SECURE_CONTEXT_OFFSET] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
it ne it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */

View file

@ -41,6 +41,16 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext: vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */ /* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ ldr r1, [r2, #SECURE_CONTEXT_OFFSET] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
it ne it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */

View file

@ -41,6 +41,16 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
#define configUSE_MPU_WRAPPERS_V1 0 #define configUSE_MPU_WRAPPERS_V1 0
#endif #endif
#if ( configENABLE_MPU == 1 )
#if ( configENABLE_PAC == 1 )
#define SECURE_CONTEXT_OFFSET -36
#else
#define SECURE_CONTEXT_OFFSET -20
#endif
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB EXTERN pxCurrentTCB
EXTERN xSecureContext EXTERN xSecureContext
EXTERN vTaskSwitchContext EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext: vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */ /* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */ ldr r2, [r0] /* The first item in the TCB is the stored context location. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */ ldr r1, [r2, #SECURE_CONTEXT_OFFSET] /* Read xSecureContext from the task's context. */
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */ cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
it ne it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */ svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */

View file

@ -2261,6 +2261,8 @@ void vQueueDelete( QueueHandle_t xQueue )
traceENTER_vQueueDelete( xQueue ); traceENTER_vQueueDelete( xQueue );
configASSERT( pxQueue ); configASSERT( pxQueue );
configASSERT( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) );
configASSERT( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) );
traceQUEUE_DELETE( pxQueue ); traceQUEUE_DELETE( pxQueue );
#if ( configQUEUE_REGISTRY_SIZE > 0 ) #if ( configQUEUE_REGISTRY_SIZE > 0 )

View file

@ -5035,11 +5035,11 @@ BaseType_t xTaskIncrementTick( void )
traceENTER_xTaskGetApplicationTaskTag( xTask ); traceENTER_xTaskGetApplicationTaskTag( xTask );
/* If xTask is NULL then set the calling task's hook. */ /* If xTask is NULL then get the calling task's hook. */
pxTCB = prvGetTCBFromHandle( xTask ); pxTCB = prvGetTCBFromHandle( xTask );
configASSERT( pxTCB != NULL ); configASSERT( pxTCB != NULL );
/* Save the hook function in the TCB. A critical section is required as /* Access the hook function in the TCB. A critical section is required as
* the value can be accessed from an interrupt. */ * the value can be accessed from an interrupt. */
taskENTER_CRITICAL(); taskENTER_CRITICAL();
{ {
@ -5065,11 +5065,11 @@ BaseType_t xTaskIncrementTick( void )
traceENTER_xTaskGetApplicationTaskTagFromISR( xTask ); traceENTER_xTaskGetApplicationTaskTagFromISR( xTask );
/* If xTask is NULL then set the calling task's hook. */ /* If xTask is NULL then get the calling task's hook. */
pxTCB = prvGetTCBFromHandle( xTask ); pxTCB = prvGetTCBFromHandle( xTask );
configASSERT( pxTCB != NULL ); configASSERT( pxTCB != NULL );
/* Save the hook function in the TCB. A critical section is required as /* Access the hook function in the TCB. A critical section is required as
* the value can be accessed from an interrupt. */ * the value can be accessed from an interrupt. */
/* MISRA Ref 4.7.1 [Return value shall be checked] */ /* MISRA Ref 4.7.1 [Return value shall be checked] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#dir-47 */ /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#dir-47 */