Page 1 of 1

Implementation of prvInitialiseNewTask

Posted: Tue Aug 28, 2018 9:03 pm
by FrAxl93
Good evening everyone,

I was browsing the source code of the IDF libs, particuarly I was looking in the FreeRTOS folder. I wished to learn about the implementation of "xTaskCreateStaticPinnedToCore", which is re-implemented by IDF to allow the user to specify which core should run the task. As I proceed I saw the "prvInitialiseNewTask" function and I wanted to look at the implementation but I was a bit disappointed that there is no implementation of this function in any file. In tasks.c there is only the definition and then the macro PRIVILEGED_FUNCTION, which I discovered to be just a directive to the MPU. What I noticed is that the "prvInitialiseNewTask" has an implementation in tasks.c in the original FreeRTOS repo, but here no. I just wonder why.

Regards,
Francesco.

Re: IDF-FreeRTOS source code

Posted: Wed Aug 29, 2018 2:37 am
by ESP_Angus
Hi Francesco,

I think what you saw is what is called a "forward declaration" in C, of a static function declared later in the file.

The full function is also in there: https://github.com/espressif/esp-idf/bl ... sks.c#L859

(Note: I renamed this topic to be more specific about the question.)

Angus

Re: Implementation of prvInitialiseNewTask

Posted: Fri Aug 31, 2018 6:30 am
by FrAxl93
Good morning Angus and thanks for your answer. I am a bit embarrassed because I know what forward declarations are in C, but for some reason the regexp that I was using to search the implementation of the function was finding only the declaration.

I wrongly thought that it might have been a function in a compiled library, which was exposing only the declaration!

Thanks!