Using linker file labels in your other source files

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

Using linker file labels in your other source files

1,295 次查看
Eqqman
Contributor I

Hello-

 

I've edited the internal flash linker file for the MCF52233 to have a section 'mymem' like so:

 

MEMORY {
   vectorram   (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00000500
   code        (RX)  : ORIGIN = 0x20000500, LENGTH = 0x00003B00
   mymem       (RWX): ORIGIN = 0x20004000, LENGTH = 0x00002000  
   userram     (RWX) : ORIGIN = 0x20006000, LENGTH = 0x00002000
}

 

The problem is that I have to hardcode the value 0x20004000 into my source files since I don't know how to get them to get the label 'mymem' out from the linker file.  Is there a way to get a source file to access 'mymem'?

 

This would help a lot since I could then use the 'mymem' label instead of hardcoding location values, as this makes my code not very portable between build targets.

标签 (1)
0 项奖励
回复
1 回复

815 次查看
admin
Specialist II

Any compiler permits to assign any source entity (function, constant, etc) to the specified segment.

Thus, try to assign the related part of your source code to segment mymem.

 

0 项奖励
回复