how does those define work?

Hi: i am confused by INCLUDE_vTaskCleanUpResources and INCLUDE_vTaskSuspend.
INCLUDE_vTaskCleanUpResources is used to clean up resource once task delete. but i know that IDLE task does the same thing.
INCLUDE_vTaskSuspend.force some tasks into suspend mode, but how does the task exit the mode ? vincent

how does those define work?

In old versions if INCLUDE_vTaskCleanUpResources was set to 1 then the vTaskCleanUpResources function was available for you to call, but that is obsolete now, ignore it. It might appear in old FreeRTOSConfig.h files but the function does not exist in the rtos code. If INCLUDE_vTaskSuspend is set to 1 then the vTaskSuspend() and vTaskResume() functions are available for you to call. vTaskSuspend() puts a task in the suspended state, vTaskResume() removes a task from the suspended state.

how does those define work?

Does FreeRTOS will put a ilde task in Suspend state and remove it from suspend state automatically ?
if the task is in suspend state, does it still work to receive data or doing other thing ?
is there a benefit for putting task in suspend state ?

how does those define work?

i create many task and set INCLUDE_vTaskSuspend to 1, some task enter into suspend state after running a while. but my code don’t call vTaskSuspend() to put those task into suspend state. by the way, i use call vTaskList to check each task state. i wonder to know that if I don’t call vTaskResume() , those tasks never exit from suspend state ? does they still work normally ?

how does those define work?

First, in most cases a linker will remove function that are not called anyway, meaning the INCLUDE_ macros can all be set to 1 without any effect on the code size.  I think GCC is the only tool chain that won’t do that by default, but it can be requested to remove unused functions using the command line options. A task will only be placed into a true Suspended state when it is explicit placed into the Suspended state using the vTaskSuspend() function.  This is the only possible way into the Suspended state and the RTOS will never do this itself.  Don’t confuse the Suspended state with the Ready state or the Blocked state.  In the  Ready state as task is able to run but not actually running, it is not Suspended though, it is just not running because another task is running.  In the Blocked state a task is not running because it is waiting for an event (be that a time or an external event or a message on a queue or a semaphore, etc.).  In the Suspended state the task is not able to run, but it is also not waiting for anything so it will remain in the Suspended state until it is removed from the Suspended state by another task. http://www.freertos.org/RTOS-task-states.html Regards.

how does those define work?

it is really strange,  my web server task really enter into suspend state ( i check it in vTaskList function) once i set INCLUDE_vTaskSuspend to 1. but I never call vTaskSuspend()  in my application code. why the task can enter into suspend. if I set INCLUDE_vTaskSuspend to 0, the task enter into block state , which is expected.
LWIP_ACCEPT will put task in suspend state. ?

how does those define work?

If you see ‘S’ in vTaskList() output then I suspect your task is in the Blocked state but with an infinite timeout (that is, no timeout).  See the description of ‘S’ here: http://www.freertos.org/a00021.html#vTaskList Regards.

how does those define work?

First, in most cases a linker will remove function that are not called anyway, meaning the INCLUDE_ macros can all be set to 1 without any effect on the code size.  I think GCC is the only tool chain that won’t do that by default, but it can be requested to remove unused functions using the command line options.
I am not sure this would be generally true! The “Standard Model” for compiling projects has been that each source file generates a single object file with a single module which is included in the resulting executable, with any modules needed from library files to satisfy unmet references. You often needed to be careful with the order the libraries were specified so that libraries that fulfilled requests from other libraries were listed later in the list, as the linker did just a single pass through the object files/libraries. To implement the exclusion of unused functions, first the complier needs to break up the object file to have a module for each function within it, as the linker can not include just part of a module. The linker then needs to scan the object files multiple times to find all referenced symbols (or at least record all defined symbols and go back to get the needed modules.) While this capability is very common on “big machine” compilers, I am not as sure it is universal with the sometimes older base compliers found on many of the smaller processors (and smaller processors are where you most need to worry about code space consumption). If FreeRTOS was compiled into a library, this wouldn’t be as much of a problem, as library modules have implemented this sort of functionality, but the dependance in FreeRTOS to FreeRTOSConfig.h, which is generally a PROJECT file, makes this not as convenient.

how does those define work?

Thank you for your good explaination!