how to declare non-initialized variables (MPC5567)

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

how to declare non-initialized variables (MPC5567)

跳至解决方案
1,149 次查看
Oliv74
Contributor I

Hello,

 

In my current project, I'm using a non-volatile battery backed SRAM, and now, I would like to declare variables that will be placed in that memory but that will not be initialized to zero at init.

In my lcf I added a memory section like that:

 

MEMORY{...    saved_ram:          org = 0x20000000,   len = 0x00020000...}SECTIONS{GROUP : {       .dataSavedRam  : {}    } >}

 and in my code:

 

#pragma push#pragma section data_type ".dataSavedRam" ".dataSavedRam"#pragma pop__declspec(section ".dataSavedRam") int savedVarExample;

But during startup my variable is initialized to 0 in the function __init_data (in __start.c).

 

So, what is the best solution to avoid that?

 

thank you.

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
898 次查看
CrasyCat
Specialist III

Hello

 

In fact you need to modify the function init_data.

 

Look for FAQ-27500 on www.freescale.com. This should provide you some insight on how to implement that.

 

CrasyCat

在原帖中查看解决方案

0 项奖励
回复
2 回复数
899 次查看
CrasyCat
Specialist III

Hello

 

In fact you need to modify the function init_data.

 

Look for FAQ-27500 on www.freescale.com. This should provide you some insight on how to implement that.

 

CrasyCat

0 项奖励
回复
898 次查看
Oliv74
Contributor I

Hello,

 

Thank you, it works fine now.

0 项奖励
回复