cancel
Showing results for 
Search instead for 
Did you mean: 

Stack-Memory

shermantec
Associate II
Posted on April 11, 2005 at 11:09

Stack-Memory

3 REPLIES 3
shermantec
Associate II
Posted on April 11, 2005 at 04:47

I have a technical question :

the question is : is it possible to allocate less memory to the stack and leave more for the RAM ?

for an example in the st7264 there are 256 bites of RAM ,128 of them are reserve for the stack which leaves 128 bites to RAM , is there a way to define it differently ???

fggnrc
Associate II
Posted on April 11, 2005 at 05:20

Yes, you can change the memory layout of the micro.

However, you have to pay attention that the stack never overwrites the ''recycled'' bytes...

Therefore your code must not have deeply nested routines (each call uses 2 bytes plus the parameters size) and concurrent interrupt handling routines (each one ''eats'' 5 bytes).

Regards,

EtaPhi

luca239955_st
Associate III
Posted on April 11, 2005 at 11:09

if you are working in C, the linker takes care of all these assigments / calculations / checks for you; basically you decide which kind of stack you want (real or simulated), and where it should be (short or long addressing range), and then the compiler will ''fill'' all the space around it with variables and tell you if there is an overlap (it's only a worst case analysis based on static information, but it's good in ''most'' cases).

Hope this helps.

Regards,

Luca