Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Stack after vTaskDelete

Posted by Bart on June 18, 2010
Hi,

I have a task that is called out by an ISR, when i press a button. This task creates another task. When i press the second button, ISR calls a third task that uses vTaskDelete to delete the second task.

Now before I create the second task, im checking available stack size by calling xPortGetFreeHeapSize(). I'm calling it again just after vTaskDelete deletes the second task. And the numbers don't match. Why is that? I thought all the memory should be freed after calling vTaskDelete. After few ISR's I'm getting a stack overflow. I'm using heap_2.c

RE: Stack after vTaskDelete

Posted by Dave on June 18, 2010
“I have a task that is called out by an ISR, ”


Do you mean unblocked by an ISR? I don't know what called out means.

“ISR calls a third task that uses vTaskDelete to delete the second task. ”


Again I don't really understand what you mean in this sentence. Tasks should not be called by an ISR so I suspect I just don't understand your terminology.

“Now before I create the second task, im checking available stack size by calling xPortGetFreeHeapSize(). ”


xPortGetFreeHeapSize() tells you the heap size, not the stack size.

“I'm calling it again just after vTaskDelete deletes the second task. And the numbers don't match. Why is that? I thought all the memory should be freed after calling vTaskDelete. After few ISR's I'm getting a stack overflow. I'm using heap_2.c”


When a task is deleted the heap memory that was allocated to the task is freed from inside the idle task (by default anyway). Therefore you would not expect the numbers to match until the idle task had executed at least one cycle.

RE: Stack after vTaskDelete

Posted by Bart on June 21, 2010
Sorry, I meant 'unblocked by ISR'. The problem was the Idle Task - it was starved out of processing time. Everything works fine now, thanks.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists