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.

Customizing memory .cmd file

Hi there,

I am using CCSv6 on Windows 7 with the TMS320C6713.

I've been reading the memory management sections from the "C6000 Integration Workshop Student Guide" Revision 3.1a but I have some questions I would love help with.

Below is my current C6713.cmd file. Originally all the sections were allocated to IRAM. I understand that this is supposed to be customized, but how much are you able to change? Are you allowed to change the addresses in the MEMORY{} block? If they aren't dictated by hardware constraints then by how much can you expand or contract them? 

Also, I would appreciate it if you could help me with what Sections should be using which Memory. The workshop pdf touches on .text, .cinit, .bss, .stack, and .cio, but it doesn't speak of the others. There were four errors when building the code with sections that wouldn't fit into IRAM. I corrected three of these (as you can see in the cmd below, I put .text in flash because of the workshop but it didn't have an error ) but I don't know what to do with the .far. It is size 0x4046c which is larger than the entire IRAM is. 

This leads back to my original questions. To fix this should I change .far to another memory location, if so how do I know which one? Or should I change IRAM (that doesn't sound possible)?  

Thank you very much for any help you can give me!

/****************************************************************************/
/*  C6713.cmd                                                               */
/*  Copyright (c) 2010 Texas Instruments Incorporated                       */
/*  Author: Rafael de Souza                                                 */
/*                                                                          */
/*    Description: This file is a sample linker command file that can be    */
/*                 used for linking programs built with the C compiler and  */
/*                 running the resulting .out file on an TMS320C6713        */
/*                 device.  Use it as a guideline.  You will want to        */
/*                 change the memory layout to match your specific C6xxx    */
/*                 target system.  You may want to change the allocation    */
/*                 scheme according to the size of your program.            */
/*                                                                          */
/****************************************************************************/

MEMORY
{
    IRAM     o = 0x00000000  l = 0x00030000  /* 192kB - Internal RAM */
    L2RAM    o = 0x00030000  l = 0x00010000  /* 64kB - Internal RAM/CACHE */
    EMIFCE0  o = 0x80000000  l = 0x10000000  /* SDRAM in 6713 DSK */
    EMIFCE1  o = 0x90000000  l = 0x10000000  /* Flash/CPLD in 6713 DSK */
    EMIFCE2  o = 0xA0000000  l = 0x10000000  /* Daughterboard in 6713 DSK */
    EMIFCE3  o = 0xB0000000  l = 0x10000000  /* Daughterboard in 6713 DSK */
}

// These were all IRAM initially before I changed them

SECTIONS
{
    .text          >  EMIFCE1
    .stack         >  IRAM
    .bss           >  IRAM
    .cio           >  EMIFCE0
    .const         >  IRAM
    .data          >  IRAM
    .switch        >  IRAM
    .sysmem        >  EMIFCE0
    .far           >  IRAM
    .args          >  IRAM
    .ppinfo        >  IRAM
    .ppdata        >  IRAM
  
    /* COFF sections */
    .pinit         >  IRAM
    .cinit         >  EMIFCE1
  
    /* EABI sections */
    .binit         >  IRAM
    .init_array    >  IRAM
    .neardata      >  IRAM
    .fardata       >  IRAM
    .rodata        >  IRAM
    .c6xabi.exidx  >  IRAM
    .c6xabi.extab  >  IRAM
}

  • Hi,

    The file is completely customizable, but as you guessed it will be constrained to whatever the hardware physically has. In the specific case of this file, its structure matches the hardware present on a C6713 DSK board.

    A few highlights that may help you:

    - If you are not using the L2 cache, then the L2RAM memory space can be merged with the IRAM. In this case you would comment out the L2RAM line and increase IRAM's length to 0x40000.

    - Given the size of your .far section, you have no option other than allocate it in external RAM. If you are using a C6713DSK, you can simply rewrite it to:  .far > EMIFCE0

    - Be careful when allocating the .text section to EMIFCE1, especially if you are still at the develop/debug phase of your project. The reason is that CCS is unable to write to this memory (as it is an external flash device), therefore I would allocate it to RAM (either internal or external). If you are using the C6713DSK, you can use the Flashburn utility to flash its external Flash device (I think the workshop mentions that).

    In general you will want to allocate initialized sections to non-volatile memory and un-initialized sections to RAM. Details can be seen in section 5.3.5 of the C6000 Compiler User's guide (SPRU187).

    Hope this helps,

    Rafael