how to declare non-initialized variables (MPC5567)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how to declare non-initialized variables (MPC5567)

ソリューションへジャンプ
1,156件の閲覧回数
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 解決策
905件の閲覧回数
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 返答(返信)
906件の閲覧回数
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 件の賞賛
返信
905件の閲覧回数
Oliv74
Contributor I

Hello,

 

Thank you, it works fine now.

0 件の賞賛
返信