Problems with static initializer in LCF file

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

Problems with static initializer in LCF file

ソリューションへジャンプ
2,029件の閲覧回数
DannyK
Contributor I

Hello, I'm having some troubles with static variables in my program when I use the lcf file attached.
What I see is that all the static variables in my program are corrupted so I think I have something wrong in my lcf initialization.
I use the commands:

 

 ___sinit__     = .;
 STATICINIT 


The code I'm referring is loaded in the bootcode session (see LCF file).
Please let me know if I am doing something wrong in my LCF file. Thank you

 

Danny

mcf52259EVB_FLASH.zip

Message Edited by t.dowe on 2009-10-06 08:51 AM
ラベル(1)
0 件の賞賛
返信
1 解決策
1,108件の閲覧回数
CrasyCat
Specialist III

Hello

 

I Assume you are trying to run the code stand alone (without debugger) and your global variable are not initialized properly.

 

Am I right?

 

You need to adjust your .lcf file to copy initialization values for global variables from ROM to RAM at startup.

 

For more information on how to achieve that please refer to ColdFire_Build_Tools_Reference.pdf section "Coldfire Linker" -> "LCF Syntax" -> "ROM-RAM Copying".

 

Also if you create a project using the wizard, you should get a file MCF52259_INTERNAL_FLASH.lcf, which includes the appropriate commands to copy initialization value to RAM at startup.

 

I hope this helps.

 

CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,109件の閲覧回数
CrasyCat
Specialist III

Hello

 

I Assume you are trying to run the code stand alone (without debugger) and your global variable are not initialized properly.

 

Am I right?

 

You need to adjust your .lcf file to copy initialization values for global variables from ROM to RAM at startup.

 

For more information on how to achieve that please refer to ColdFire_Build_Tools_Reference.pdf section "Coldfire Linker" -> "LCF Syntax" -> "ROM-RAM Copying".

 

Also if you create a project using the wizard, you should get a file MCF52259_INTERNAL_FLASH.lcf, which includes the appropriate commands to copy initialization value to RAM at startup.

 

I hope this helps.

 

CrasyCat

0 件の賞賛
返信
1,108件の閲覧回数
DannyK
Contributor I

Hello,

 

thank you for your suggestion. What I was missing is just to copy the static values from rom to ram at the initialization.

Thanks a lot,

 

Danny

0 件の賞賛
返信