Few FreeRTOS related questions (basics)

Morning all, first of all, I’m a FreeRTOS newbie so please do take that into account when looking at my questions that might appear too basic to some of you. I got those questions while studying different kinds of FreeRTOS examples code that I’ve used for learning on my STM32 Cortex ARM board kit. My questions are as follows: 1.) Is it absolutely necessary to declare my tasks (at the top of main.c) and what’s the reason for doing it? 2.) What’s the difference between using (void * p) and (void * pvParameters) when writing my tasks and how do I know when to use it? I’ve seen both cases in many examples I’ve checked. 3.) How do I know when to use “prv” (private) or “v” (void) as a part of my tasks’ names? For example, one of my task is flashing LEDs – should my name it “taskLED” or “vtaskLED” or “prvtaskLED”? Is it necessary to use this kind of names at all? Thank you for any help and guidance.

Few FreeRTOS related questions (basics)

1) Tasks can be created at any time before or after the scheduler is running, so not just from main(). 2) That is just a function parameter, you can call it whatever you want just like any other function parameter. Other than the name of the parameter the two examples you post are identical. This is just C code. 3) Again this is just C code, and this time that is just the name of the function, you can call it whatever you like just like any other function. By convention FreeRTOS code will prefix file scope functions prv just to denote that the function is private to that file.

Few FreeRTOS related questions (basics)

I see. So, just to make it sure: is it necessary to always declare my tasks and local functions (prototypes) or not? I’ve seen this practice in most of FreeRTOS examples code I checked (usually it’s right after #include and #define part) and I’m not sure about the reason for doing this. Again, I’m talking about prototypes. Thanks for your answers, it really helps.

Few FreeRTOS related questions (basics)

FreeRTOS is just C code, so normal C rules apply (it is after all being compiled with a compiler that just sees text input and knowns nothing about FreeRTOS). If you declare a function, be it implementing a task or not, then the file in which the function is declared should have a prototype for that function, or must have a function prototype if the function is used before it is declared. Any other file that uses the function must also be able to see the function prototype (normally in a header file) otherwise you will get a compiler error about an undeclared identifier. Where you put that prototype is entirely up to you within the rules mandated by the C compiler. Regards.

Few FreeRTOS related questions (basics)

Oh, I see! Makes more sense now. Thanks for your help.