Michael Karas

Linker Command Files - Getting Segments to Concatenate

Discussion created by Michael Karas on Sep 7, 2007
Latest reply on Sep 10, 2007 by CrasyCat
It is typical on a Coldfire setup, particularly when using an embedded part with both internal FLASH and RAM, to want the memory layout definition in the LCF to be such that the read only parts and the read/write parts to be separate and mapped to separate regions according to memory type and usage.

I like being able to test code using the internal RAM only mode but since RAM is small and of limited quantity it would be nice to get the Linker to simply append the read/write data sections directly after the read only code and constants section. I have read the Linker on-line documentation and cannot figure out just how this would be done. Of course there is also the desire to keep the areas separate for the FLASH usage mode and also not have there be a difference in the source code itself. Below is the first part of my RAM mode linker command file (.lcf). How would this be changed so that the "userram" part of the memory map is specified to start directly after the end of the "code" part and not have to hard specify the ORIGIN of "userram" to 0x20006000 as shown below?

Thanks
Michael Karas

# Sample Linker Command File for CodeWarrior for ColdFire


# Memory ranges   

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

SECTIONS {
 
# Heap and Stack sizes definition
    ___heap_size      = 0x400;
    ___stack_size     = 0x400;

# MCF5213 Derivative Memory map definitions from linker command files:
# __IPSBAR, __RAMBAR, __RAMBAR_SIZE, __FLASHBAR, __FLASHBAR_SIZE linker
# symbols must be defined in the linker command file.

# Memory Mapped Registers (IPSBAR= 0x40000000)
   ___IPSBAR         = 0x40000000;


Outcomes