Fixed variables in section of Coldfire RAM

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

Fixed variables in section of Coldfire RAM

跳至解决方案
2,100 次查看
rowol
Contributor I

I'm doing some work with a 5225x Coldfire and would like to be able to store certain variables In the battery backed-up first 16K of SRAM. We are using the 7.2 Code Warrior version, and Processor Expert... what's the easiest way to do this? I tried using define_section and __declspec() but was getting the "variable is referenced but has not been written" error from the linker. I suspect I have not set up the memory correctly... could you tell me how to do this with Processor Expert, or barring that how to edit the linker command file? Thanks! Ross

标签 (1)
0 项奖励
回复
1 解答
1,093 次查看
ProcessorExpert
Senior Contributor III

 

Hello,

 

I think that https://community.freescale.com/message/59817#59817 link might help you solve the problem. There is an example for CFV1 and AC256 family but the format of lcf file should be the same.

 

best regards
Vojtech Filip
Processor Expert Support Team

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,093 次查看
CrasyCat
Specialist III

Hello

 

When you are using the define_section pragma and __declspec keyword to place a variable in a user define section you need to make sure your section is placed into valid memory in the linker control file.

 

Did you check that?

  

CrasyCat

0 项奖励
回复
1,093 次查看
rowol
Contributor I

CrasyCat,

 

Thanks for the reply!

 

Yeah, I think that is exactly the problem I'm having.   I tried a variety of things in the code, this was one of them:

 

#pragma define_section _datastr ".datastr" far_absolute RW

__declspec(_datastr) int x12;
__declspec(_datastr) int y12;

 

 

We are using Processor Expert, which generates an LCF file.   What I think I want is a .datastr section from 0x20000000-0x200000FF then .data from 0x20000100- 0x2000FFFF.   I tried using the CPU Bean build options to create a 4th memory area called datastr, but when I looked at the map file, I don't think this did what I want (i.e. the section didn't have a .datastr name like .data does.)  

 

 

If Processor Expert won't do what I want, I don't have a problem with disabling the LCF generation and manually editing the LCF file....

 

Could you tell me what I would need to do?  

 

Do I need to make a "section" inside the data "memory area" or do I need to define a whole new section?    If I could locate a section inside data at a specific address (the same way something like .bss and .romp appear in the map) that might be all I need to do (?)   (I'm not sure of the terminology as to what's a segment, section, memory area, etc... haven't found doc on this yet)

 

Thanks!

Ross

0 项奖励
回复
1,094 次查看
ProcessorExpert
Senior Contributor III

 

Hello,

 

I think that https://community.freescale.com/message/59817#59817 link might help you solve the problem. There is an example for CFV1 and AC256 family but the format of lcf file should be the same.

 

best regards
Vojtech Filip
Processor Expert Support Team

0 项奖励
回复
1,093 次查看
rowol
Contributor I

Vojtech,

 

Yes, that was exactly what I was looking for!

I tried it and it works great.  

 

Thanks!

Ross

0 项奖励
回复