Problems with static initializer in LCF file

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

Problems with static initializer in LCF file

跳至解决方案
2,031 次查看
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,110 次查看
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,111 次查看
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,110 次查看
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 项奖励
回复