Quality RTOS & Embedded Software

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




Loading

freertos (and atmega32) memory allocation

Posted by zvonko on May 15, 2010
hi
can anyone tell me where all the data is actually allocated/stored in ram, i.e. what goes where ,
for example , where are the variables created and initialised in task located in ram , do they end up in
task stack area or what, is there a some sort of tutorial on this sort of thing ?
what about variables created in main() ? what about system stack area etc..
please dont tell me to read compiler/linker manuals or read convoluted source code, :)
im a beginner just trying to get a big picture before diving into detailed stuff.
so links to explanations of these sort of questions related to freertos
would be much appreciated.

thank you all




RE: freertos (and atmega32) memory allocation

Posted by Richard Damon on May 15, 2010
It somewhat depends on the machine/compiler, but in general "static" and "global" variables, are allocated in one part of memory together, and "automatic" variables (those declared inside a function, including main or tasks), are allocated on the "stack:, For automatic variables in a task, or functions called by a task, these are stored in the task's stack, which depending on which version of "heap" you are using, will either be from an array in the static memory allocated in heap1.c or heap2.c, or if you are using heap3.c, will be within the program heap. Automatic variable from main, will be in the main stack (which will be what the compiler/linker will think is "stack".

I'm afraid that if you need more details, you are going to need to read the manuals. That is where the details will be described. Normally you don't really need to know about this sort of details though.

RE: freertos (and atmega32) memory allocation

Posted by zvonko on May 15, 2010
hi richard thanks for your response

what about this main() stack, in relation to freertos, where is this stack actually located in ram,
how do you recover this main() stack area if it is not used up completely (this is mentioned on freertos site somewhere). ?

i was just looking at ram memory with freertos running on atmega32 & two tasks with simulator software and noticed that
an automatic variable , char *, i.e. pointer to string, initialised before task for loop is not within task stack area, but somwhere near the beginning of ram, i.e. i guess in the are reserved for global stuff ? maybe the pointer to string itself is within the task stack ?

how would you go about finding answers to these sort of detailed questions ?
what compiler output files would tell me this information , im using avr-gcc ?

thanks

RE: freertos (and atmega32) memory allocation

Posted by sotd on May 15, 2010
“how would you go about finding answers to these sort of detailed questions ?”


Look at the linker script. You tell it where to put things, not the other way round.


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




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

Latest News

FreeRTOS kernel V10 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