Hi
I have a few questions about the stack size (LPC2200 controller).
E.g. in my programm is a main function with an array
short example[16][500];
16 * 500 * 4 (short) = 3,9 kByte
In which value will I find this array in the calculation when I rebuild all files (code, RO-data, RW-data, Zi-data)?
Moreover is it true, that the stack size will be configurated in the startup file? And the default value is 0x400 for the user stack - so I would need a much bigger value for the user stack?
After a few minutes I saw the map file where I figured out that the stack is growing from a low base.
In my case at the beginning of the internal ram there's a libspace (atmel-lib and string.h) and after that there's the heap (size = 0) and the stack size...
Is it ok, to increase the stack size up to the highest addr from the internal RAM?
best regards Albert
And the default value is 0x400 for the user stack - so I would need a much bigger value for the user stack?
If you have an array that large, and it's defined in your main function, then you may as well make it static since it will exist for the whole lifetime of your program anyway. That way, the stack stays available for holding things it's meant to hold (huge arrays aren't usually part of this).
If you have an array that large, and it's defined in your main function, then you may as well make it static since it will exist for the whole lifetime of your program anyway. That way, the stack stays available for holding things it's meant to hold
is this also true, if the values for the array will change during the program?
If the array contents does not change, then it contains constant data. Then you should make sure that the array is stored in the code memory instead of consuming your RAM.
the array will change his data during the programm.
static short array[16][500];
View all questions in Keil forum