1
votes

I'm a newbie of FreeRTOS. But I don't think it's well documented. As in xTaskCreate() :

pcName A descriptive name for the task. This is mainly used to facilitate debugging, but can also be used to obtain a task handle. The maximum length of a task’s name is set using the configMAX_TASK_NAME_LEN parameter in FreeRTOSConfig.h.

  1. Is a task must be associated with a name?
  2. What happened if pcName is NULL?
  3. What happened if I created multiple tasks with the same name?
  4. Should I maintain the mapping between task's handle and name? Or FreeRTOS maintains this relation?

In a word, it's not clear about the relation of task's handle and it's name in official document.

1

1 Answers

1
votes
  1. No it does not need a name
  2. If pcName is NULL it simply does not have a name. Nothing happens.
  3. You will get several tasks with the same name so you cannot identify them by name. The behaviour of xTaskGetHandle is then undefined (as per the documentation).
  4. FreeRTOS handles this.

The documentation also states this function takes a long time to complete and should be used sparingly. Personally I don't think there is any reason to use this at all. Just use task names for debug purposes only (useful in a debugger or when using Percipio Trace)