Quality RTOS & Embedded Software

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


Loading

Task Cleanup

Posted by Jason on November 2, 2012
I am trying to understand what happens to a task when it returns (ends). The majority of my tasks are perpetual but I have a few that are 'one shot' tasks meaning they may do something, delay, do some more things then return. I noticed the following in one of the demo projects...

#define INCLUDE_vTaskCleanUpResources0


... but I can't find this documented anywhere.

Will the idle task clean up the resources used by the task that returns? Does it depend on the option above?



RE: Task Cleanup

Posted by Dave on November 2, 2012
According to http://www.freertos.org/History.txt vTaskCleanUpResources was obsolete and finally removed in V7.0.2.

A task must never return, but can be deleted, so if you want a task to "return" then add vTaskDelay(NULL) to the end of the function that implements it.

When you delete a task the TCB and stack will be freed by the idle task. The stack and TCB were allocated by FreeRTOS so it is right that they are also freed by FreeRTOS. FreeRTOS will not free any memory that the application allocated itself though, that must be cleaned manually.


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner