This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Flash Linker Command File



Hi Trey,

I am trying to use this flash linker file without success. Is there a switch I have to turn on in CSS to make the change from RAM to Flash?

Here's a snapshot of my memory map:

MEMORY CONFIGURATION

 

         name            origin    length      used     unused   attr    fill

----------------------  --------  ---------  --------  --------  ----  --------

  CSM_ECSL_Z1           00200000   00000030  00000000  00000030  RWIX

  FLASH                 00200030   0007ffa0  00000000  0007ffa0  R  X

  CSM_ECSL_Z2           0027ffd0   00000030  00000000  00000030  RWIX

  C0                    20000000   00002000  00000000  00002000  RW X

  C1                    20002000   00002000  00000624  000019dc  RW X

  BOOT_RSVD             20004000   00000ff8  00000000  00000ff8  R  X

  RESETISR              20004ff8   00000008  00000006  00000002  RW X

  INTVECS               20005000   000001b0  000001b0  00000000  RW X

  C2                    200051b0   00000e50  000004b4  0000099c  RW X

  C3                    20006000   00002000  00000000  00002000  RW X

  S0                    20008000   00002000  00000000  00002000  RW X

  S1                    2000a000   00002000  00000000  00002000  RW X

  S2                    2000c000   00002000  00000000  00002000  RW X

  S3                    2000e000   00002000  00000000  00002000  RW X

  S4                    20010000   00002000  00000000  00002000  RW X

  S5                    20012000   00002000  00000000  00002000  RW X

  S6                    20014000   00002000  00000000  00002000  RW X

  S7                    20016000   00002000  00000000  00002000  RW X

  CTOMRAM               2007f000   00000800  00000000  00000800  R  X

  MTOCRAM               2007f800   00000800  00000000  00000800  RW X

 

Thanks,

Tim

  • Trey,

    I think the answer to my question is to change .text section from C0 to FLASH?

    I had some other questions from another post, can you take a look? Thanks!

     

    I guess my question is also, why is __STACK_TOP = __stack + 256; or why offset by 256?

    And can you translate this line for me:

      .stack  :   >  C0 | C1 | C2 | C3

    Also, what's the meaning of > and >> when used in the linker (cmd) file?

     

    .sysmem :   >> C0 | C1 | C2 | C3

         .stack  :   >  C0 | C1 | C2 | C3

  • Tim,

    You are correct.  The "MEMORY" section you originally posted describes each of the physical memories in the device that code can be linked into.  Its the "SECTIONS" part of the file that describes where each piece of code will be linked into memory.

    STACK_TOP is used to tell the processor where to start putting stuff on the stack.  When the stack is defined the compiler creates a symbol at the lowest address of the stack, but not at the top which is where the stack starts out.  When the processor boots it looks for the address of the top of the stack and loads it from the vector table (take a look at startup_ccs.c).  The offset should match the size of the stack.

     

    > means allocate this section to this memory.  When you OR several different memories together, the linker places the section into the first available section with enough space.  The key thing to remember here is that the code section is kept contiguous in memory.

    >> allocates a section to the prescribed memories, but now the linker will split up the section across different memory ranges if need be.  Code is not guaranteed to be contiguous.  This is fine for things like .text, but splitting .stack across multiple sections will not work...

    Trey

  • Tim,

    I forgot to mention that there is a lot of good information on how the linker works in the C2000 Assembly Language Tools User Guide.  Check it out!  :)

    Trey