Merge branch 'main' into docs-fix-iar-swi-handler-comments

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

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.
#endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -590,15 +596,16 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" bne free_secure_context \n" /* Branch if r1 != 0. */
" bx lr \n" /* There is no secure context (xSecureContext is NULL). */
" 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. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
);
}
/*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */
#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 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" 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. */
::"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
#endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB
EXTERN xSecureContext
@ -512,8 +518,9 @@ SVC_Handler:
/*-----------------------------------------------------------*/
vPortFreeSecureContext:
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
bne free_secure_context /* Branch if r1 != 0. */
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
#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 xSecureContext
EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
it ne
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 ) */
/*-----------------------------------------------------------*/
#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. */
/*-----------------------------------------------------------*/

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.
#endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
#if ( configENABLE_MPU == 1 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -590,15 +596,16 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" bne free_secure_context \n" /* Branch if r1 != 0. */
" bx lr \n" /* There is no secure context (xSecureContext is NULL). */
" 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. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
);
}
/*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */
#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 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" 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. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
);
}
/*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */
#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 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" 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. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
);
}
/*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */
#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 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" 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. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
);
}
/*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */
#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 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" 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. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
);
}
/*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */
#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 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" 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. */
::"i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
::"i" ( SECURE_CONTEXT_OFFSET ), "i" ( portSVC_FREE_SECURE_CONTEXT ) : "memory"
);
}
/*-----------------------------------------------------------*/

View file

@ -45,6 +45,16 @@
* header files. */
#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 )
void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
@ -609,13 +619,13 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
(
" .syntax unified \n"
" \n"
" ldr r2, [r0] \n" /* The first item in the TCB is the top of the stack. */
" ldr r1, [r2] \n" /* The first item on the stack is the task's xSecureContext. */
" ldr r2, [r0] \n" /* The first item in the TCB is the stored context location. */
" 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. */
" 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. */
::"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
#endif
#if ( configENABLE_MPU == 1 )
#define SECURE_CONTEXT_OFFSET -20
#else
#define SECURE_CONTEXT_OFFSET 0
#endif
EXTERN pxCurrentTCB
EXTERN xSecureContext
@ -512,8 +518,9 @@ SVC_Handler:
/*-----------------------------------------------------------*/
vPortFreeSecureContext:
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
bne free_secure_context /* Branch if r1 != 0. */
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
#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 xSecureContext
EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
it ne
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
#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 xSecureContext
EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
it ne
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
#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 xSecureContext
EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
it ne
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
#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 xSecureContext
EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
it ne
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
#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 xSecureContext
EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
it ne
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
#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 xSecureContext
EXTERN vTaskSwitchContext
@ -532,8 +542,8 @@ SVC_Handler:
vPortFreeSecureContext:
/* r0 = uint32_t *pulTCB. */
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
ldr r2, [r0] /* The first item in the TCB is the stored context location. */
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. */
it ne
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */