FreeRTOS Kernel Query

aimal wrote on Friday, August 18, 2017:

Hi,
I was going into FreeRTOS kernel code and i found few things confusing.
** FreeRTOS version: 9.0.0**
port: coretx-M4F RVDS

My queries are:

  1. In tasks.c at Line # 375, we have few lists definitions like:
List_t pxReadyTasksLists [configMAX_PRIORITIES]

List_t consistis of:
a. ListItem_t
b. MiniListItem_t xListEnd

If MiniListItem_t member of List_t is used to inidicate the end of List than why we need every array item to contain MiniListItem_t. i.e. pxReadyTasksLists is an array and each linkedlist element (List_t) of this array should contain both ListItem_t and MiniListItem_t. Why we need MiniListItem_t in every element of every list? Why not just add it at the end of pxReadyTasksLists and take it out of List_t struct.

2. In file tasks.c function prvInitialiseNewTask the string from string pool is copied to TCB_t character by character. Line # 834.

if (pcName[x] == 0x00) {
        break;
}

This statment is intended to check the end of string. My question is how can we check the end of string pool with pcName[x] == 0x00?? shouldn’t it be like: pcName[x] == ‘\0’?

rtel wrote on Friday, August 18, 2017:

  1. In tasks.c at Line # 375, we have few lists definitions like:

List_t pxReadyTasksLists [configMAX_PRIORITIES]

List_t consistis of:
a. ListItem_t
b. MiniListItem_t xListEnd

If MiniListItem_t member of List_t is used to inidicate the end of
List than why we need every array item to contain MiniListItem_t. i.e.
pxReadyTasksLists is an array and each linkedlist element (List_t) of
this array should contain both ListItem_t and MiniListItem_t. Why we
need MiniListItem_t in every element of every list? Why not just add
it at the end of pxReadyTasksLists and take it out of List_t struct.

This is an array of linked lists. Each index in the array has its own
unique linked list, and each unique linked list has its own end marker.
For example, if you were to access the linked list at array
position/index 1 then you want to know where the end of that list is,
not the where the end of the list in the first or last position in the
array is.


2. In file tasks.c function prvInitialiseNewTask the string from
string pool is copied to TCB_t character by character. Line # 834.

if (pcName == 0x00) {
break;
}

This statment is intended to check the end of string. My question is how
can we check the end of string pool with pcName[x] == 0x00?? shouldn’t
it be like: pcName[x] == ‘\0’?

\0 and 00 (and NULL) are all equivalent to each other - any could be used.