Skip to content

Commit 71390c6

Browse files
fix(freertos): Correct taskRESERVED_TASK_NAME_LENGTH macro definition
This commit updates the definition of taskRESERVED_TASK_NAME_LENGTH in tasks.c to fix an unreachable preprocessor condition. Signed-off-by: Sudeep Mohanty <[email protected]>
1 parent d10ee46 commit 71390c6

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

tasks.c

+17-6
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,22 @@
156156
#define configIDLE_TASK_NAME "IDLE"
157157
#endif
158158

159-
#if ( configNUMBER_OF_CORES > 1 )
160-
/* Reserve space for Core ID and null termination. */
159+
/* Reserve space for Core ID and null termination. */
160+
#if ( configNUMBER_OF_CORES > 9 )
161+
/* More than 9 cores require 2 characters for core ID and 1 for null termination. */
162+
#if ( configMAX_TASK_NAME_LEN < 3U )
163+
#error Minimum required task name length is 3. Please increase configMAX_TASK_NAME_LEN.
164+
#endif
165+
#define taskRESERVED_TASK_NAME_LENGTH 3U
166+
167+
#elif ( configNUMBER_OF_CORES > 1 )
168+
/* Multi-core systems with up to 9 cores require 1 character for core ID and 1 for null termination. */
161169
#if ( configMAX_TASK_NAME_LEN < 2U )
162170
#error Minimum required task name length is 2. Please increase configMAX_TASK_NAME_LEN.
163171
#endif
164172
#define taskRESERVED_TASK_NAME_LENGTH 2U
165173

166-
#elif ( configNUMBER_OF_CORES > 9 )
167-
#warning Please increase taskRESERVED_TASK_NAME_LENGTH. 1 character is insufficient to store the core ID.
168-
#else
174+
#else /* if ( configNUMBER_OF_CORES > 9 ) */
169175
/* Reserve space for null termination. */
170176
#if ( configMAX_TASK_NAME_LEN < 1U )
171177
#error Minimum required task name length is 1. Please increase configMAX_TASK_NAME_LEN.
@@ -3597,7 +3603,12 @@ static BaseType_t prvCreateIdleTasks( void )
35973603
* only one idle task. */
35983604
#if ( configNUMBER_OF_CORES > 1 )
35993605
{
3600-
/* Append the idle task number to the end of the name. */
3606+
/* Append the idle task number to the end of the name.
3607+
*
3608+
* Note: Idle task name index only supports single-character
3609+
* core IDs (0-9). If the core ID exceeds 9, the idle task
3610+
* name will contain an incorrect ASCII character. This is
3611+
* acceptable as the task name is used mainly for debugging. */
36013612
cIdleName[ xIdleTaskNameIndex ] = ( char ) ( xCoreID + '0' );
36023613
cIdleName[ xIdleTaskNameIndex + 1 ] = '\0';
36033614
}

0 commit comments

Comments
 (0)