AnsweredAssumed Answered

How to split ".text" section into two memory segments on linker .lcf file

Question asked by Andres Villalobos on Mar 9, 2015
Latest reply on Mar 10, 2015 by Jorge_Gonzalez



I'm using CW 10.1 with Coldfire MCF51MM128 and I'm having problem when the code reach more than 0x0000FFE8 getting the following linker error:

>Overflow in segment: code from section: .text

>Segment reserved size is: 0x0000ffe8 -- Overflow of: 0x00000620

By default CW creates two memory segments for flash flash, as below:

code        (RX)  : ORIGIN = 0x00000414, LENGTH = 0x0000FFE8

code_00010410 (RX) : ORIGIN = 0x00010410, LENGTH = 0x0000FBF0

and the .text segment is declared by default as:

.text :



    . = ALIGN (0x4);


    . = ALIGN (0x4);

    ___ROM_AT = .;

    ___DATA_ROM = .;

  } >> code

On my understanding it does this because this mcu has 2 flash controllers and @0x0000040D @0x0001040D some non volatile registers (like the flash protection registers) are located.making the memory for code non continuous.

Now, how can I tell the linker to use both memory segments ("code" and "code_00010410") for ".text" section?

I believe this is the root cause of the linker error message.

Thanks in advance,