Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Few FreeRTOS related questions (basics)

Posted by re-play on July 30, 2014

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)

Posted by davedoors on July 30, 2014

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)

Posted by re-play on July 30, 2014

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)

Posted by rtel on July 30, 2014

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.


Few FreeRTOS related questions (basics)

Posted by re-play on July 30, 2014

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

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Meet us at Embedded World. Hall 3A-525.

Hear from Richard Barry at Embedded World. Feb 28, 16:00, Hall 4-428.

Video: Watch James Gosling & Richard Barry at re:Invent, Las Vegas 2017.

FreeRTOS kernel V10.0.1 is available for immediate download. Now MIT licensed.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS