Using linker file labels in your other source files

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

Using linker file labels in your other source files

1,294件の閲覧回数
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 返信

814件の閲覧回数
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 件の賞賛
返信