AnsweredAssumed Answered

prm data available in C code?

Question asked by rahul krishna on Jan 24, 2015
Latest reply on Feb 1, 2015 by ZhangJennie

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

Outcomes