Problems with static initializer in LCF file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems with static initializer in LCF file

Jump to solution
2,031 Views
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
Labels (1)
0 Kudos
Reply
1 Solution
1,110 Views
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

View solution in original post

0 Kudos
Reply
2 Replies
1,111 Views
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 Kudos
Reply
1,110 Views
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 Kudos
Reply