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 and Heap size?

Posted by Gavin on September 8, 2011
I don't know how to assign the stack and heap size in FreeRTOSConfig.h
It seems I have to give a very huge heap size, but I don't dynamically allocate any memory. Is the OS copy my code to HEAP? my code is already in RAM, why do the copy?
The Stack size should be task control block size, am I right? if I am right , then it should be just a couple of KB.

What's the relation of FreeRTOS HEAP&Stack comparing to the C heap&stack?

RE: Stack and Heap size?

Posted by Gavin on September 8, 2011
Sorry, my previous post is wrong.
This is the correct one:
I don't know how to assign the TASK size and heap size in FreeRTOSConfig.h
It seems I have to give a very huge heap size, but I don't dynamically allocate any memory. Is the OS copy my code to HEAP? my code is already in RAM, why do the copy?
The TASK size should be task control block size, am I right? if I am right , then it should be just a couple of KB.

What's the relation of FreeRTOS HEAP&Stack comparing to the C heap&stack?

RE: Stack and Heap size?

Posted by Dave on September 8, 2011
http://www.freertos.org/a00111.html

RE: Stack and Heap size?

Posted by Richard Damon on September 8, 2011
Your PROGRAMS stack and heap size are normally set with compiler/linker options. Since you didn't say which one you are using, it is hard to help you more on where to set those. If your program is using heap1.c or heap2.c, then size of the memory block that FreeRTOS uses for its heap is configured with a parameter in FreeRTOSConfig.h, this will NOT affect how much memory is allocated to the C library heap. Anything the linker report calls "heap" will be the C library heap, not the FreeRTOS heap which will look just like a chunk of statically declared memory usage (which is how it is implemented)

Your programs starting stack, is normally only used for your startup code, and in some ports, for the interrupt stack. It is NOT used by any of the tasks.

Task stacks are allocated from the FreeRTOS heap, which if you use heap3.c is the C library heap, otherwise it is the separate chunk of memory described previously.

RE: Stack and Heap size?

Posted by Mohammad on August 15, 2012
Hi richard,

i have here a question:
in code composer is the stack of the linker used for the startup code, i.e the main function? and is it used for the interrupts?
i am using code composer on msp430.

Regards.

RE: Stack and Heap size?

Posted by Dave on August 16, 2012
“in code composer is the stack of the linker used for the startup code”


yes.

“and is it used for the interrupts”


No. The port does not use interrupt nesting so there is little to gain from that.

RE: Stack and Heap size?

Posted by Mohammad on August 16, 2012
thank you very much.

Regards.

RE: Stack and Heap size?

Posted by Mohammad on August 29, 2012
Hi again,
i read in the dokumentation in another RTOS, that the msp430 dont have a stack for the ISR.
so the stack of every task will be used if the task will be interrupted with an ISR.
because of this, they recommended the user to define the stack of every task a little more bigger than the estimated space for every task.
i think this recommendation will be usefull for freertos-users too.

Best Regards.


[ 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