Skip to content

Commit

Permalink
fix(freertos): Correct taskRESERVED_TASK_NAME_LENGTH macro definition
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sudeep-mohanty committed Feb 7, 2025
1 parent d10ee46 commit 71390c6
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,22 @@
#define configIDLE_TASK_NAME "IDLE"
#endif

#if ( configNUMBER_OF_CORES > 1 )
/* Reserve space for Core ID and null termination. */
/* Reserve space for Core ID and null termination. */
#if ( configNUMBER_OF_CORES > 9 )
/* More than 9 cores require 2 characters for core ID and 1 for null termination. */
#if ( configMAX_TASK_NAME_LEN < 3U )
#error Minimum required task name length is 3. Please increase configMAX_TASK_NAME_LEN.
#endif
#define taskRESERVED_TASK_NAME_LENGTH 3U

#elif ( configNUMBER_OF_CORES > 1 )
/* Multi-core systems with up to 9 cores require 1 character for core ID and 1 for null termination. */
#if ( configMAX_TASK_NAME_LEN < 2U )
#error Minimum required task name length is 2. Please increase configMAX_TASK_NAME_LEN.
#endif
#define taskRESERVED_TASK_NAME_LENGTH 2U

#elif ( configNUMBER_OF_CORES > 9 )
#warning Please increase taskRESERVED_TASK_NAME_LENGTH. 1 character is insufficient to store the core ID.
#else
#else /* if ( configNUMBER_OF_CORES > 9 ) */
/* Reserve space for null termination. */
#if ( configMAX_TASK_NAME_LEN < 1U )
#error Minimum required task name length is 1. Please increase configMAX_TASK_NAME_LEN.
Expand Down Expand Up @@ -3597,7 +3603,12 @@ static BaseType_t prvCreateIdleTasks( void )
* only one idle task. */
#if ( configNUMBER_OF_CORES > 1 )
{
/* Append the idle task number to the end of the name. */
/* Append the idle task number to the end of the name.
*
* Note: Idle task name index only supports single-character
* core IDs (0-9). If the core ID exceeds 9, the idle task
* name will contain an incorrect ASCII character. This is
* acceptable as the task name is used mainly for debugging. */
cIdleName[ xIdleTaskNameIndex ] = ( char ) ( xCoreID + '0' );
cIdleName[ xIdleTaskNameIndex + 1 ] = '\0';
}
Expand Down

0 comments on commit 71390c6

Please sign in to comment.