thavali
Newbie level 2
stack organization
when I use CodeVisionAVR for 8 bit AVR, then RAM Memory Organization consist (attached file):
- Registers.
- The Data Stack: area is used to dynamically store local variables, passing function parameters and saving registers R0, R1, R15, R22, R23, R24, R25, R26, R27, R30, R31 and SREG during interrupt routine servicing.
The Data Stack Pointer is implemented using the Y register.
- The Global Variables area is used to statically store the global variables during program execution. The size of this area can be computed by summing the size of all the declared global variables.
- The Hardware Stack area is used for storing the functions return addresses.
The SP register is used as a stack pointer and is initialized at start-up with value of the _HEAP_START_ -1 address.
During the program execution the Hardware Stack grows downwards to the Global Variables area.
- The Heap is a memory area located between the Hardware Stack and the RAM end.
It is used by the memory allocation functions from the Standard Library: malloc, calloc, realloc and free.
but, in IAR for ARM, then I can not find memory area in SRAM correlative with The Hardware Stack area of CodevisionAVR. Where is used to store the functions return addresses ?
for example: with a recursive function, size of LR register is not enough to store return addresses.
Thanks,
thavali
when I use CodeVisionAVR for 8 bit AVR, then RAM Memory Organization consist (attached file):
- Registers.
- The Data Stack: area is used to dynamically store local variables, passing function parameters and saving registers R0, R1, R15, R22, R23, R24, R25, R26, R27, R30, R31 and SREG during interrupt routine servicing.
The Data Stack Pointer is implemented using the Y register.
- The Global Variables area is used to statically store the global variables during program execution. The size of this area can be computed by summing the size of all the declared global variables.
- The Hardware Stack area is used for storing the functions return addresses.
The SP register is used as a stack pointer and is initialized at start-up with value of the _HEAP_START_ -1 address.
During the program execution the Hardware Stack grows downwards to the Global Variables area.
- The Heap is a memory area located between the Hardware Stack and the RAM end.
It is used by the memory allocation functions from the Standard Library: malloc, calloc, realloc and free.
but, in IAR for ARM, then I can not find memory area in SRAM correlative with The Hardware Stack area of CodevisionAVR. Where is used to store the functions return addresses ?
for example: with a recursive function, size of LR register is not enough to store return addresses.
Thanks,
thavali