Hi everyone,
i have written a simple program in which i define a local variable in the main function and take the address of that variable similarly i take another variable in each function and calculate the address and do the difference of them.
Ex:
unsigned char *ptrone=NULL;
unsigned char *ptrtwo=NULL;
unsigned int stacksize=0;
int main(void)
{
volatile unsigned char test1;
ptrone = &test1;
subfunction1();
}
void subfunction1(void)
{
unsigned char test1=0;
ptrtwo = &test2;
stacksize = (ptrone - ptrtwo);
}
in somepart of the code i constantly check the stacksize and if it crosses the set value in the prm then it will reset the system.
First question: does the code work as expected? (according to me it works fine)
second: can i read the STACKSIZE parameter of the prm file into my C code?
Thanks and regards
Hi rahul,
I think you can also find the answer in this thread
https://community.freescale.com/thread/340654
correct?
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------