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.

TMS320C6713B: Place of System stack at a defined memory area (Compiler version 7.4.23)

Part Number: TMS320C6713B

Hi TI

We are facing a specific issue and would like to fix the system stack at a well defined memory area. 

We don't use the configuration tools but only have 2 configuration files in our system for controlling memory, build option, stacks, heap etc.

-  the .tcf file, in our case we'll call it: framework_dspbios_CCS5.tcf

- the .cmd file, in this case we'll call it: framework.cmd

Here is the content of the framework.cmd file:

/* This places the .boot (containing bStart) in the BMEM section
that is to be placed at 0x80000000 */

SECTIONS {
                      .boot: {} > BMEM
                      .hs: {} > IRAM
                      .fastrts: {} > IRAM
                       {
                         -lfastrts67x.lib (.text)
                       }
                    }

Here is a snip of the framework_dspbios_CCS5.tcf file:

/* loading the generic platform */
var params = {};
params.clockRate = 200;
params.deviceName = "6713";
params.catalogName = "ti.catalog.c6000";
params.regs = {};
params.regs.l2Mode = "SRAM";
utils.loadPlatform("ti.platforms.generic", params);


/* enabling DSP/BIOS components */
bios.GBL.ENABLEINST = true;
bios.MEM.NOMEMORYHEAPS = false;
bios.RTDX.ENABLERTDX = true;
bios.HST.HOSTLINKTYPE = "RTDX";
bios.TSK.ENABLETSK = true;
bios.GBL.ENABLEALLTRC = true;

bios.GBL.ENDIANMODE = "little";

bios.GBL.C621XCONFIGUREL2 = false;

/* applying user changes */
bios.SDRAM = bios.MEM.create("SDRAM");

bios.SDRAM.comment = "15M bytes of SDRAM";

bios.SDRAM.base = 0x80200000;

bios.SDRAM.len = 0x600000;

bios.SDRAM.heapSize = 0x450000;

bios.SDRAM.enableHeapLabel = 1;

bios.SDRAM.heapLabel = prog.extern("SDRAM_HEAP", "asm");

bios.PROG_MEM = bios.MEM.create("PROG_MEM");

bios.PROG_MEM.base = 0x80000100;

bios.PROG_MEM.len = 0x1fff00;

bios.PROG_MEM.createHeap = 0;

bios.PROG_MEM.space = "code/data";

bios.BMEM = bios.MEM.create("BMEM");

bios.BMEM.comment = "This is for placing the BStart() functione.";

bios.BMEM.base = 0x80000000;

bios.BMEM.len = 0x100;

bios.BMEM.createHeap = 0;

bios.BMEM.space = "code";

bios.MEM.BIOSSEG = prog.get("PROG_MEM");

bios.MEM.STACKSIZE = 0xA00; <------------------- the system stack

bios.MEM.SYSINITSEG = prog.get("PROG_MEM");

bios.MEM.GBLINITSEG = prog.get("PROG_MEM");

bios.MEM.TRCDATASEG = prog.get("PROG_MEM");

bios.MEM.BIOSOBJSEG = prog.get("SDRAM");

bios.MEM.MALLOCSEG = prog.get("SDRAM");

bios.MEM.TEXTSEG = prog.get("PROG_MEM");

bios.MEM.SWITCHSEG = prog.get("PROG_MEM");

bios.MEM.FARSEG = prog.get("SDRAM");

bios.MEM.CINITSEG = prog.get("PROG_MEM");

bios.MEM.PINITSEG = prog.get("PROG_MEM");

bios.MEM.CONSTSEG = prog.get("PROG_MEM");

bios.MEM.DATASEG = prog.get("PROG_MEM");

bios.MEM.HWISEG = prog.get("PROG_MEM");

bios.MEM.HWIVECSEG = prog.get("PROG_MEM");

bios.MEM.RTDXTEXTSEG = prog.get("PROG_MEM");

.........................

bios.IRAM.base = 0x10;

bios.IRAM.len = 0x2FFF0; <------------------ internal memory

..............

Since the IRAM (internal memory) area is from address: 0x00010-0x2FFF0 the I would like to place the system stack in the internal memory e.g. from address 0x2F5F0 - 0x2FFF0 (length = 0xA00)

Which instructions should i use?

I can imagine these instructions should be include in the framework.cmd file due to the linker. 

Since we don't have the configuration tools can you please help  with the correct instructions 

BR

Tam Tran

Vestas Wind System

  • Hi Tam Tran,

    Can you try below for addding new memory segment for system stack at IRAM at the location you provided in the tcf file?

    bios.IRAM_SYSSTACK = bios.MEM.create("IRAM_SYSSTACK");
    bios.IRAM_SYSSTACK.comment = "This is for placing the system stack";
    bios.IRAM_SYSSTACK.base = 0x2F5F0;
    bios.IRAM_SYSSTACK.len = 0xA00;
    bios.IRAM_SYSSTACK.createHeap = 0;
    bios.IRAM_SYSSTACK.space = "sys_stack";


    /* to place the system stack of length 0xA00 in IRAM */
    bios.MEM.STACKSEG = prog.get("IRAM_SYSSTACK");
    bios.MEM.STACKSIZE = 0xA00;


    /* reduce the IRAM length as end of IRAM is taken for Sys stack */
    bios.IRAM.base = 0x10;
    bios.IRAM.len = 0x2F5E0;

  • Hi Aravind

    Many thanks for your reply.

    As your instruction I have added following to the .tcf file:

    ................

    bios.IRAM_SYSSTACK = bios.MEM.create("IRAM_SYSSTACK");
    bios.IRAM_SYSSTACK.comment = "This is for placing the system stack";
    bios.IRAM_SYSSTACK.base = 0x2F5F0;
    bios.IRAM_SYSSTACK.len = 0xA00;
    bios.IRAM_SYSSTACK.createHeap = 0;
    bios.IRAM_SYSSTACK.space = "sys_stack";

    /* to place the system stack of length 0xA00 in IRAM */
    bios.MEM.STACKSEG = prog.get("IRAM_SYSSTACK");
    bios.MEM.STACKSIZE = 0xA00;


    /*bios.MEM.STACKSIZE = 0xa00;*/ <----------- delete the original

    ................

    /* reduce the IRAM length as end of IRAM is taken for Sys stack */
    bios.IRAM.base = 0x10;
    bios.IRAM.len = 0x2F5E0;

    ......

    But there is an error when i'll compile the code:

    "Illegal enumeration value: IRAM_SYSSTACK.space set to a value outside the range "code,data,code/data,reserved"

    Can you please assist

    BR

    Tam Tran

  • Hi Tam Tran,

    My bad:

    Please change bios.IRAM_SYSSTACK.space = "sys_stack"; --> bios.IRAM_SYSSTACK.space = "data";

  • Hi Aravind

    Thanks for your reply

    I'm getting further. Now the sw can build without error. But it seems like the the system stack is not located in the new memory segment (IRAM_SYSSTACK). The .stack is placed right after the .bss segment instead.

    - from the .tcf file:

    ...................

    /* reduce the IRAM length as end of IRAM is taken for Sys stack */
    bios.IRAM.base = 0x10;
    bios.IRAM.len = 0x2F5E0;

    bios.IRAM_SYSSTACK = bios.MEM.create("IRAM_SYSSTACK");
    bios.IRAM_SYSSTACK.comment = "This is for placing the system stack";
    bios.IRAM_SYSSTACK.base = 0x2F5F0;
    bios.IRAM_SYSSTACK.len = 0xA00;
    bios.IRAM_SYSSTACK.createHeap = 0;
    bios.IRAM_SYSSTACK.space = "data";

    /* to place the system stack of length 0xA00 in IRAM */
    bios.MEM.STACKSEG = prog.get("IRAM_SYSSTACK");
    bios.MEM.STACKSIZE = 0xA00;

    .................

    - From the generated map file:

    ******************************************************************************
    TMS320C6x Linker PC v7.4.23
    ******************************************************************************
    >> Linked Tue Feb 09 20:52:57 2021

    OUTPUT FILE NAME: <build\release_cc_tms6x\LSI_fdsp.out>
    ENTRY POINT SYMBOL: "_c_int00" address: 80145760


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    IRAM 00000010 0002fff0 0001ff10 000100e0 RWIX
    CACHE_L2 00030000 00010000 00000000 00010000 RWIX
    BMEM 80000000 00000100 00000040 000000c0 RWIX
    PROG_MEM 80000100 001fff00 00145a9d 000ba463 RWIX
    SDRAM 80200000 00600000 0047f184 00180e7c RWIX


    SECTION ALLOCATION MAP

    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .vers 0 00000000 0000004c COPY SECTION
    00000000 0000004c conv_framework_CT460.lib : framework_dspbios_CCS5cfg.obj (.vers)

    .hst1 0 00000010 00000010 UNINITIALIZED
    00000010 00000010 conv_framework_CT460.lib : framework_dspbios_CCS5cfg.obj (.hst1)

    .hs 0 00000020 00015e20
    00000020 00002080 DataConditionLSC.obj (.hs:_DataConditionLSC_Scan$0)
    000020a0 00002060 LSCErrorDetect.obj (.hs:_LSCErrorDetect_Scan$0)
    00004100 00001d20 Gcc.obj (.hs:_GCC_Scan$0)
    00005e20 00001300 sbm_inc_engine.obj (.hs:_ExecuteRateHigh1)
    00007120 00001300 sbm_inc_engine.obj (.hs:_ExecuteRateHigh3)
    00008420 00000f80 SysCtrlSM.obj (.hs:_SysCtrlSM_Scan$0)
    000093a0 00000e80 LVRT.obj (.hs:_LVRT_Scan$0)
    0000a220 00000ce0 LVD.obj (.hs:_LVD_Scan$0)

    ...................

    00015e00 00000020 bios.a67 : mbx.o67 ($Tramp$S$$_MBX_pend)
    00015e20 00000020 Gcc.obj ($Tramp$S$$.text:_GCC_Reset$0)

    .bss 0 00015e40 00005598 UNINITIALIZED
    00015e40 00002a24 sbm_inc_engine.obj (.bss)
    00018864 00000e74 LSI_ApplLib.lib : ParameterList.obj (.bss)
    000196d8 000006a4 conv_framework_CT460.lib : PeriodicManager.obj (.bss)
    00019d7c 0000059c sbm_inc_init.obj (.bss)
    0001a318 00000324 conv_io_flex.lib : RI_GI_FiFoDriver.obj (.bss)
    0001a63c 0000028c : DriverIF.obj (.bss)
    0001a8c8 00000018 TurbineIF.obj (.bss)

    ........................

    0001b3b0 00000004 bios.a67 : clk_data2.o67 (.bss)
    0001b3b4 00000004 : gbl_setL2CacheMode.o67 (.bss)
    0001b3b8 00000004 : idl_busy.o67 (.bss)
    0001b3bc 00000004 : knl_star.o67 (.bss)
    0001b3c0 00000004 : mem_asm.o67 (.bss)
    0001b3c4 00000004 : tsk_chec.o67 (.bss)
    0001b3c8 00000004 : tsk_disa.o67 (.bss)
    0001b3cc 00000004 conv_framework_CT460.lib : I2C_E2PROM.obj (.bss)
    0001b3d0 00000004 : msgcom.obj (.bss)
    0001b3d4 00000004 : msgsys.obj (.bss)

    .stack 0 0001b3d8 00000a00 UNINITIALIZED <----------- the system stack is NOT placed from the intended address: 0x2F5F0 but just right after .bss
    0001b3d8 00000a00 --HOLE--

    .trace 0 0001bdd8 00000200
    0001bdd8 00000200 --HOLE-- [fill = 00000000]

    ..................

    Do we miss something? Please assist

    BR

    Tam Tran

  • Hi Tam Tram,

    Sorry, you still have some issue.

    It is strange that you were able to create BMEM and I had suggested the same way to create another memory segment by name "IRAM_SYSSTACK"

    using the same way as BMEM: bios.IRAM_SYSSTACK = bios.MEM.create("IRAM_SYSSTACK");

    I do not see IRAM_SYSSTACK to be available under your map file you posted

    1. Not sure if this is due to any stale build remaining from your previous configurations. So, please delete the "Debug" folder (Or the created folder") from your project and rebuild.

    2. Repeat 1, with IRAM_SYSSTACK name replaced with "SSTK" name..

    3. After you confirm SSTK (Or whatever memory segment) you have created, you can route the system stack to that memory as I suggested before.

    4. I also see that the IRAM size is not updated to modified range.. (Lets see if that gets updated after you delete Debug folder and rebuild)

    Please let me know your output. 

    Thanks

  • Hi Aravind

    It helps pretty much with a build clean. 

    Now the SSTI segment has been made and the system stack was placed as intended 

    Many thanks for your help

    BR 

    Tam Tran

    ******************************************************************************
    TMS320C6x Linker PC v7.4.23
    ******************************************************************************
    >> Linked Wed Feb 10 08:24:31 2021

    OUTPUT FILE NAME: <build\release_cc_tms6x\LSI_fdsp.out>
    ENTRY POINT SYMBOL: "_c_int00" address: 80143300


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    IRAM 00000010 0002f5e0 0001f350 00010290 RWIX
    SSTI 0002f5f0 00000a00 00000a00 00000000 RWIX
    CACHE_L2 00030000 00010000 00000000 00010000 RWIX
    BMEM 80000000 00000100 00000040 000000c0 RWIX
    PROG_MEM 80000100 001fff00 0014364d 000bc8b3 RWIX
    SDRAM 80200000 00600000 0047ed38 001812c8 RWIX

    .........................

    text 0 0001f1e0 00000180
    0001f1e0 00000180 fastrts67x.lib : expsp.obj (text)

    .stack 0 0002f5f0 00000a00 UNINITIALIZED
    0002f5f0 00000a00 --HOLE--

    ...............

    0002f5f0 GBL_stackbeg
    0002ffef GBL_stackend

    ................

  • Hi Aravind

    The issue is now resolved. I can now place the system stack as I want. Many thanks for your support

    I have anothe rquestion. I don't know if i can raise it here or do i need to start a new thread:

    - We have a platform using C6713 and using the compiler version 7.4.23. We are facing some area where the there are some sensitive code that leads to random sw crash. What do you recomend as compiler version which is newer than 7.4.23?

    I've try to compile with 8.3.3 but it seems like this version didn't support the C6713 platform.

    BR

    Tam Tran

  • Hi Tam Tran,

    Glad to know that you are now able to place the system stack at your desired location.

    Since the original issue is resolved. Please close this issue at your side and open a new thread for your next question.

    Thanks,

  • Hi Aravind

    I did marked this problem as "resolved"

    I have also open a new thread regarding the compiler version for the C6713 platform: 

    Compiler/TMS320C6713B: TMS320C6713 / compiler version

    It would like to appreciate if you can help me with this issue as well

    Thanks in advance

    BR

    Tam Tran