Mike Dellisanti

ROM-RAM copying - placing function/file in RAM

Discussion created by Mike Dellisanti on Apr 1, 2008
Latest reply on Apr 2, 2008 by Mike Dellisanti
I've searched the forums and know that this has been covered before, but I can't quite find the answer I'm looking for or get the linker to behave the way I'd like. 
 
I want to place a function or file in RAM using the linker file.  The basic structure of the file is like the one in the Build Tools manual:
 
 

# ROM location: address 0x0
# RAM location: address 0x800000
# For clarity, no alignment directives in this listing

MEMORY {
TEXT (RX) : ORIGIN = 0x0, LENGTH = 0
DATA (RW) : ORIGIN = 0x800000, LENGTH = 0
}

SECTIONS{
.main :
{
   *(.text)
   *(.rodata)
} > TEXT

# Locate initialized data in ROM area at end of .main.
.main_data : AT( ADDR(.main) + SIZEOF(.main) )
{
   *(.data)
   *(.sdata)
   *(.sbss)
} > DATA

.uninitialized_data:
{
   *(SCOMMON)
   *(.bss)
   *(COMMON)
} >> DATA

 

I want to put the file/function in the main_data section, but since it's already included in the TEXT section (with the *(.text) directive) the linker doesn't include it again.  I don't want to explictly list out every file in the TEXT section becuase there are a lot and it's more difficult to maintain.  Is there a way to exclude a file/function from that section?

 

I read something in the manual about creating a named file group, but couldn't see how this was done (there were no examples that I could find).

 

If anyone's had any luck with this in the past or can suggest a better way, I'd be grateful.

Mike

Outcomes