From d3b074a01eb1b8959c7305ab69f2dd95828067c8 Mon Sep 17 00:00:00 2001 From: rus084 Date: Sun, 17 May 2026 23:36:59 +0300 Subject: [PATCH 01/16] Add affinity to IDLE tasks in SMP systems (#1415) --- examples/template_configuration/FreeRTOSConfig.h | 7 +++++++ include/FreeRTOS.h | 4 ++++ tasks.c | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/template_configuration/FreeRTOSConfig.h b/examples/template_configuration/FreeRTOSConfig.h index 7859a5c77..b8c0e7f12 100644 --- a/examples/template_configuration/FreeRTOSConfig.h +++ b/examples/template_configuration/FreeRTOSConfig.h @@ -558,6 +558,13 @@ * tskNO_AFFINITY if left undefined. */ #define configTIMER_SERVICE_TASK_CORE_AFFINITY tskNO_AFFINITY +/* When using SMP (i.e. configNUMBER_OF_CORES is greater than one), set + * configIDLE_AFFINITY to 1 to pin each Idle task to its corresponding + * core. When set to 1, Idle task N will only run on core N, using an affinity + * mask of (1 << N). Set to 0 to allow the scheduler to run Idle tasks on any + * available core. Defaults to 0 if left undefined. */ +#define configIDLE_AFFINITY 0 + /******************************************************************************/ /* ARMv8-M secure side port related definitions. ******************************/ /******************************************************************************/ diff --git a/include/FreeRTOS.h b/include/FreeRTOS.h index 63e2feb51..83fd430bd 100644 --- a/include/FreeRTOS.h +++ b/include/FreeRTOS.h @@ -377,6 +377,10 @@ #define configIDLE_SHOULD_YIELD 1 #endif +#ifndef configIDLE_AFFINITY + #define configIDLE_AFFINITY 0 +#endif + #if configMAX_TASK_NAME_LEN < 1 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h #endif diff --git a/tasks.c b/tasks.c index c596c475f..2523515cd 100644 --- a/tasks.c +++ b/tasks.c @@ -3687,8 +3687,13 @@ static BaseType_t prvCreateIdleTasks( void ) /* Assign idle task to each core before SMP scheduler is running. */ xIdleTaskHandles[ xCoreID ]->xTaskRunState = xCoreID; pxCurrentTCBs[ xCoreID ] = xIdleTaskHandles[ xCoreID ]; + #if ( ( configIDLE_AFFINITY == 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) + { + xIdleTaskHandles[ xCoreID ]->uxCoreAffinityMask = ( ( UBaseType_t ) 1U << ( UBaseType_t ) xCoreID ); + } + #endif } - #endif + #endif /* if ( configNUMBER_OF_CORES == 1 ) */ } } From b4005374c755aa120704c93e35fefacbbc156810 Mon Sep 17 00:00:00 2001 From: Maxim De Clercq Date: Tue, 26 May 2026 03:28:54 +0200 Subject: [PATCH 02/16] fix: make vPortYield weak in ARM_CRx_No_GIC port (#1414) Mark vPortYield as a weak symbol so chips with a dedicated software interrupt register can substitute their own yield trigger. Default behaviour is unchanged when no strong override is linked. Signed-off-by: Maxim De Clercq --- portable/GCC/ARM_CRx_No_GIC/portASM.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portable/GCC/ARM_CRx_No_GIC/portASM.S b/portable/GCC/ARM_CRx_No_GIC/portASM.S index de9845e0f..fe4fa4d53 100644 --- a/portable/GCC/ARM_CRx_No_GIC/portASM.S +++ b/portable/GCC/ARM_CRx_No_GIC/portASM.S @@ -50,7 +50,7 @@ .global vPortRestoreTaskContext .global vPortInitialiseFPSCR .global ulReadAPSR - .global vPortYield + .weak vPortYield .global vPortEnableInterrupts .global vPortDisableInterrupts .global ulPortSetInterruptMaskFromISR From d877cd53989eba16c5092761056e31e1dcddba2f Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Sat, 30 May 2026 08:38:02 +0530 Subject: [PATCH 03/16] Fix MPU wrapper macro mapping for ARMv8M ports (#1419) --- portable/ARMv8M/non_secure/port.c | 5 +++++ portable/ARMv8M/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM23/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM23/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM23_NTZ/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM33/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM33/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM33_NTZ/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM35P/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM35P_NTZ/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM52/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM52/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM52_NTZ/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM52_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM55/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM55/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM55_NTZ/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM85/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM85/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_CM85_NTZ/non_secure/port.c | 5 +++++ portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_STAR_MC3/non_secure/port.c | 5 +++++ portable/GCC/ARM_STAR_MC3/non_secure/portmacrocommon.h | 7 ------- portable/GCC/ARM_STAR_MC3_NTZ/non_secure/port.c | 5 +++++ portable/GCC/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM23/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM23/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM23_NTZ/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM33/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM33/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM33_NTZ/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM35P/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM35P_NTZ/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM52/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM52/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM52_NTZ/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM52_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM55/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM55/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM55_NTZ/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM85/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM85/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_CM85_NTZ/non_secure/port.c | 5 +++++ portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_STAR_MC3/non_secure/port.c | 5 +++++ portable/IAR/ARM_STAR_MC3/non_secure/portmacrocommon.h | 7 ------- portable/IAR/ARM_STAR_MC3_NTZ/non_secure/port.c | 5 +++++ portable/IAR/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h | 7 ------- 58 files changed, 145 insertions(+), 203 deletions(-) diff --git a/portable/ARMv8M/non_secure/port.c b/portable/ARMv8M/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/ARMv8M/non_secure/port.c +++ b/portable/ARMv8M/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/ARMv8M/non_secure/portmacrocommon.h b/portable/ARMv8M/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/ARMv8M/non_secure/portmacrocommon.h +++ b/portable/ARMv8M/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM23/non_secure/port.c b/portable/GCC/ARM_CM23/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM23/non_secure/port.c +++ b/portable/GCC/ARM_CM23/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM23/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM23_NTZ/non_secure/port.c b/portable/GCC/ARM_CM23_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM23_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM23_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM23_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM33/non_secure/port.c b/portable/GCC/ARM_CM33/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM33/non_secure/port.c +++ b/portable/GCC/ARM_CM33/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM33/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/port.c b/portable/GCC/ARM_CM33_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM35P/non_secure/port.c b/portable/GCC/ARM_CM35P/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM35P/non_secure/port.c +++ b/portable/GCC/ARM_CM35P/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM35P/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c b/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM35P_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM35P_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM52/non_secure/port.c b/portable/GCC/ARM_CM52/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM52/non_secure/port.c +++ b/portable/GCC/ARM_CM52/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM52/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM52/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM52/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM52/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM52_NTZ/non_secure/port.c b/portable/GCC/ARM_CM52_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM52_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM52_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM52_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM52_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM52_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM52_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM55/non_secure/port.c b/portable/GCC/ARM_CM55/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM55/non_secure/port.c +++ b/portable/GCC/ARM_CM55/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM55/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM55_NTZ/non_secure/port.c b/portable/GCC/ARM_CM55_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM55_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM55_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM55_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM85/non_secure/port.c b/portable/GCC/ARM_CM85/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM85/non_secure/port.c +++ b/portable/GCC/ARM_CM85/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM85/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_CM85_NTZ/non_secure/port.c b/portable/GCC/ARM_CM85_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_CM85_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_CM85_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM85_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_STAR_MC3/non_secure/port.c b/portable/GCC/ARM_STAR_MC3/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_STAR_MC3/non_secure/port.c +++ b/portable/GCC/ARM_STAR_MC3/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_STAR_MC3/non_secure/portmacrocommon.h b/portable/GCC/ARM_STAR_MC3/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_STAR_MC3/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_STAR_MC3/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/port.c b/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/port.c +++ b/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM23/non_secure/port.c b/portable/IAR/ARM_CM23/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM23/non_secure/port.c +++ b/portable/IAR/ARM_CM23/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM23/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM23_NTZ/non_secure/port.c b/portable/IAR/ARM_CM23_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM23_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM23_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM23_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM33/non_secure/port.c b/portable/IAR/ARM_CM33/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM33/non_secure/port.c +++ b/portable/IAR/ARM_CM33/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM33/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM33_NTZ/non_secure/port.c b/portable/IAR/ARM_CM33_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM33_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM33_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM33_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM35P/non_secure/port.c b/portable/IAR/ARM_CM35P/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM35P/non_secure/port.c +++ b/portable/IAR/ARM_CM35P/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM35P/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c b/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM35P_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM35P_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM52/non_secure/port.c b/portable/IAR/ARM_CM52/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM52/non_secure/port.c +++ b/portable/IAR/ARM_CM52/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM52/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM52/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM52/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM52/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM52_NTZ/non_secure/port.c b/portable/IAR/ARM_CM52_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM52_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM52_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM52_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM52_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM52_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM52_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM55/non_secure/port.c b/portable/IAR/ARM_CM55/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM55/non_secure/port.c +++ b/portable/IAR/ARM_CM55/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM55/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM55_NTZ/non_secure/port.c b/portable/IAR/ARM_CM55_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM55_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM55_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM55_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM85/non_secure/port.c b/portable/IAR/ARM_CM85/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM85/non_secure/port.c +++ b/portable/IAR/ARM_CM85/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM85/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_CM85_NTZ/non_secure/port.c b/portable/IAR/ARM_CM85_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_CM85_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_CM85_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_CM85_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_STAR_MC3/non_secure/port.c b/portable/IAR/ARM_STAR_MC3/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_STAR_MC3/non_secure/port.c +++ b/portable/IAR/ARM_STAR_MC3/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_STAR_MC3/non_secure/portmacrocommon.h b/portable/IAR/ARM_STAR_MC3/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_STAR_MC3/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_STAR_MC3/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** diff --git a/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/port.c b/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/port.c index 44a06555f..2bb4c1d44 100644 --- a/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/port.c +++ b/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/port.c @@ -550,6 +550,11 @@ portDONT_DISCARD void vPortSVCHandler_C( uint32_t * pulCallerStackAddress ) PRIV extern BaseType_t configWAKE_SECONDARY_CORES( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ + +/** + * @brief Configures interrupt priorities. + */ +void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) ) diff --git a/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h b/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h index 8e602a1d0..f1f19b358 100644 --- a/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h +++ b/portable/IAR/ARM_STAR_MC3_NTZ/non_secure/portmacrocommon.h @@ -30,8 +30,6 @@ #ifndef PORTMACROCOMMON_H #define PORTMACROCOMMON_H -#include "mpu_wrappers.h" - /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { @@ -153,11 +151,6 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey ); #endif /* configENABLE_PAC */ - -/** - * @brief Configures interrupt priorities. - */ -void vPortConfigureInterruptPriorities( void ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ /** From 950ab4ff916fe37998ca8453e32a62f3d4e3c59f Mon Sep 17 00:00:00 2001 From: hanzhijian Date: Sat, 6 Jun 2026 15:38:29 +0800 Subject: [PATCH 04/16] Fix incorrect #endif preprocessor comments in croutine.c and queue.c croutine.c: #if condition is ( configUSE_CO_ROUTINES != 0 ) but the #endif comment incorrectly said == 0, reversing the logic. queue.c: #if condition is ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) but the #endif comment incorrectly said configSUPPORT_STATIC_ALLOCATION, naming the wrong configuration option. These are purely cosmetic comment fixes with zero runtime impact. Signed-off-by: hanzhijian --- croutine.c | 2 +- queue.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/croutine.c b/croutine.c index 84e1b99bd..f8ab8ff87 100644 --- a/croutine.c +++ b/croutine.c @@ -402,4 +402,4 @@ } /*-----------------------------------------------------------*/ -#endif /* configUSE_CO_ROUTINES == 0 */ +#endif /* configUSE_CO_ROUTINES != 0 */ diff --git a/queue.c b/queue.c index 25613bf3f..37d953ac9 100644 --- a/queue.c +++ b/queue.c @@ -563,7 +563,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue, return pxNewQueue; } -#endif /* configSUPPORT_STATIC_ALLOCATION */ +#endif /* configSUPPORT_DYNAMIC_ALLOCATION */ /*-----------------------------------------------------------*/ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, From 97328600dbe369be3e4dfd92dea082f577d35a62 Mon Sep 17 00:00:00 2001 From: elsonwei Date: Sat, 13 Jun 2026 02:43:02 +0800 Subject: [PATCH 05/16] Fix MISRA C 2012 Rule 20.4: Replace `#define static` with STATIC macro (#1410) * Fix MISRA C 2012 Rule 20.4: Replace `#define static` with STATIC macro Replace `#define static` with `#define STATIC static` to prevent the macro from shadowing the C `static` keyword. This also ensures static variables in `vApplicationGetIdleTaskMemory()` and `vApplicationGetPassiveIdleTaskMemory()` remain static even when portREMOVE_STATIC_QUALIFIER is defined, preventing use-after-free bugs from stack-allocated storage. --- croutine.c | 36 +++++++------ tasks.c | 154 ++++++++++++++++++++++++++++------------------------- 2 files changed, 99 insertions(+), 91 deletions(-) diff --git a/croutine.c b/croutine.c index f8ab8ff87..95cbb294c 100644 --- a/croutine.c +++ b/croutine.c @@ -38,24 +38,26 @@ * than file scope. */ #ifdef portREMOVE_STATIC_QUALIFIER - #define static + #define STATIC + #else + #define STATIC static #endif /* Lists for ready and blocked co-routines. --------------------*/ - static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /**< Prioritised ready co-routines. */ - static List_t xDelayedCoRoutineList1; /**< Delayed co-routines. */ - static List_t xDelayedCoRoutineList2; /**< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */ - static List_t * pxDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used. */ - static List_t * pxOverflowDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */ - static List_t xPendingReadyCoRoutineList; /**< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */ + STATIC List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /**< Prioritised ready co-routines. */ + STATIC List_t xDelayedCoRoutineList1; /**< Delayed co-routines. */ + STATIC List_t xDelayedCoRoutineList2; /**< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */ + STATIC List_t * pxDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used. */ + STATIC List_t * pxOverflowDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */ + STATIC List_t xPendingReadyCoRoutineList; /**< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */ /* Other file private variables. --------------------------------*/ CRCB_t * pxCurrentCoRoutine = NULL; - static UBaseType_t uxTopCoRoutineReadyPriority = ( UBaseType_t ) 0U; - static TickType_t xCoRoutineTickCount = ( TickType_t ) 0U; - static TickType_t xLastTickCount = ( TickType_t ) 0U; - static TickType_t xPassedTicks = ( TickType_t ) 0U; + STATIC UBaseType_t uxTopCoRoutineReadyPriority = ( UBaseType_t ) 0U; + STATIC TickType_t xCoRoutineTickCount = ( TickType_t ) 0U; + STATIC TickType_t xLastTickCount = ( TickType_t ) 0U; + STATIC TickType_t xPassedTicks = ( TickType_t ) 0U; /* The initial state of the co-routine when it is created. */ #define corINITIAL_STATE ( 0 ) @@ -80,7 +82,7 @@ * Utility to ready all the lists used by the scheduler. This is called * automatically upon the creation of the first co-routine. */ - static void prvInitialiseCoRoutineLists( void ); + STATIC void prvInitialiseCoRoutineLists( void ); /* * Co-routines that are readied by an interrupt cannot be placed directly into @@ -88,7 +90,7 @@ * in the pending ready list in order that they can later be moved to the ready * list by the co-routine scheduler. */ - static void prvCheckPendingReadyList( void ); + STATIC void prvCheckPendingReadyList( void ); /* * Macro that looks at the list of co-routines that are currently delayed to @@ -98,7 +100,7 @@ * meaning once one co-routine has been found whose timer has not expired * we need not look any further down the list. */ - static void prvCheckDelayedList( void ); + STATIC void prvCheckDelayedList( void ); /*-----------------------------------------------------------*/ @@ -212,7 +214,7 @@ } /*-----------------------------------------------------------*/ - static void prvCheckPendingReadyList( void ) + STATIC void prvCheckPendingReadyList( void ) { /* Are there any co-routines waiting to get moved to the ready list? These * are co-routines that have been readied by an ISR. The ISR cannot access @@ -235,7 +237,7 @@ } /*-----------------------------------------------------------*/ - static void prvCheckDelayedList( void ) + STATIC void prvCheckDelayedList( void ) { CRCB_t * pxCRCB; @@ -333,7 +335,7 @@ } /*-----------------------------------------------------------*/ - static void prvInitialiseCoRoutineLists( void ) + STATIC void prvInitialiseCoRoutineLists( void ) { UBaseType_t uxPriority; diff --git a/tasks.c b/tasks.c index 2523515cd..b0299d12b 100644 --- a/tasks.c +++ b/tasks.c @@ -148,7 +148,9 @@ * global, rather than file scope. */ #ifdef portREMOVE_STATIC_QUALIFIER - #define static + #define STATIC +#else + #define STATIC static #endif /* The name allocated to the Idle task. This can be overridden by defining @@ -473,23 +475,23 @@ typedef tskTCB TCB_t; * xDelayedTaskList1 and xDelayedTaskList2 could be moved to function scope but * doing so breaks some kernel aware debuggers and debuggers that rely on removing * the static qualifier. */ -PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ]; /**< Prioritised ready tasks. */ -PRIVILEGED_DATA static List_t xDelayedTaskList1; /**< Delayed tasks. */ -PRIVILEGED_DATA static List_t xDelayedTaskList2; /**< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */ -PRIVILEGED_DATA static List_t * volatile pxDelayedTaskList; /**< Points to the delayed task list currently being used. */ -PRIVILEGED_DATA static List_t * volatile pxOverflowDelayedTaskList; /**< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */ -PRIVILEGED_DATA static List_t xPendingReadyList; /**< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */ +PRIVILEGED_DATA STATIC List_t pxReadyTasksLists[ configMAX_PRIORITIES ]; /**< Prioritised ready tasks. */ +PRIVILEGED_DATA STATIC List_t xDelayedTaskList1; /**< Delayed tasks. */ +PRIVILEGED_DATA STATIC List_t xDelayedTaskList2; /**< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */ +PRIVILEGED_DATA STATIC List_t * volatile pxDelayedTaskList; /**< Points to the delayed task list currently being used. */ +PRIVILEGED_DATA STATIC List_t * volatile pxOverflowDelayedTaskList; /**< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */ +PRIVILEGED_DATA STATIC List_t xPendingReadyList; /**< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */ #if ( INCLUDE_vTaskDelete == 1 ) - PRIVILEGED_DATA static List_t xTasksWaitingTermination; /**< Tasks that have been deleted - but their memory not yet freed. */ - PRIVILEGED_DATA static volatile UBaseType_t uxDeletedTasksWaitingCleanUp = ( UBaseType_t ) 0U; + PRIVILEGED_DATA STATIC List_t xTasksWaitingTermination; /**< Tasks that have been deleted - but their memory not yet freed. */ + PRIVILEGED_DATA STATIC volatile UBaseType_t uxDeletedTasksWaitingCleanUp = ( UBaseType_t ) 0U; #endif #if ( INCLUDE_vTaskSuspend == 1 ) - PRIVILEGED_DATA static List_t xSuspendedTaskList; /**< Tasks that are currently suspended. */ + PRIVILEGED_DATA STATIC List_t xSuspendedTaskList; /**< Tasks that are currently suspended. */ #endif @@ -500,21 +502,21 @@ PRIVILEGED_DATA static List_t xPendingReadyList; /**< Ta #endif /* Other file private variables. --------------------------------*/ -PRIVILEGED_DATA static volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U; -PRIVILEGED_DATA static volatile TickType_t xTickCount = ( TickType_t ) configINITIAL_TICK_COUNT; -PRIVILEGED_DATA static volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY; -PRIVILEGED_DATA static volatile BaseType_t xSchedulerRunning = pdFALSE; -PRIVILEGED_DATA static volatile TickType_t xPendedTicks = ( TickType_t ) 0U; -PRIVILEGED_DATA static volatile BaseType_t xYieldPendings[ configNUMBER_OF_CORES ] = { pdFALSE }; -PRIVILEGED_DATA static volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0; -PRIVILEGED_DATA static UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U; -PRIVILEGED_DATA static volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U; /* Initialised to portMAX_DELAY before the scheduler starts. */ -PRIVILEGED_DATA static TaskHandle_t xIdleTaskHandles[ configNUMBER_OF_CORES ]; /**< Holds the handles of the idle tasks. The idle tasks are created automatically when the scheduler is started. */ +PRIVILEGED_DATA STATIC volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U; +PRIVILEGED_DATA STATIC volatile TickType_t xTickCount = ( TickType_t ) configINITIAL_TICK_COUNT; +PRIVILEGED_DATA STATIC volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY; +PRIVILEGED_DATA STATIC volatile BaseType_t xSchedulerRunning = pdFALSE; +PRIVILEGED_DATA STATIC volatile TickType_t xPendedTicks = ( TickType_t ) 0U; +PRIVILEGED_DATA STATIC volatile BaseType_t xYieldPendings[ configNUMBER_OF_CORES ] = { pdFALSE }; +PRIVILEGED_DATA STATIC volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0; +PRIVILEGED_DATA STATIC UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U; +PRIVILEGED_DATA STATIC volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U; /* Initialised to portMAX_DELAY before the scheduler starts. */ +PRIVILEGED_DATA STATIC TaskHandle_t xIdleTaskHandles[ configNUMBER_OF_CORES ]; /**< Holds the handles of the idle tasks. The idle tasks are created automatically when the scheduler is started. */ /* Improve support for OpenOCD. The kernel tracks Ready tasks via priority lists. * For tracking the state of remote threads, OpenOCD uses uxTopUsedPriority * to determine the number of priority lists to read back from the remote target. */ -static const volatile UBaseType_t uxTopUsedPriority = configMAX_PRIORITIES - 1U; +STATIC const volatile UBaseType_t uxTopUsedPriority = configMAX_PRIORITIES - 1U; /* Context switches are held pending while the scheduler is suspended. Also, * interrupts must not manipulate the xStateListItem of a TCB, or any of the @@ -528,14 +530,14 @@ static const volatile UBaseType_t uxTopUsedPriority = configMAX_PRIORITIES - 1U; * Updates to uxSchedulerSuspended must be protected by both the task lock and the ISR lock * and must not be done from an ISR. Reads must be protected by either lock and may be done * from either an ISR or a task. */ -PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) 0U; +PRIVILEGED_DATA STATIC volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) 0U; #if ( configGENERATE_RUN_TIME_STATS == 1 ) /* Do not move these variables to function scope as doing so prevents the * code working with debuggers that need to remove the static qualifier. */ -PRIVILEGED_DATA static configRUN_TIME_COUNTER_TYPE ulTaskSwitchedInTime[ configNUMBER_OF_CORES ] = { 0U }; /**< Holds the value of a timer/counter the last time a task was switched in. */ -PRIVILEGED_DATA static volatile configRUN_TIME_COUNTER_TYPE ulTotalRunTime[ configNUMBER_OF_CORES ] = { 0U }; /**< Holds the total amount of execution time as defined by the run time counter clock. */ +PRIVILEGED_DATA STATIC configRUN_TIME_COUNTER_TYPE ulTaskSwitchedInTime[ configNUMBER_OF_CORES ] = { 0U }; /**< Holds the value of a timer/counter the last time a task was switched in. */ +PRIVILEGED_DATA STATIC volatile configRUN_TIME_COUNTER_TYPE ulTotalRunTime[ configNUMBER_OF_CORES ] = { 0U }; /**< Holds the total amount of execution time as defined by the run time counter clock. */ #endif @@ -546,7 +548,7 @@ PRIVILEGED_DATA static volatile configRUN_TIME_COUNTER_TYPE ulTotalRunTime[ conf /* * Creates the idle tasks during scheduler start. */ -static BaseType_t prvCreateIdleTasks( void ); +STATIC BaseType_t prvCreateIdleTasks( void ); #if ( configNUMBER_OF_CORES > 1 ) @@ -554,7 +556,7 @@ static BaseType_t prvCreateIdleTasks( void ); * Checks to see if another task moved the current task out of the ready * list while it was waiting to enter a critical section and yields, if so. */ - static void prvCheckForRunStateChange( void ); + STATIC void prvCheckForRunStateChange( void ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ #if ( configNUMBER_OF_CORES > 1 ) @@ -563,7 +565,7 @@ static BaseType_t prvCreateIdleTasks( void ); * Yields a core, or cores if multiple priorities are not allowed to run * simultaneously, to allow the task pxTCB to run. */ - static void prvYieldForTask( const TCB_t * pxTCB ); + STATIC void prvYieldForTask( const TCB_t * pxTCB ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ #if ( configNUMBER_OF_CORES > 1 ) @@ -571,7 +573,7 @@ static BaseType_t prvCreateIdleTasks( void ); /* * Selects the highest priority available task for the given core. */ - static void prvSelectHighestPriorityTask( BaseType_t xCoreID ); + STATIC void prvSelectHighestPriorityTask( BaseType_t xCoreID ); #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ /** @@ -581,7 +583,7 @@ static BaseType_t prvCreateIdleTasks( void ); */ #if ( INCLUDE_vTaskSuspend == 1 ) - static BaseType_t prvTaskIsTaskSuspended( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; + STATIC BaseType_t prvTaskIsTaskSuspended( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; #endif /* INCLUDE_vTaskSuspend */ @@ -589,7 +591,7 @@ static BaseType_t prvCreateIdleTasks( void ); * Utility to ready all the lists used by the scheduler. This is called * automatically upon the creation of the first task. */ -static void prvInitialiseTaskLists( void ) PRIVILEGED_FUNCTION; +STATIC void prvInitialiseTaskLists( void ) PRIVILEGED_FUNCTION; /* * The idle task, which as all tasks is implemented as a never ending loop. @@ -607,9 +609,11 @@ static void prvInitialiseTaskLists( void ) PRIVILEGED_FUNCTION; * void prvPassiveIdleTask( void *pvParameters ); * */ -static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION; +STATIC portTASK_FUNCTION_PROTO( prvIdleTask, + pvParameters ) PRIVILEGED_FUNCTION; #if ( configNUMBER_OF_CORES > 1 ) - static portTASK_FUNCTION_PROTO( prvPassiveIdleTask, pvParameters ) PRIVILEGED_FUNCTION; + STATIC portTASK_FUNCTION_PROTO( prvPassiveIdleTask, + pvParameters ) PRIVILEGED_FUNCTION; #endif /* @@ -621,7 +625,7 @@ static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION; */ #if ( INCLUDE_vTaskDelete == 1 ) - static void prvDeleteTCB( TCB_t * pxTCB ) PRIVILEGED_FUNCTION; + STATIC void prvDeleteTCB( TCB_t * pxTCB ) PRIVILEGED_FUNCTION; #endif @@ -630,13 +634,13 @@ static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION; * in the list of tasks waiting to be deleted. If so the task is cleaned up * and its TCB deleted. */ -static void prvCheckTasksWaitingTermination( void ) PRIVILEGED_FUNCTION; +STATIC void prvCheckTasksWaitingTermination( void ) PRIVILEGED_FUNCTION; /* * The currently executing task is entering the Blocked state. Add the task to * either the current or the overflow delayed task list. */ -static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, +STATIC void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, const BaseType_t xCanBlockIndefinitely ) PRIVILEGED_FUNCTION; /* @@ -649,7 +653,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, */ #if ( configUSE_TRACE_FACILITY == 1 ) - static UBaseType_t prvListTasksWithinSingleList( TaskStatus_t * pxTaskStatusArray, + STATIC UBaseType_t prvListTasksWithinSingleList( TaskStatus_t * pxTaskStatusArray, List_t * pxList, eTaskState eState ) PRIVILEGED_FUNCTION; @@ -661,7 +665,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, */ #if ( INCLUDE_xTaskGetHandle == 1 ) - static TCB_t * prvSearchForNameWithinSingleList( List_t * pxList, + STATIC TCB_t * prvSearchForNameWithinSingleList( List_t * pxList, const char pcNameToQuery[] ) PRIVILEGED_FUNCTION; #endif @@ -673,7 +677,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, */ #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) ) - static configSTACK_DEPTH_TYPE prvTaskCheckFreeStackSpace( const uint8_t * pucStackByte ) PRIVILEGED_FUNCTION; + STATIC configSTACK_DEPTH_TYPE prvTaskCheckFreeStackSpace( const uint8_t * pucStackByte ) PRIVILEGED_FUNCTION; #endif @@ -689,7 +693,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, */ #if ( configUSE_TICKLESS_IDLE != 0 ) - static TickType_t prvGetExpectedIdleTime( void ) PRIVILEGED_FUNCTION; + STATIC TickType_t prvGetExpectedIdleTime( void ) PRIVILEGED_FUNCTION; #endif @@ -697,7 +701,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, * Set xNextTaskUnblockTime to the time at which the next Blocked state task * will exit the Blocked state. */ -static void prvResetNextTaskUnblockTime( void ) PRIVILEGED_FUNCTION; +STATIC void prvResetNextTaskUnblockTime( void ) PRIVILEGED_FUNCTION; #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) @@ -714,7 +718,7 @@ static void prvResetNextTaskUnblockTime( void ) PRIVILEGED_FUNCTION; * Called after a Task_t structure has been allocated either statically or * dynamically to fill in the structure's members. */ -static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, +STATIC void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const configSTACK_DEPTH_TYPE uxStackDepth, void * const pvParameters, @@ -727,14 +731,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, * Called after a new task has been created and initialised to place the task * under the control of the scheduler. */ -static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; +STATIC void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; /* * Create a task with static buffer for both TCB and stack. Returns a handle to * the task if it is created successfully. Otherwise, returns NULL. */ #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) - static TCB_t * prvCreateStaticTask( TaskFunction_t pxTaskCode, + STATIC TCB_t * prvCreateStaticTask( TaskFunction_t pxTaskCode, const char * const pcName, const configSTACK_DEPTH_TYPE uxStackDepth, void * const pvParameters, @@ -749,7 +753,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; * a handle to the task if it is created successfully. Otherwise, returns NULL. */ #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) - static TCB_t * prvCreateRestrictedStaticTask( const TaskParameters_t * const pxTaskDefinition, + STATIC TCB_t * prvCreateRestrictedStaticTask( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION; #endif /* #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) */ @@ -759,7 +763,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; * returns NULL. */ #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) - static TCB_t * prvCreateRestrictedTask( const TaskParameters_t * const pxTaskDefinition, + STATIC TCB_t * prvCreateRestrictedTask( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION; #endif /* #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */ @@ -768,7 +772,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; * the task if it is created successfully. Otherwise, returns NULL. */ #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) - static TCB_t * prvCreateTask( TaskFunction_t pxTaskCode, + STATIC TCB_t * prvCreateTask( TaskFunction_t pxTaskCode, const char * const pcName, const configSTACK_DEPTH_TYPE uxStackDepth, void * const pvParameters, @@ -783,7 +787,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; */ #ifdef FREERTOS_TASKS_C_ADDITIONS_INIT - static void freertos_tasks_c_additions_init( void ) PRIVILEGED_FUNCTION; + STATIC void freertos_tasks_c_additions_init( void ) PRIVILEGED_FUNCTION; #endif @@ -813,14 +817,14 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; * and less than the supplied buffer length, the string has been * completely written. */ - static size_t prvSnprintfReturnValueToCharsWritten( int iSnprintfReturnValue, + STATIC size_t prvSnprintfReturnValueToCharsWritten( int iSnprintfReturnValue, size_t n ); #endif /* #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) ) */ /*-----------------------------------------------------------*/ #if ( configNUMBER_OF_CORES > 1 ) - static void prvCheckForRunStateChange( void ) + STATIC void prvCheckForRunStateChange( void ) { UBaseType_t uxPrevCriticalNesting; const TCB_t * pxThisTCB; @@ -888,7 +892,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( configNUMBER_OF_CORES > 1 ) - static void prvYieldForTask( const TCB_t * pxTCB ) + STATIC void prvYieldForTask( const TCB_t * pxTCB ) { BaseType_t xLowestPriorityToPreempt; BaseType_t xCurrentCoreTaskPriority; @@ -1003,7 +1007,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( configNUMBER_OF_CORES > 1 ) - static void prvSelectHighestPriorityTask( BaseType_t xCoreID ) + STATIC void prvSelectHighestPriorityTask( BaseType_t xCoreID ) { UBaseType_t uxCurrentPriority = uxTopReadyPriority; BaseType_t xTaskScheduled = pdFALSE; @@ -1274,7 +1278,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) - static TCB_t * prvCreateStaticTask( TaskFunction_t pxTaskCode, + STATIC TCB_t * prvCreateStaticTask( TaskFunction_t pxTaskCode, const char * const pcName, const configSTACK_DEPTH_TYPE uxStackDepth, void * const pvParameters, @@ -1405,7 +1409,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) - static TCB_t * prvCreateRestrictedStaticTask( const TaskParameters_t * const pxTaskDefinition, + STATIC TCB_t * prvCreateRestrictedStaticTask( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t * const pxCreatedTask ) { TCB_t * pxNewTCB; @@ -1521,7 +1525,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) - static TCB_t * prvCreateRestrictedTask( const TaskParameters_t * const pxTaskDefinition, + STATIC TCB_t * prvCreateRestrictedTask( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t * const pxCreatedTask ) { TCB_t * pxNewTCB; @@ -1640,7 +1644,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; /*-----------------------------------------------------------*/ #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) - static TCB_t * prvCreateTask( TaskFunction_t pxTaskCode, + STATIC TCB_t * prvCreateTask( TaskFunction_t pxTaskCode, const char * const pcName, const configSTACK_DEPTH_TYPE uxStackDepth, void * const pvParameters, @@ -1813,7 +1817,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ /*-----------------------------------------------------------*/ -static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, +STATIC void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const configSTACK_DEPTH_TYPE uxStackDepth, void * const pvParameters, @@ -2049,7 +2053,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, #if ( configNUMBER_OF_CORES == 1 ) - static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) + STATIC void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) { /* Ensure interrupts don't access the task lists while the lists are being * updated. */ @@ -2127,7 +2131,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, #else /* #if ( configNUMBER_OF_CORES == 1 ) */ - static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) + STATIC void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) { /* Ensure interrupts don't access the task lists while the lists are being * updated. */ @@ -2188,7 +2192,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) ) - static size_t prvSnprintfReturnValueToCharsWritten( int iSnprintfReturnValue, + STATIC size_t prvSnprintfReturnValueToCharsWritten( int iSnprintfReturnValue, size_t n ) { size_t uxCharsWritten; @@ -3320,7 +3324,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, #if ( INCLUDE_vTaskSuspend == 1 ) - static BaseType_t prvTaskIsTaskSuspended( const TaskHandle_t xTask ) + STATIC BaseType_t prvTaskIsTaskSuspended( const TaskHandle_t xTask ) { BaseType_t xReturn = pdFALSE; const TCB_t * const pxTCB = xTask; @@ -3548,7 +3552,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, #endif /* ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) ) */ /*-----------------------------------------------------------*/ -static BaseType_t prvCreateIdleTasks( void ) +STATIC BaseType_t prvCreateIdleTasks( void ) { BaseType_t xReturn = pdPASS; BaseType_t xCoreID; @@ -3962,7 +3966,7 @@ void vTaskSuspendAll( void ) #if ( configUSE_TICKLESS_IDLE != 0 ) - static TickType_t prvGetExpectedIdleTime( void ) + STATIC TickType_t prvGetExpectedIdleTime( void ) { TickType_t xReturn; BaseType_t xHigherPriorityReadyTasks = pdFALSE; @@ -4257,7 +4261,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*-----------------------------------------------------------*/ #if ( INCLUDE_xTaskGetHandle == 1 ) - static TCB_t * prvSearchForNameWithinSingleList( List_t * pxList, + STATIC TCB_t * prvSearchForNameWithinSingleList( List_t * pxList, const char pcNameToQuery[] ) { TCB_t * pxReturn = NULL; @@ -5744,7 +5748,8 @@ void vTaskMissedYield( void ) */ #if ( configNUMBER_OF_CORES > 1 ) - static portTASK_FUNCTION( prvPassiveIdleTask, pvParameters ) + STATIC portTASK_FUNCTION( prvPassiveIdleTask, + pvParameters ) { ( void ) pvParameters; @@ -5814,7 +5819,8 @@ void vTaskMissedYield( void ) * */ -static portTASK_FUNCTION( prvIdleTask, pvParameters ) +STATIC portTASK_FUNCTION( prvIdleTask, + pvParameters ) { /* Stop warnings. */ ( void ) pvParameters; @@ -6080,7 +6086,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) #endif /* portUSING_MPU_WRAPPERS */ /*-----------------------------------------------------------*/ -static void prvInitialiseTaskLists( void ) +STATIC void prvInitialiseTaskLists( void ) { UBaseType_t uxPriority; @@ -6112,7 +6118,7 @@ static void prvInitialiseTaskLists( void ) } /*-----------------------------------------------------------*/ -static void prvCheckTasksWaitingTermination( void ) +STATIC void prvCheckTasksWaitingTermination( void ) { /** THIS FUNCTION IS CALLED FROM THE RTOS IDLE TASK **/ @@ -6338,7 +6344,7 @@ static void prvCheckTasksWaitingTermination( void ) #if ( configUSE_TRACE_FACILITY == 1 ) - static UBaseType_t prvListTasksWithinSingleList( TaskStatus_t * pxTaskStatusArray, + STATIC UBaseType_t prvListTasksWithinSingleList( TaskStatus_t * pxTaskStatusArray, List_t * pxList, eTaskState eState ) { @@ -6377,7 +6383,7 @@ static void prvCheckTasksWaitingTermination( void ) #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) ) - static configSTACK_DEPTH_TYPE prvTaskCheckFreeStackSpace( const uint8_t * pucStackByte ) + STATIC configSTACK_DEPTH_TYPE prvTaskCheckFreeStackSpace( const uint8_t * pucStackByte ) { configSTACK_DEPTH_TYPE uxCount = 0U; @@ -6475,7 +6481,7 @@ static void prvCheckTasksWaitingTermination( void ) #if ( INCLUDE_vTaskDelete == 1 ) - static void prvDeleteTCB( TCB_t * pxTCB ) + STATIC void prvDeleteTCB( TCB_t * pxTCB ) { /* This call is required specifically for the TriCore port. It must be * above the vPortFree() calls. The call is also used by ports/demos that @@ -6528,7 +6534,7 @@ static void prvCheckTasksWaitingTermination( void ) #endif /* INCLUDE_vTaskDelete */ /*-----------------------------------------------------------*/ -static void prvResetNextTaskUnblockTime( void ) +STATIC void prvResetNextTaskUnblockTime( void ) { if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE ) { @@ -7276,7 +7282,7 @@ static void prvResetNextTaskUnblockTime( void ) #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) - static char * prvWriteNameToBuffer( char * pcBuffer, + STATIC char * prvWriteNameToBuffer( char * pcBuffer, const char * pcTaskName ) { size_t x; @@ -8592,7 +8598,7 @@ TickType_t uxTaskResetEventItemValue( void ) #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */ /*-----------------------------------------------------------*/ -static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, +STATIC void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, const BaseType_t xCanBlockIndefinitely ) { TickType_t xTimeToWake; @@ -8744,7 +8750,7 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, #include "freertos_tasks_c_additions.h" #ifdef FREERTOS_TASKS_C_ADDITIONS_INIT - static void freertos_tasks_c_additions_init( void ) + STATIC void freertos_tasks_c_additions_init( void ) { FREERTOS_TASKS_C_ADDITIONS_INIT(); } From d5d752a9b6a79c2b5cf2f7953c4bf80e3f35433b Mon Sep 17 00:00:00 2001 From: Archit Gupta Date: Fri, 12 Jun 2026 18:55:13 +0000 Subject: [PATCH 06/16] Fix spurious heap_5 assert when allocation search reaches end marker (#1425) When configENABLE_HEAP_PROTECTOR is 1 and a pvPortMalloc() request cannot be satisfied by any free block, the free list search advances onto the end marker (pxEnd) and validates it with heapVALIDATE_BLOCK_POINTER(). pxEnd is located at pucHeapHighAddress and is not part of the usable heap, so the macro's "( pxBlock ) < pucHeapHighAddress" bounds check fails and the configASSERT() fires on what is a normal out-of-memory condition. The code should instead fall through and call the malloc failed hook. Exclude the end marker from validation in the search loop so an allocation that cannot be satisfied returns NULL (and invokes vApplicationMallocFailedHook when configUSE_MALLOC_FAILED_HOOK is 1) without asserting. --- portable/MemMang/heap_5.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/portable/MemMang/heap_5.c b/portable/MemMang/heap_5.c index bf321304f..a54381b0c 100644 --- a/portable/MemMang/heap_5.c +++ b/portable/MemMang/heap_5.c @@ -284,7 +284,14 @@ void * pvPortMalloc( size_t xWantedSize ) { pxPreviousBlock = pxBlock; pxBlock = heapPROTECT_BLOCK_POINTER( pxBlock->pxNextFreeBlock ); - heapVALIDATE_BLOCK_POINTER( pxBlock ); + + /* pxEnd is the end marker of the free list. It is located at + * pucHeapHighAddress and is not part of the usable heap, so it + * must be excluded from the heap block pointer validation. */ + if( pxBlock != pxEnd ) + { + heapVALIDATE_BLOCK_POINTER( pxBlock ); + } } /* If the end marker was reached then a block of adequate size From 6f23624451daf895ca6e58c0639a795a787b93b1 Mon Sep 17 00:00:00 2001 From: Kody Stribrny <89810515+kstribrnAmzn@users.noreply.github.com> Date: Fri, 12 Jun 2026 12:09:00 -0700 Subject: [PATCH 07/16] Switch to 32-bit tick width to avoid windows compile warnings (#1422) Windows defines a long as a 32-bit value regardless if a 32 or 64 bit OS is used. This makes a 64-bit tick an `unsigned long long` which was introduced after C90. --- examples/template_configuration/FreeRTOSConfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/template_configuration/FreeRTOSConfig.h b/examples/template_configuration/FreeRTOSConfig.h index b8c0e7f12..4a74fe4ca 100644 --- a/examples/template_configuration/FreeRTOSConfig.h +++ b/examples/template_configuration/FreeRTOSConfig.h @@ -136,7 +136,7 @@ * * Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_64_BITS causes * TickType_t to be defined (typedef'ed) as an unsigned 64-bit type. */ -#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_64_BITS +#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS /* Set configIDLE_SHOULD_YIELD to 1 to have the Idle task yield to an * application task if there is an Idle priority (priority 0) application task From 543558ba7761df03fa1506de62e42a53416dca1e Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sat, 4 Apr 2026 17:03:22 +0530 Subject: [PATCH 08/16] stream_buffer: require batching buffers to exceed trigger level Batching stream buffers are documented to unblock receivers only after the buffered byte count exceeds the trigger level, but both xStreamBufferSend() paths currently notify as soon as the count reaches it. That equality case wakes the blocked receiver too early, causing xStreamBufferReceive() to return 0 bytes while the buffer still holds exactly trigger-level data. Route both task and ISR send paths through a shared trigger helper so batching buffers require a strict greater-than check while existing stream and message buffer semantics remain unchanged. Fixes #1375 Signed-off-by: Asish Kumar --- stream_buffer.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/stream_buffer.c b/stream_buffer.c index 287bd0736..a4c6d268d 100644 --- a/stream_buffer.c +++ b/stream_buffer.c @@ -256,6 +256,15 @@ typedef struct StreamBufferDef_t */ static size_t prvBytesInBuffer( const StreamBuffer_t * const pxStreamBuffer ) PRIVILEGED_FUNCTION; +/* + * Returns pdTRUE when the amount of buffered data should unblock a task that + * is waiting to receive data. Stream batching buffers require the buffered + * data to exceed the trigger level, whereas stream and message buffers unblock + * when the trigger level is reached. + */ +static BaseType_t prvBytesInBufferMeetTriggerLevel( const StreamBuffer_t * const pxStreamBuffer, + size_t xBytesInBuffer ) PRIVILEGED_FUNCTION; + /* * Add xCount bytes from pucData into the pxStreamBuffer's data storage area. * This function does not update the buffer's xHead pointer, so multiple writes @@ -919,7 +928,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn ); /* Was a task waiting for the data? */ - if( prvBytesInBuffer( pxStreamBuffer ) >= pxStreamBuffer->xTriggerLevelBytes ) + if( prvBytesInBufferMeetTriggerLevel( pxStreamBuffer, prvBytesInBuffer( pxStreamBuffer ) ) != pdFALSE ) { prvSEND_COMPLETED( pxStreamBuffer ); } @@ -976,7 +985,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, if( xReturn > ( size_t ) 0 ) { /* Was a task waiting for the data? */ - if( prvBytesInBuffer( pxStreamBuffer ) >= pxStreamBuffer->xTriggerLevelBytes ) + if( prvBytesInBufferMeetTriggerLevel( pxStreamBuffer, prvBytesInBuffer( pxStreamBuffer ) ) != pdFALSE ) { /* 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 */ @@ -1587,6 +1596,35 @@ static size_t prvBytesInBuffer( const StreamBuffer_t * const pxStreamBuffer ) } /*-----------------------------------------------------------*/ +static BaseType_t prvBytesInBufferMeetTriggerLevel( const StreamBuffer_t * const pxStreamBuffer, + size_t xBytesInBuffer ) +{ + BaseType_t xReturn = pdFALSE; + + if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_BATCHING_BUFFER ) != ( uint8_t ) 0 ) + { + if( xBytesInBuffer > pxStreamBuffer->xTriggerLevelBytes ) + { + xReturn = pdTRUE; + } + else + { + mtCOVERAGE_TEST_MARKER(); + } + } + else if( xBytesInBuffer >= pxStreamBuffer->xTriggerLevelBytes ) + { + xReturn = pdTRUE; + } + else + { + mtCOVERAGE_TEST_MARKER(); + } + + return xReturn; +} +/*-----------------------------------------------------------*/ + static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, uint8_t * const pucBuffer, size_t xBufferSizeBytes, From fc253649315aed0be745970fb73a803c2d8ee85f Mon Sep 17 00:00:00 2001 From: Archit Gupta Date: Mon, 15 Jun 2026 17:34:12 +0000 Subject: [PATCH 09/16] Fix duplicate Doxygen \defgroup id for uxTaskBasePriorityGet (#1426) uxTaskBasePriorityGet reused the \defgroup id 'uxTaskPriorityGet' already defined by uxTaskPriorityGet, only with a different title. Doxygen reported: task.h: warning: group uxTaskPriorityGet: ignoring title "uxTaskBasePriorityGet" that does not match old title "uxTaskPriorityGet" Give uxTaskBasePriorityGet its own group id so both functions are documented correctly. --- include/task.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/task.h b/include/task.h index 2a19fa73f..2add58b94 100644 --- a/include/task.h +++ b/include/task.h @@ -1050,7 +1050,7 @@ UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNC * * @return The base priority of xTask. * - * \defgroup uxTaskPriorityGet uxTaskBasePriorityGet + * \defgroup uxTaskBasePriorityGet uxTaskBasePriorityGet * \ingroup TaskCtrl */ UBaseType_t uxTaskBasePriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; From 83e56c38ee181357a3a95ece7b57c515fed70d2b Mon Sep 17 00:00:00 2001 From: Archit Gupta Date: Mon, 15 Jun 2026 22:30:25 +0000 Subject: [PATCH 10/16] Disallow unprivileged critical sections with MPU wrappers v2 (#1427) When using MPU wrappers version 2 (configUSE_MPU_WRAPPERS_V1 == 0), portRAISE_PRIVILEGE() is a no-op because the portSVC_RAISE_PRIVILEGE handler is compiled only for MPU wrappers version 1. As a result, an unprivileged task that calls taskENTER_CRITICAL() does not actually raise its privilege, so the subsequent BASEPRI write is ignored by the hardware and the critical section silently fails to mask interrupts. This produces latent, hard-to-debug faults. configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is therefore not supported with MPU wrappers version 2. In the ARMv7-M MPU ports: - When the option is left undefined under v2, default it to 0 instead of 1 so the dangerous default configuration is safe. - When the option is explicitly set to 1 under v2, raise a compile-time #error so the unsupported configuration is rejected loudly rather than failing silently at run time. Behaviour for MPU wrappers version 1 is unchanged. --- portable/GCC/ARM_CM3_MPU/port.c | 14 ++++++++++++-- portable/GCC/ARM_CM4_MPU/port.c | 14 ++++++++++++-- portable/IAR/ARM_CM4F_MPU/port.c | 14 ++++++++++++-- portable/RVDS/ARM_CM4_MPU/port.c | 14 ++++++++++++-- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/portable/GCC/ARM_CM3_MPU/port.c b/portable/GCC/ARM_CM3_MPU/port.c index 8c4dd7800..c8d3439b6 100644 --- a/portable/GCC/ARM_CM3_MPU/port.c +++ b/portable/GCC/ARM_CM3_MPU/port.c @@ -55,9 +55,19 @@ #define portNVIC_SYSTICK_CLK ( 0 ) #endif +/* Unprivileged critical sections are not supported when using MPU wrappers + * version 2. Default the option to 0 and reject an explicit value of 1. */ #ifndef configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS - #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." - #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0 + #else + #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #endif +#else + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS == 1 ) ) + #error configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not supported with MPU wrappers version 2 ( configUSE_MPU_WRAPPERS_V1 == 0 ). + #endif #endif /* Prototype of all Interrupt Service Routines (ISRs). */ diff --git a/portable/GCC/ARM_CM4_MPU/port.c b/portable/GCC/ARM_CM4_MPU/port.c index 79f5e76d5..5a3527157 100644 --- a/portable/GCC/ARM_CM4_MPU/port.c +++ b/portable/GCC/ARM_CM4_MPU/port.c @@ -59,9 +59,19 @@ #define portNVIC_SYSTICK_CLK ( 0 ) #endif +/* Unprivileged critical sections are not supported when using MPU wrappers + * version 2. Default the option to 0 and reject an explicit value of 1. */ #ifndef configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS - #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." - #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0 + #else + #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #endif +#else + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS == 1 ) ) + #error configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not supported with MPU wrappers version 2 ( configUSE_MPU_WRAPPERS_V1 == 0 ). + #endif #endif /* Prototype of all Interrupt Service Routines (ISRs). */ diff --git a/portable/IAR/ARM_CM4F_MPU/port.c b/portable/IAR/ARM_CM4F_MPU/port.c index 720138f08..0441e0f0c 100644 --- a/portable/IAR/ARM_CM4F_MPU/port.c +++ b/portable/IAR/ARM_CM4F_MPU/port.c @@ -66,9 +66,19 @@ #define portNVIC_SYSTICK_CLK_BIT ( 0 ) #endif +/* Unprivileged critical sections are not supported when using MPU wrappers + * version 2. Default the option to 0 and reject an explicit value of 1. */ #ifndef configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS - #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." - #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0 + #else + #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #endif +#else + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS == 1 ) ) + #error configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not supported with MPU wrappers version 2 ( configUSE_MPU_WRAPPERS_V1 == 0 ). + #endif #endif /* Prototype of all Interrupt Service Routines (ISRs). */ diff --git a/portable/RVDS/ARM_CM4_MPU/port.c b/portable/RVDS/ARM_CM4_MPU/port.c index 450b86211..8620325ca 100644 --- a/portable/RVDS/ARM_CM4_MPU/port.c +++ b/portable/RVDS/ARM_CM4_MPU/port.c @@ -48,9 +48,19 @@ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE +/* Unprivileged critical sections are not supported when using MPU wrappers + * version 2. Default the option to 0 and reject an explicit value of 1. */ #ifndef configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS - #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." - #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0 + #else + #warning "configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not defined. We recommend defining it to 0 in FreeRTOSConfig.h for better security." + #define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + #endif +#else + #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS == 1 ) ) + #error configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS is not supported with MPU wrappers version 2 ( configUSE_MPU_WRAPPERS_V1 == 0 ). + #endif #endif /* Prototype of all Interrupt Service Routines (ISRs). */ From e146d6444c3d80b60dc75735438dc6c21d533747 Mon Sep 17 00:00:00 2001 From: Srikanth Patchava Date: Mon, 15 Jun 2026 21:34:07 -0700 Subject: [PATCH 11/16] fix: TOCTOU race condition in vTaskListTasks() Read uxCurrentNumberOfTasks once into uxArraySize and use that local variable for both the size check and pvPortMalloc() call. The previous code read the volatile variable twice, allowing a task to be created between the reads, resulting in an undersized allocation that could cause a buffer overflow in uxTaskGetSystemState(). --- tasks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks.c b/tasks.c index b0299d12b..461271fcf 100644 --- a/tasks.c +++ b/tasks.c @@ -7362,7 +7362,7 @@ STATIC void prvResetNextTaskUnblockTime( void ) /* MISRA Ref 11.5.1 [Malloc memory assignment] */ /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */ /* coverity[misra_c_2012_rule_11_5_violation] */ - pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( TaskStatus_t ) ); + pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) ); if( pxTaskStatusArray != NULL ) { @@ -7531,7 +7531,7 @@ STATIC void prvResetNextTaskUnblockTime( void ) /* MISRA Ref 11.5.1 [Malloc memory assignment] */ /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */ /* coverity[misra_c_2012_rule_11_5_violation] */ - pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( TaskStatus_t ) ); + pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) ); if( pxTaskStatusArray != NULL ) { From 49cec3e9b27e517ac5ea5db5482c59f937e6aea4 Mon Sep 17 00:00:00 2001 From: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Mon, 22 Jun 2026 14:52:21 -0700 Subject: [PATCH 12/16] docs: link FreeRTOS kernel threat model in SECURITY.md --- .github/SECURITY.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 1472c0c86..83ca1bbe8 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -1,3 +1,13 @@ +## Threat model + +Before reporting an issue, please review the FreeRTOS kernel threat model. It +describes the security assumptions the kernel makes, which threats are in scope, +and the protections the kernel does and does not provide. Understanding these +boundaries helps determine whether an observed behavior is a security +vulnerability or expected, documented behavior. + +- [FreeRTOS Kernel Threat Model](https://www.freertos.org/Security/02-Kernel-threat-model) + ## Reporting a Vulnerability If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security From ae46383c90d5eacb3dfa0cb9d2086e1ce7506c59 Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Wed, 1 Jul 2026 23:28:41 +0530 Subject: [PATCH 13/16] Fix vPortFreeSecureContext to read xSecureContext at correct offset (#1441) When MPU is enabled, the first item in the TCB is not the top of the stack but the stored context location. As a result, xSecureContext is located at a negative offset from that position rather than at offset 0. The current implementation unconditionally reads xSecureContext at offset 0, which returns an incorrect value when MPU is enabled. This commit updates vPortFreeSecureContext to read xSecureContext at the correcct offset based on the port configuration: - CM33/CM35P/CM52/CM55/CM85/STAR_MC3: -20 (or -36 with PAC enabled) - CM23: -20 (no PAC support) - Without MPU: 0 (xSecureContext remains at the top of stack) Signed-off-by: Gaurav Aggarwal --- .../non_secure/portable/GCC/ARM_CM23/portasm.c | 15 +++++++++++---- .../non_secure/portable/GCC/ARM_CM33/portasm.c | 18 ++++++++++++++---- .../non_secure/portable/IAR/ARM_CM23/portasm.s | 11 +++++++++-- .../non_secure/portable/IAR/ARM_CM33/portasm.s | 14 ++++++++++++-- portable/GCC/ARM_CM23/non_secure/portasm.c | 15 +++++++++++---- portable/GCC/ARM_CM33/non_secure/portasm.c | 18 ++++++++++++++---- portable/GCC/ARM_CM35P/non_secure/portasm.c | 18 ++++++++++++++---- portable/GCC/ARM_CM52/non_secure/portasm.c | 18 ++++++++++++++---- portable/GCC/ARM_CM55/non_secure/portasm.c | 18 ++++++++++++++---- portable/GCC/ARM_CM85/non_secure/portasm.c | 18 ++++++++++++++---- portable/GCC/ARM_STAR_MC3/non_secure/portasm.c | 18 ++++++++++++++---- portable/IAR/ARM_CM23/non_secure/portasm.s | 11 +++++++++-- portable/IAR/ARM_CM33/non_secure/portasm.s | 14 ++++++++++++-- portable/IAR/ARM_CM35P/non_secure/portasm.s | 14 ++++++++++++-- portable/IAR/ARM_CM52/non_secure/portasm.s | 14 ++++++++++++-- portable/IAR/ARM_CM55/non_secure/portasm.s | 14 ++++++++++++-- portable/IAR/ARM_CM85/non_secure/portasm.s | 14 ++++++++++++-- portable/IAR/ARM_STAR_MC3/non_secure/portasm.s | 14 ++++++++++++-- 18 files changed, 222 insertions(+), 54 deletions(-) diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c index 978d35259..b584c63e7 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c index 0ebbe48a4..d6c0348d9 100644 --- a/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c +++ b/portable/ARMv8M/non_secure/portable/GCC/ARM_CM33/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s index 6817abd7a..d8e0abf79 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM23/portasm.s @@ -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). */ diff --git a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s index 8d5988819..47fcfa15b 100644 --- a/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s +++ b/portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s @@ -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. */ diff --git a/portable/GCC/ARM_CM23/non_secure/portasm.c b/portable/GCC/ARM_CM23/non_secure/portasm.c index 978d35259..b584c63e7 100644 --- a/portable/GCC/ARM_CM23/non_secure/portasm.c +++ b/portable/GCC/ARM_CM23/non_secure/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM33/non_secure/portasm.c b/portable/GCC/ARM_CM33/non_secure/portasm.c index 0ebbe48a4..d6c0348d9 100644 --- a/portable/GCC/ARM_CM33/non_secure/portasm.c +++ b/portable/GCC/ARM_CM33/non_secure/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM35P/non_secure/portasm.c b/portable/GCC/ARM_CM35P/non_secure/portasm.c index 0ebbe48a4..d6c0348d9 100644 --- a/portable/GCC/ARM_CM35P/non_secure/portasm.c +++ b/portable/GCC/ARM_CM35P/non_secure/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM52/non_secure/portasm.c b/portable/GCC/ARM_CM52/non_secure/portasm.c index 0ebbe48a4..d6c0348d9 100644 --- a/portable/GCC/ARM_CM52/non_secure/portasm.c +++ b/portable/GCC/ARM_CM52/non_secure/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM55/non_secure/portasm.c b/portable/GCC/ARM_CM55/non_secure/portasm.c index 0ebbe48a4..d6c0348d9 100644 --- a/portable/GCC/ARM_CM55/non_secure/portasm.c +++ b/portable/GCC/ARM_CM55/non_secure/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_CM85/non_secure/portasm.c b/portable/GCC/ARM_CM85/non_secure/portasm.c index 0ebbe48a4..d6c0348d9 100644 --- a/portable/GCC/ARM_CM85/non_secure/portasm.c +++ b/portable/GCC/ARM_CM85/non_secure/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/GCC/ARM_STAR_MC3/non_secure/portasm.c b/portable/GCC/ARM_STAR_MC3/non_secure/portasm.c index 0ebbe48a4..d6c0348d9 100644 --- a/portable/GCC/ARM_STAR_MC3/non_secure/portasm.c +++ b/portable/GCC/ARM_STAR_MC3/non_secure/portasm.c @@ -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" ); } /*-----------------------------------------------------------*/ diff --git a/portable/IAR/ARM_CM23/non_secure/portasm.s b/portable/IAR/ARM_CM23/non_secure/portasm.s index 6817abd7a..d8e0abf79 100644 --- a/portable/IAR/ARM_CM23/non_secure/portasm.s +++ b/portable/IAR/ARM_CM23/non_secure/portasm.s @@ -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). */ diff --git a/portable/IAR/ARM_CM33/non_secure/portasm.s b/portable/IAR/ARM_CM33/non_secure/portasm.s index 8d5988819..47fcfa15b 100644 --- a/portable/IAR/ARM_CM33/non_secure/portasm.s +++ b/portable/IAR/ARM_CM33/non_secure/portasm.s @@ -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. */ diff --git a/portable/IAR/ARM_CM35P/non_secure/portasm.s b/portable/IAR/ARM_CM35P/non_secure/portasm.s index 8d5988819..47fcfa15b 100644 --- a/portable/IAR/ARM_CM35P/non_secure/portasm.s +++ b/portable/IAR/ARM_CM35P/non_secure/portasm.s @@ -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. */ diff --git a/portable/IAR/ARM_CM52/non_secure/portasm.s b/portable/IAR/ARM_CM52/non_secure/portasm.s index 8d5988819..47fcfa15b 100644 --- a/portable/IAR/ARM_CM52/non_secure/portasm.s +++ b/portable/IAR/ARM_CM52/non_secure/portasm.s @@ -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. */ diff --git a/portable/IAR/ARM_CM55/non_secure/portasm.s b/portable/IAR/ARM_CM55/non_secure/portasm.s index 8d5988819..47fcfa15b 100644 --- a/portable/IAR/ARM_CM55/non_secure/portasm.s +++ b/portable/IAR/ARM_CM55/non_secure/portasm.s @@ -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. */ diff --git a/portable/IAR/ARM_CM85/non_secure/portasm.s b/portable/IAR/ARM_CM85/non_secure/portasm.s index 8d5988819..47fcfa15b 100644 --- a/portable/IAR/ARM_CM85/non_secure/portasm.s +++ b/portable/IAR/ARM_CM85/non_secure/portasm.s @@ -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. */ diff --git a/portable/IAR/ARM_STAR_MC3/non_secure/portasm.s b/portable/IAR/ARM_STAR_MC3/non_secure/portasm.s index 8d5988819..47fcfa15b 100644 --- a/portable/IAR/ARM_STAR_MC3/non_secure/portasm.s +++ b/portable/IAR/ARM_STAR_MC3/non_secure/portasm.s @@ -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. */ From a50edad08b29052631aa469d4df6e6ec7ff68878 Mon Sep 17 00:00:00 2001 From: Anubhav Rawal Date: Wed, 8 Jul 2026 17:38:51 -0700 Subject: [PATCH 14/16] fix: Add MPU wrapper for xTimerDelete API (#1412) When using MPU wrappers v2, xTimerDelete needs to be a real function rather than a macro so that the kernel object pool index can be freed after the timer is successfully deleted. Without this, deleting a timer leaks the kernel object pool entry. Signed-off-by: Gaurav Aggarwal Co-authored-by: Gaurav Aggarwal --- include/mpu_prototypes.h | 3 +++ include/mpu_wrappers.h | 1 + include/timers.h | 7 ++++++- portable/Common/mpu_wrappers_v2.c | 34 +++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/include/mpu_prototypes.h b/include/mpu_prototypes.h index b4c0f4745..d8dc56a48 100644 --- a/include/mpu_prototypes.h +++ b/include/mpu_prototypes.h @@ -369,6 +369,9 @@ BaseType_t MPU_xTimerGenericCommandFromISR( TimerHandle_t xTimer, BaseType_t * const pxHigherPriorityTaskWoken, 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. */ EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, diff --git a/include/mpu_wrappers.h b/include/mpu_wrappers.h index 3b4738e96..3de2013ce 100644 --- a/include/mpu_wrappers.h +++ b/include/mpu_wrappers.h @@ -190,6 +190,7 @@ #define xTimerCreateStatic MPU_xTimerCreateStatic #define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer #define xTimerGenericCommandFromISR MPU_xTimerGenericCommandFromISR + #define xTimerDelete MPU_xTimerDelete #endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */ /* Map standard event_group.h API functions to the MPU equivalents. */ diff --git a/include/timers.h b/include/timers.h index 7d99d3536..191703928 100644 --- a/include/timers.h +++ b/include/timers.h @@ -667,8 +667,13 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION; * * 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 ) ) +#endif /** * BaseType_t xTimerReset( TimerHandle_t xTimer, TickType_t xTicksToWait ); diff --git a/portable/Common/mpu_wrappers_v2.c b/portable/Common/mpu_wrappers_v2.c index 70082b829..612cbae18 100644 --- a/portable/Common/mpu_wrappers_v2.c +++ b/portable/Common/mpu_wrappers_v2.c @@ -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. */ /*-----------------------------------------------------------*/ From d72263b404d925d313c7cd5400513ef1f8822d31 Mon Sep 17 00:00:00 2001 From: wanghengZzz <150767771+wanghengZzz@users.noreply.github.com> Date: Fri, 10 Jul 2026 02:55:17 +0800 Subject: [PATCH 15/16] fix copy-paste comment typos in xTaskGetApplicationTaskTagFromISR and xTaskGetApplicationTaskTag (#1446) --- tasks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks.c b/tasks.c index 461271fcf..3c97d3c2f 100644 --- a/tasks.c +++ b/tasks.c @@ -5035,11 +5035,11 @@ BaseType_t xTaskIncrementTick( void ) 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 ); 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. */ taskENTER_CRITICAL(); { @@ -5065,11 +5065,11 @@ BaseType_t xTaskIncrementTick( void ) 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 ); 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. */ /* 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 */ From 9db704cd3bbe4963f9bd3de1f1161ea2cf90768b Mon Sep 17 00:00:00 2001 From: Old-Ding <35417409+Old-Ding@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:31:36 +0800 Subject: [PATCH 16/16] docs: clarify MPU region parameter macros (#1445) Document that MemoryRegion_t.ulParameters macros are port specific so users select the tskMPU_REGION_* or portMPU_REGION_* values that match their MPU port. Signed-off-by: Old-Ding Co-authored-by: Old-Ding --- include/task.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/task.h b/include/task.h index 2add58b94..5353dc694 100644 --- a/include/task.h +++ b/include/task.h @@ -548,6 +548,14 @@ typedef enum * The function parameters define the memory regions and associated access * 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 * dynamic memory allocation. * @@ -639,6 +647,14 @@ typedef enum * xTaskCreateRestrictedStatic() therefore allows a memory protected task to be * 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 * for each of the normal xTaskCreate() parameters (see the xTaskCreate() API * 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 * 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: * @code{c} * // Define an array of MemoryRegion_t structures that configures an MPU region