Skip to content

Commit d690416

Browse files
Merge branch 'main' into add-task-dedicated-pac-key-support
2 parents 99742d2 + 3a7b308 commit d690416

File tree

12 files changed

+212
-186
lines changed

12 files changed

+212
-186
lines changed

examples/coverity/FreeRTOSConfig.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,13 @@
118118
#define INCLUDE_uxTaskPriorityGet 1
119119
#define INCLUDE_vTaskDelete 1
120120
#define INCLUDE_vTaskSuspend 1
121-
#define INCLUDE_xResumeFromISR 1
122121
#define INCLUDE_vTaskDelayUntil 1
123122
#define INCLUDE_vTaskDelay 1
124123
#define INCLUDE_xTaskGetSchedulerState 1
125124
#define INCLUDE_xTaskGetCurrentTaskHandle 1
126125
#define INCLUDE_uxTaskGetStackHighWaterMark 1
127126
#define INCLUDE_xTaskGetIdleTaskHandle 1
128127
#define INCLUDE_eTaskGetState 1
129-
#define INCLUDE_xEventGroupSetBitFromISR 1
130128
#define INCLUDE_xTimerPendFunctionCall 1
131129
#define INCLUDE_xTaskAbortDelay 1
132130
#define INCLUDE_xTaskGetHandle 1

examples/template_configuration/FreeRTOSConfig.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,15 +650,13 @@
650650
#define INCLUDE_uxTaskPriorityGet 1
651651
#define INCLUDE_vTaskDelete 1
652652
#define INCLUDE_vTaskSuspend 1
653-
#define INCLUDE_xResumeFromISR 1
654653
#define INCLUDE_vTaskDelayUntil 1
655654
#define INCLUDE_vTaskDelay 1
656655
#define INCLUDE_xTaskGetSchedulerState 1
657656
#define INCLUDE_xTaskGetCurrentTaskHandle 1
658657
#define INCLUDE_uxTaskGetStackHighWaterMark 0
659658
#define INCLUDE_xTaskGetIdleTaskHandle 0
660659
#define INCLUDE_eTaskGetState 0
661-
#define INCLUDE_xEventGroupSetBitFromISR 1
662660
#define INCLUDE_xTimerPendFunctionCall 0
663661
#define INCLUDE_xTaskAbortDelay 0
664662
#define INCLUDE_xTaskGetHandle 0

include/FreeRTOS.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@
454454
#ifndef portRELEASE_TASK_LOCK
455455

456456
#if ( configNUMBER_OF_CORES == 1 )
457-
#define portRELEASE_TASK_LOCK()
457+
#define portRELEASE_TASK_LOCK( xCoreID )
458458
#else
459459
#error portRELEASE_TASK_LOCK is required in SMP
460460
#endif
@@ -464,7 +464,7 @@
464464
#ifndef portGET_TASK_LOCK
465465

466466
#if ( configNUMBER_OF_CORES == 1 )
467-
#define portGET_TASK_LOCK()
467+
#define portGET_TASK_LOCK( xCoreID )
468468
#else
469469
#error portGET_TASK_LOCK is required in SMP
470470
#endif
@@ -474,7 +474,7 @@
474474
#ifndef portRELEASE_ISR_LOCK
475475

476476
#if ( configNUMBER_OF_CORES == 1 )
477-
#define portRELEASE_ISR_LOCK()
477+
#define portRELEASE_ISR_LOCK( xCoreID )
478478
#else
479479
#error portRELEASE_ISR_LOCK is required in SMP
480480
#endif
@@ -484,7 +484,7 @@
484484
#ifndef portGET_ISR_LOCK
485485

486486
#if ( configNUMBER_OF_CORES == 1 )
487-
#define portGET_ISR_LOCK()
487+
#define portGET_ISR_LOCK( xCoreID )
488488
#else
489489
#error portGET_ISR_LOCK is required in SMP
490490
#endif

include/stack_macros.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,20 @@
8888

8989
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
9090

91-
#define taskCHECK_FOR_STACK_OVERFLOW() \
92-
do { \
93-
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
94-
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
95-
\
96-
if( ( pulStack[ 0 ] != ulCheckValue ) || \
97-
( pulStack[ 1 ] != ulCheckValue ) || \
98-
( pulStack[ 2 ] != ulCheckValue ) || \
99-
( pulStack[ 3 ] != ulCheckValue ) ) \
100-
{ \
101-
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
102-
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
103-
} \
91+
#define taskCHECK_FOR_STACK_OVERFLOW() \
92+
do { \
93+
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
94+
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
95+
\
96+
if( ( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) || \
97+
( pulStack[ 0 ] != ulCheckValue ) || \
98+
( pulStack[ 1 ] != ulCheckValue ) || \
99+
( pulStack[ 2 ] != ulCheckValue ) || \
100+
( pulStack[ 3 ] != ulCheckValue ) ) \
101+
{ \
102+
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
103+
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
104+
} \
104105
} while( 0 )
105106

106107
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
@@ -120,8 +121,8 @@
120121
\
121122
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
122123
\
123-
/* Has the extremity of the task stack ever been written over? */ \
124-
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
124+
if( ( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \
125+
( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) ) \
125126
{ \
126127
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
127128
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \

include/task.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,17 +2199,25 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
21992199
* Lists all the current tasks, along with their current state and stack
22002200
* usage high water mark.
22012201
*
2202-
* Tasks are reported as blocked ('B'), ready ('R'), deleted ('D') or
2203-
* suspended ('S').
2202+
* Tasks are reported as running ('X'), blocked ('B'), ready ('R'), deleted ('D')
2203+
* or suspended ('S').
22042204
*
22052205
* PLEASE NOTE:
22062206
*
22072207
* This function is provided for convenience only, and is used by many of the
22082208
* demo applications. Do not consider it to be part of the scheduler.
22092209
*
22102210
* vTaskListTasks() calls uxTaskGetSystemState(), then formats part of the
2211-
* uxTaskGetSystemState() output into a human readable table that displays task:
2212-
* names, states, priority, stack usage and task number.
2211+
* uxTaskGetSystemState() output into a human readable table that displays task
2212+
* information in the following format:
2213+
* Task Name, Task State, Task Priority, Task Stack High Watermak, Task Number.
2214+
*
2215+
* The following is a sample output:
2216+
* Task A X 2 67 2
2217+
* Task B R 1 67 3
2218+
* IDLE R 0 67 5
2219+
* Tmr Svc B 6 137 6
2220+
*
22132221
* Stack usage specified as the number of unused StackType_t words stack can hold
22142222
* on top of stack - not the number of bytes.
22152223
*
@@ -2260,17 +2268,25 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
22602268
* Lists all the current tasks, along with their current state and stack
22612269
* usage high water mark.
22622270
*
2263-
* Tasks are reported as blocked ('B'), ready ('R'), deleted ('D') or
2264-
* suspended ('S').
2271+
* Tasks are reported as running ('X'), blocked ('B'), ready ('R'), deleted ('D')
2272+
* or suspended ('S').
22652273
*
22662274
* PLEASE NOTE:
22672275
*
22682276
* This function is provided for convenience only, and is used by many of the
22692277
* demo applications. Do not consider it to be part of the scheduler.
22702278
*
22712279
* vTaskList() calls uxTaskGetSystemState(), then formats part of the
2272-
* uxTaskGetSystemState() output into a human readable table that displays task:
2273-
* names, states, priority, stack usage and task number.
2280+
* uxTaskGetSystemState() output into a human readable table that displays task
2281+
* information in the following format:
2282+
* Task Name, Task State, Task Priority, Task Stack High Watermak, Task Number.
2283+
*
2284+
* The following is a sample output:
2285+
* Task A X 2 67 2
2286+
* Task B R 1 67 3
2287+
* IDLE R 0 67 5
2288+
* Tmr Svc B 6 137 6
2289+
*
22742290
* Stack usage specified as the number of unused StackType_t words stack can hold
22752291
* on top of stack - not the number of bytes.
22762292
*

portable/CCRH/F1Kx/port.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ void vPortTickISR( void );
258258
* already had lock can acquire lock without waiting. This function could be
259259
* call from task and interrupt context, the critical section is called
260260
* as in ISR */
261-
void vPortRecursiveLockAcquire( BaseType_t xFromIsr );
262-
void vPortRecursiveLockRelease( BaseType_t xFromIsr );
261+
void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr );
262+
void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr );
263263

264264
#endif /* (configNUMBER_OF_CORES > 1) */
265265

@@ -688,10 +688,9 @@ static void prvSetupTimerInterrupt( void )
688688
}
689689

690690
/*-----------------------------------------------------------*/
691-
void vPortRecursiveLockAcquire( BaseType_t xFromIsr )
691+
void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr )
692692
{
693693
BaseType_t xSavedInterruptStatus;
694-
BaseType_t xCoreID = xPortGET_CORE_ID();
695694
BaseType_t xBitPosition = ( xFromIsr == pdTRUE );
696695

697696
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
@@ -705,10 +704,9 @@ static void prvSetupTimerInterrupt( void )
705704
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
706705
}
707706

708-
void vPortRecursiveLockRelease( BaseType_t xFromIsr )
707+
void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr )
709708
{
710709
BaseType_t xSavedInterruptStatus;
711-
BaseType_t xCoreID = xPortGET_CORE_ID();
712710
BaseType_t xBitPosition = ( xFromIsr == pdTRUE );
713711

714712
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();

portable/CCRH/F1Kx/portmacro.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,18 @@
141141
#endif /* if ( configNUMBER_OF_CORES > 1 ) */
142142

143143
#if ( configNUMBER_OF_CORES == 1 )
144-
#define portGET_ISR_LOCK()
145-
#define portRELEASE_ISR_LOCK()
146-
#define portGET_TASK_LOCK()
147-
#define portRELEASE_TASK_LOCK()
144+
#define portGET_ISR_LOCK( xCoreID )
145+
#define portRELEASE_ISR_LOCK( xCoreID )
146+
#define portGET_TASK_LOCK( xCoreID )
147+
#define portRELEASE_TASK_LOCK( xCoreID )
148148
#else
149-
extern void vPortRecursiveLockAcquire( BaseType_t xFromIsr );
150-
extern void vPortRecursiveLockRelease( BaseType_t xFromIsr );
149+
extern void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr );
150+
extern void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr );
151151

152-
#define portGET_ISR_LOCK() vPortRecursiveLockAcquire( pdTRUE )
153-
#define portRELEASE_ISR_LOCK() vPortRecursiveLockRelease( pdTRUE )
154-
#define portGET_TASK_LOCK() vPortRecursiveLockAcquire( pdFALSE )
155-
#define portRELEASE_TASK_LOCK() vPortRecursiveLockRelease( pdFALSE )
152+
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdTRUE )
153+
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdTRUE )
154+
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdFALSE )
155+
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdFALSE )
156156
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
157157

158158
/*-----------------------------------------------------------*/

portable/ThirdParty/GCC/RP2040/include/portmacro.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ void vYieldCore( int xCoreID );
158158
#define portCRITICAL_NESTING_IN_TCB 0
159159

160160
extern UBaseType_t uxCriticalNestings[ configNUMBER_OF_CORES ];
161-
#define portGET_CRITICAL_NESTING_COUNT() ( uxCriticalNestings[ portGET_CORE_ID() ] )
162-
#define portSET_CRITICAL_NESTING_COUNT( x ) ( uxCriticalNestings[ portGET_CORE_ID() ] = ( x ) )
163-
#define portINCREMENT_CRITICAL_NESTING_COUNT() ( uxCriticalNestings[ portGET_CORE_ID() ]++ )
164-
#define portDECREMENT_CRITICAL_NESTING_COUNT() ( uxCriticalNestings[ portGET_CORE_ID() ]-- )
161+
#define portGET_CRITICAL_NESTING_COUNT( xCoreID ) ( uxCriticalNestings[ ( xCoreID ) ] )
162+
#define portSET_CRITICAL_NESTING_COUNT( xCoreID, x ) ( uxCriticalNestings[ ( xCoreID ) ] = ( x ) )
163+
#define portINCREMENT_CRITICAL_NESTING_COUNT( xCoreID ) ( uxCriticalNestings[ ( xCoreID ) ]++ )
164+
#define portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID ) ( uxCriticalNestings[ ( xCoreID ) ]-- )
165165

166166
/*-----------------------------------------------------------*/
167167

@@ -210,21 +210,21 @@ __force_inline static bool spin_try_lock_unsafe(spin_lock_t *lock) {
210210

211211
/* Note this is a single method with uxAcquire parameter since we have
212212
* static vars, the method is always called with a compile time constant for
213-
* uxAcquire, and the compiler should dothe right thing! */
214-
static inline void vPortRecursiveLock( uint32_t ulLockNum,
213+
* uxAcquire, and the compiler should do the right thing! */
214+
static inline void vPortRecursiveLock( BaseType_t xCoreID,
215+
uint32_t ulLockNum,
215216
spin_lock_t * pxSpinLock,
216217
BaseType_t uxAcquire )
217218
{
218219
static volatile uint8_t ucOwnedByCore[ portMAX_CORE_COUNT ][portRTOS_SPINLOCK_COUNT];
219220
static volatile uint8_t ucRecursionCountByLock[ portRTOS_SPINLOCK_COUNT ];
220221

221222
configASSERT( ulLockNum < portRTOS_SPINLOCK_COUNT );
222-
uint32_t ulCoreNum = get_core_num();
223223

224224
if( uxAcquire )
225225
{
226226
if (!spin_try_lock_unsafe(pxSpinLock)) {
227-
if( ucOwnedByCore[ ulCoreNum ][ ulLockNum ] )
227+
if( ucOwnedByCore[ xCoreID ][ ulLockNum ] )
228228
{
229229
configASSERT( ucRecursionCountByLock[ ulLockNum ] != 255u );
230230
ucRecursionCountByLock[ ulLockNum ]++;
@@ -234,31 +234,31 @@ static inline void vPortRecursiveLock( uint32_t ulLockNum,
234234
}
235235
configASSERT( ucRecursionCountByLock[ ulLockNum ] == 0 );
236236
ucRecursionCountByLock[ ulLockNum ] = 1;
237-
ucOwnedByCore[ ulCoreNum ][ ulLockNum ] = 1;
237+
ucOwnedByCore[ xCoreID ][ ulLockNum ] = 1;
238238
}
239239
else
240240
{
241-
configASSERT( ( ucOwnedByCore[ ulCoreNum ] [ulLockNum ] ) != 0 );
241+
configASSERT( ( ucOwnedByCore[ xCoreID ] [ulLockNum ] ) != 0 );
242242
configASSERT( ucRecursionCountByLock[ ulLockNum ] != 0 );
243243

244244
if( !--ucRecursionCountByLock[ ulLockNum ] )
245245
{
246-
ucOwnedByCore[ ulCoreNum ] [ ulLockNum ] = 0;
246+
ucOwnedByCore[ xCoreID ] [ ulLockNum ] = 0;
247247
spin_unlock_unsafe(pxSpinLock);
248248
}
249249
}
250250
}
251251

252252
#if ( configNUMBER_OF_CORES == 1 )
253-
#define portGET_ISR_LOCK()
254-
#define portRELEASE_ISR_LOCK()
255-
#define portGET_TASK_LOCK()
256-
#define portRELEASE_TASK_LOCK()
253+
#define portGET_ISR_LOCK( xCoreID )
254+
#define portRELEASE_ISR_LOCK( xCoreID )
255+
#define portGET_TASK_LOCK( xCoreID )
256+
#define portRELEASE_TASK_LOCK( xCoreID )
257257
#else
258-
#define portGET_ISR_LOCK() vPortRecursiveLock( 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdTRUE )
259-
#define portRELEASE_ISR_LOCK() vPortRecursiveLock( 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdFALSE )
260-
#define portGET_TASK_LOCK() vPortRecursiveLock( 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdTRUE )
261-
#define portRELEASE_TASK_LOCK() vPortRecursiveLock( 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdFALSE )
258+
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdTRUE )
259+
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdFALSE )
260+
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdTRUE )
261+
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdFALSE )
262262
#endif
263263

264264
/*-----------------------------------------------------------*/

portable/ThirdParty/xClang/XCOREAI/portmacro.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,11 @@
152152

153153
#define portASSERT_IF_IN_ISR() configASSERT( portCHECK_IF_IN_ISR() == 0 )
154154

155-
#define portGET_ISR_LOCK() rtos_lock_acquire( 0 )
156-
#define portRELEASE_ISR_LOCK() rtos_lock_release( 0 )
157-
#define portGET_TASK_LOCK() rtos_lock_acquire( 1 )
158-
#define portRELEASE_TASK_LOCK() rtos_lock_release( 1 )
155+
#define portGET_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 0 ); } while( 0 )
156+
#define portRELEASE_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 0 ); } while( 0 )
157+
#define portGET_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 1 ); } while( 0 )
158+
#define portRELEASE_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 1 ); } while( 0 )
159+
159160

160161
void vTaskEnterCritical( void );
161162
void vTaskExitCritical( void );

0 commit comments

Comments
 (0)