Hi
The stack pointer should be initialised to the top of RAM 0x2000.
There is no need to declare space for stack in the memory configuration files. The stack can grow until it hits variables, so is defined by the remaining space.
If you call
fnStackFree() is returns the gap between the top of variables (actually the top of heap) to the lowest point that the stack pointer reached during operation. This space is filled with the pattern
UNUSED_STACK_PATTERN (as defined in
config.h) so uses the method which you are referring to.
Also take a look at the following:
http://www.utasker.com/forum/index.php?topic=96.msg384#msg384This is basically valid for all projects/processors. Note that it is best to monitor
fnHeapFree() to see how much of the defined
OUR_HEAP_SIZE (
fnHeapAvailable()) is really being used. When the project is stable and the exact maximum heap use is known reduce
OUR_HEAP_SIZE so that
fnHeapAvailable() [the remaining space] is almost zero. This will ensure that the stack space is maximised.
Regards
Mark