1. Is there any good way to detect stack overrun (e.g. declaring a variable at the top of the stack region and check for magic number? If so what is the best way to do this?
[JT] -See below
// This returns the number of bytes free till the top of RAM at the point of invocation.
// This function returns 0 if a stack overflow was not detected before
// Else it detected an overflow.
2. Is there a way I can increase the allocation to the stack?
[JT] - Increasing the application stack size is not supported.
Let me know if this answers your questions.
Thanks, this does answer my question