prm data available in C code?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

prm data available in C code?

787 次查看
rahulkrishna
Contributor IV

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

标签 (1)
标记 (3)
0 项奖励
回复
1 回复

667 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复