Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchinglee-iot <61685396+chinglee-iot@users.noreply.github.com>2023-09-06 14:09:52 +0300
committerGitHub <noreply@github.com>2023-09-06 14:09:52 +0300
commitf7565c2d5e4b88a7d8ab2816834c6e6274b34234 (patch)
treeb068fd8c17fbb4c422802d8df4e8ce40d7ac2f26 /tasks.c
parentc93d3865f7a710083ee61d0b0fa689338891beb2 (diff)
Add configUSE_CORE_AFFINITY bits check (#776)
* Add core affinity bits check * Add taskBITS_PER_BYTES
Diffstat (limited to 'tasks.c')
-rw-r--r--tasks.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tasks.c b/tasks.c
index 1efb0d3e3..6b1c7a65f 100644
--- a/tasks.c
+++ b/tasks.c
@@ -288,6 +288,8 @@
#define INFINITE_LOOP() 1
#endif
+#define taskBITS_PER_BYTE ( ( size_t ) 8 )
+
/*
* Task control block. A task control block (TCB) is allocated for each task,
* and stores task state information, including a pointer to the task's context
@@ -302,7 +304,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
#endif
#if ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 )
- UBaseType_t uxCoreAffinityMask; /*< Used to link the task to certain cores. UBaseType_t must have greater than or equal to the number of bits as confNUM_CORES. */
+ UBaseType_t uxCoreAffinityMask; /**< Used to link the task to certain cores. UBaseType_t must have greater than or equal to the number of bits as configNUMBER_OF_CORES. */
#endif
ListItem_t xStateListItem; /**< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
@@ -3249,6 +3251,14 @@ void vTaskStartScheduler( void )
{
BaseType_t xReturn;
+ #if ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 )
+ {
+ /* Sanity check that the UBaseType_t must have greater than or equal to
+ * the number of bits as confNUMBER_OF_CORES. */
+ configASSERT( ( sizeof( UBaseType_t ) * taskBITS_PER_BYTE ) >= configNUMBER_OF_CORES );
+ }
+ #endif /* #if ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) */
+
xReturn = prvCreateIdleTasks();
#if ( configUSE_TIMERS == 1 )