Christopher Theriault

Using linker file labels in your other source files

Discussion created by Christopher Theriault on Apr 18, 2009
Latest reply on Apr 18, 2009 by yevgenit

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.

Outcomes