AnsweredAssumed Answered

Linker script (.lcf): placing sections of object files from a library (Kinetis)

Question asked by Konrad Anton on Feb 15, 2012
Latest reply on Mar 27, 2012 by Konrad Anton

Hello all,


my application used to fit into the internal flash of my K70 board, but now it has grown so that I have to use external Flash and external RAM. As an intermediate step, I want to get the copying of code to work from internal Flash to external RAM.


I'm using CW 10.2 for MCU. I have identified the five compilation units which contribute the code which runs before external RAM is ready for copying, and I want to use the linker script to place them in a section which executes from ROM, and the remaining code in a section which executes from RAM. 


My lcf looks like the following (grossly simplified):

MEMORY{  rom (RX): ORIGIN = 0x00000420, LENGTH=0x000FFBE0  extram (RW): ORIGIN = 0x80000000, LENGTH=0x01000000}SECTIONS{  .early_code :  {    cw.obj(.text)    __arm_eabi_init.obj(.text)  } > rom  .main_application :  {    *(.text)  } >> rom}

 When the object files for .early_code reside in the application, this works fine. However, when I try to place the code from cw.obj (from my BSP library) or __arm_eabi_init.obj (from some CW library) that way, the compiler complains that it cannot find the files cw.obj and __arm_eabi_init.obj.


"Linker command file error at line xx File not found: cw.obj"


I've tried using the names "cw.o" (like in the linker map file) and "cw.c" (like in the online help), with no improvements. Is there special syntax for placing files from libraries?