Using linker file labels in your other source files

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

Using linker file labels in your other source files

764 Views
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.

Labels (1)
0 Kudos
1 Reply

284 Views
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 Kudos