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.

Can not get more heap space ?

Other Parts Discussed in Thread: OMAP-L138, OMAPL138, OMAP-L137, CCSTUDIO

Using
bios_5_41_07_24
OMAP-L138 ZOOM OMAP-L138 EVM w OMAP-L138 SOM hardware platform
CCS 3.3.81.11
OMAPL138_DSP.gel

Hello: I am trying to call the DSP/BIOS API MEM_alloc(DDRHEAP, 131056, 0);
I have defined a heap in MEM DDR in DSP/BIOS config or i.e the .tcf file(s)


from dsplink-omapl138gem-base.tci
/*  ============================================================================
 *  Load assert support
 *  ============================================================================
 */
utils.importFile("assert.tci");

/*  ============================================================================
 *  Load base TCI file.
 *  ============================================================================
 */
utils.loadPlatform("ti.platforms.evmOMAPL138") ;

/*  ============================================================================
 *  Enable common BIOS features used by all examples
 *  ============================================================================
 */
bios.disableRealTimeAnalysis(prog);
bios.enableMemoryHeaps(prog);
bios.disableRtdx(prog);
bios.enableTskManager(prog);

/*  ============================================================================
 *  GBL
 *  ============================================================================
 */
prog.module("GBL").ENABLEALLTRC    = false ;

/* BEF CHANGED per processors.wiki.ti.com/index.php/CCS_Project_OMAP-L137_HelloDSP_DSPLINK_example */
/* prog.module("GBL").PROCID          = parseInt (arguments [0]) ; */
prog.module("GBL").PROCID          = 0;


prog.module("GBL").C64PLUSCONFIGURE   = true   ;
prog.module("GBL").C64PLUSL2CFG       = "32k" ;
prog.module("GBL").C64PLUSL1DCFG      = "32k"  ;
prog.module("GBL").C64PLUSMAR192to223 = 0x00000008 ;


/*  ============================================================================
 *  MEM
 *  ============================================================================
 */
prog.module("MEM").STACKSIZE = 0x1000 ;

/*  ============================================================================
 *  MEM : RESET_VECTOR
 *  ============================================================================
 */
var RESET_VECTOR = prog.module("MEM").create("RESET_VECTOR");
RESET_VECTOR.base        = 0xC3E00000 ;
RESET_VECTOR.len         = 0x00000080;
RESET_VECTOR.space       = "code/data";
RESET_VECTOR.createHeap  = false;
RESET_VECTOR.comment     = "RESET_VECTOR";

/*  ============================================================================
 *  MEM : DDR
 *  ============================================================================
 */
var DDR = prog.module("MEM").instance("DDR");
DDR.base             = RESET_VECTOR.base + RESET_VECTOR.len ;
DDR.len              = 0xFFF80;   
DDR.space            = "code/data";
DDR.createHeap       = true;
DDR.heapSize         = 0x10000;    <--------------- Tryed to change this as well makes no difference see below.
DDR.comment          = "DDR";

/*  ============================================================================
 *  MEM : DSPLINKMEM
 *  ============================================================================
 */
var DSPLINKMEM = prog.module("MEM").create("DSPLINKMEM");
DSPLINKMEM.base             = DDR.base + DDR.len;
DSPLINKMEM.len              = 0x30000;
DSPLINKMEM.createHeap       = false;
DSPLINKMEM.comment          = "DSPLINKMEM";

/*  ============================================================================
 *  MEM : POOLMEM
 *  ============================================================================
 */
var POOLMEM = prog.module("MEM").create("POOLMEM");
POOLMEM.base        = DSPLINKMEM.base + DSPLINKMEM.len ;
POOLMEM.len         = 0xD0000 ;
POOLMEM.createHeap  = false;
POOLMEM.comment     = "POOLMEM";

/*  ============================================================================
 *  MEM : IRAM
 *  ============================================================================
 */
var IRAM    = prog.module("MEM").instance("IRAM");
IRAM.base   = 0x11800000 ;
IRAM.len    = 0x8000 ;

-------------------------------------------------------------------------------------------
Appaplical fragments from my.tci file

utils.importFile("dsplink-omapl138gem-base.tci");
..
...
....

bios.MEM.instance("DDR").createHeap = 1;
bios.MEM.instance("DDR").heapSize = 0x00030000;  <--------------- Makes no difference see below.
bios.MEM.instance("DDR").enableHeapLabel = 1;
bios.MEM.instance("DDR").heapLabel = prog.extern("DDRHEAP");

bios.MEM.BIOSOBJSEG = prog.get("DDR");
bios.MEM.MALLOCSEG = prog.get("DDR");
bios.TSK.STACKSEG = prog.get("DDR");
-------------------------------------------------------------------------------------------
I am just trying to test this, so MEM_Alloc is the first thing I am calling out of main in the applaction.
I am getting a null pointer back from MEM_alloc(DDRHEAP, 131056, 0);
Obviously, does not have enough memory available to preform the operation.

Upon examining the Kernal Oblect View for MEM--DDR it showes
NAME DDR
LargestFree Block 0xFFF8
Free Mem 0xFFF8
Used Mem 0x8
Total Size 0x10000
Start Address 0C3E11E60
End Address 0xC3E21E5F

Further with a call to MEM_stat from main before the MEM_Alloc call
static Void printmem(Int segid)
{
MEM_Stat statbuf;
MEM_stat(segid, &statbuf);
}
as in printmem(DDRHEAP);

It reflects the same information as the Kernal Object View
as in
segid = 0
statebuf.size = 0x00010000
statebuf.used = 0x00000008
statebuf.length = 0x0000FFF8
statebuf.space    = 0x00000001

Now matter how big or how small I make bios.MEM.instance("DDR").heapSize
It is always the same statebuf.size / Total Size 0x10000 in Kernal object viewer. 
Likewise if I rearrange and change the length of DSPLINKMEM.len to give more memory to this section it still makes no difference.

Please help, what am I doing wrong hear?

  • Brian Flinn said:
    from dsplink-omapl138gem-base.tci

    Since all of these definitions come from a *.tci file I assume you have a *.tcf file elsewhere that includes that file.  Since your changes in this file have no effect there are a couple possibilities that come to mind:

    1. Perhaps there is another copy of this file being picked up by the include, so nothing you do is being seen by the tools.
    2. Perhaps the *.tcf file is setting the size of this heap.  It will be the last reference that actually programs the heap size, so if the *.tcf sets the heap size to 0x10000 then nothing you do in the *.tci file will change that.

    Brad

  • Thanks Brad:
    I have searched for a "rouge" / stray copy(s) of .tcf file being included and don't seem to find any.

    Sorry typo above "Appaplical fragments" are from my .tcf file not .tci file
    However, hear is my entire .tcf file

    ----------------------------------------------------------------
    utils.importFile("dsplink-omapl138gem-base.tci");

    bios.setMemCodeSections(prog, DDR);
    bios.setMemDataNoHeapSections(prog, DDR);
    bios.setMemDataHeapSections(prog, DDR);

    prog.module("MEM").BIOSOBJSEG = DDR;
    prog.module("MEM").MALLOCSEG  = DDR;

    prog.module("TSK").STACKSEG = DDR;


    bios.MEM.STACKSEG = prog.get("IRAM");
    bios.MEM.DATASEG = prog.get("IRAM")
    bios.MEM.BSSSEG = prog.get("IRAM");
    bios.MEM.TEXTSEG = prog.get("IRAM");

    bios.SEM.create("xmt_ping_sem");
    bios.SEM.create("xmt_pong_sem");
    bios.SEM.create("rcv_ping_sem");
    bios.SEM.create("rcv_pong_sem");

    bios.TSK.create("audio_tsk");
    bios.TSK.instance("audio_tsk").order = 1;
    bios.TSK.instance("audio_tsk").fxn = prog.extern("audio_tsk_fxn");

    bios.HWI.instance("HWI_INT8").useDispatcher = 1;
    bios.HWI.instance("HWI_INT8").interruptMask = "none";
    bios.HWI.instance("HWI_INT8").fxn = prog.extern("edma3ccIsr");

    bios.IDL.create("IDL_ledToggle");
    bios.IDL.instance("IDL_ledToggle").order = 1;
    bios.IDL.instance("IDL_ledToggle").fxn = prog.extern("ledToggle");
    bios.LOG.OBJMEMSEG = prog.get("IRAM");
    bios.LOG.instance("LOG_system").bufSeg = prog.get("IRAM");
    bios.LOG.instance("LOG_system").bufLen = 1024;

    bios.TSK.instance("audio_tsk").stackMemSeg = prog.get("IRAM");
    bios.SEM.OBJMEMSEG = prog.get("IRAM");
    bios.TSK.OBJMEMSEG = prog.get("IRAM");
    bios.SWI.OBJMEMSEG = prog.get("IRAM");
    bios.TSK.instance("TSK_idle").stackMemSeg = prog.get("IRAM");

    bios.MEM.TEXTSEG = prog.get("DDR");
    bios.MEM.BSSSEG = prog.get("DDR");
    bios.MEM.DATASEG = prog.get("DDR");
    bios.MEM.STACKSEG = prog.get("DDR");

    bios.MEM.ENABLELOADADDR = 0;

    bios.MEM.instance("DDR").len = 0x0011cf80;
    bios.MEM.instance("DDR").createHeap = 1;
    bios.MEM.instance("DDR").heapSize = 0x00030000;
    bios.MEM.instance("DDR").enableHeapLabel = 1;
    bios.MEM.instance("DDR").heapLabel = prog.extern("DDRHEAP");

    bios.MEM.BIOSOBJSEG = prog.get("DDR");
    bios.MEM.MALLOCSEG = prog.get("DDR");
    bios.TSK.STACKSEG = prog.get("DDR");

    bios.MEM.instance("POOLMEM").base = 0xc3f4d000;
    bios.MEM.instance("DSPLINKMEM").base = 0xc3f1d000;

    bios.GBL.C64PLUSMAR192to223 = 0xffffffff;
    bios.GBL.C64PLUSMAR192to223 = 0x00000008;

    // !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!

    prog.gen();

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

    The ("dsplink-omapl138gem-base.tci") file for the utils.importFile is located in this projects directory and is listed hear.
    ----------------------------------------------------------------

    /*  ============================================================================
     *  Load assert support
     *  ============================================================================
     */
    utils.importFile("assert.tci");

    /*  ============================================================================
     *  Load base TCI file.
     *  ============================================================================
     */
    utils.loadPlatform("ti.platforms.evmOMAPL138") ;

    /*  ============================================================================
     *  Enable common BIOS features used by all examples
     *  ============================================================================
     */
    bios.disableRealTimeAnalysis(prog);
    bios.enableMemoryHeaps(prog);
    bios.disableRtdx(prog);
    bios.enableTskManager(prog);

    /*  ============================================================================
     *  GBL
     *  ============================================================================
     */
    prog.module("GBL").ENABLEALLTRC    = false ;

    /* BEF CHANGED per processors.wiki.ti.com/index.php/CCS_Project_OMAP-L137_HelloDSP_DSPLINK_example */
    /* prog.module("GBL").PROCID          = parseInt (arguments [0]) ; */
    prog.module("GBL").PROCID          = 0;


    prog.module("GBL").C64PLUSCONFIGURE   = true   ;
    prog.module("GBL").C64PLUSL2CFG       = "32k" ;
    prog.module("GBL").C64PLUSL1DCFG      = "32k"  ;
    prog.module("GBL").C64PLUSMAR192to223 = 0x00000008 ;


    /*  ============================================================================
     *  MEM
     *  ============================================================================
     */
    prog.module("MEM").STACKSIZE = 0x1000 ;

    /*  ============================================================================
     *  MEM : RESET_VECTOR
     *  ============================================================================
     */
    var RESET_VECTOR = prog.module("MEM").create("RESET_VECTOR");
    RESET_VECTOR.base        = 0xC3E00000 ;
    RESET_VECTOR.len         = 0x00000080;
    RESET_VECTOR.space       = "code/data";
    RESET_VECTOR.createHeap  = false;
    RESET_VECTOR.comment     = "RESET_VECTOR";

    /*  ============================================================================
     *  MEM : DDR
     *  ============================================================================
     */
    var DDR = prog.module("MEM").instance("DDR");
    DDR.base             = RESET_VECTOR.base + RESET_VECTOR.len ;
    DDR.len              = 0xFFF80;
    DDR.space            = "code/data";
    DDR.createHeap       = true;
    DDR.heapSize         = 0x10000;
    DDR.comment          = "DDR";

    /*  ============================================================================
     *  MEM : DSPLINKMEM
     *  ============================================================================
     */
    var DSPLINKMEM = prog.module("MEM").create("DSPLINKMEM");
    DSPLINKMEM.base             = DDR.base + DDR.len;
    DSPLINKMEM.len              = 0x30000;
    DSPLINKMEM.createHeap       = false;
    DSPLINKMEM.comment          = "DSPLINKMEM";

    /*  ============================================================================
     *  MEM : POOLMEM
     *  ============================================================================
     */
    var POOLMEM = prog.module("MEM").create("POOLMEM");
    POOLMEM.base        = DSPLINKMEM.base + DSPLINKMEM.len ;
    POOLMEM.len         = 0xD0000 ;
    POOLMEM.createHeap  = false;
    POOLMEM.comment     = "POOLMEM";

    /*  ============================================================================
     *  MEM : IRAM
     *  ============================================================================
     */
    var IRAM    = prog.module("MEM").instance("IRAM");
    IRAM.base   = 0x11800000 ;
    IRAM.len    = 0x8000 ;

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

    In the CCS 3.x File Specific Options for the .tcf file there is nothing other then Basic which has $(Proj_dir) as the -Dcnfig.importPath

    Compiling just the .tcf file produces this
    [audio_edma_c6748.tcf] "C:\CCStudio_v3.3\bios_5_41_07_24\xdctools\tconf" -b -Dconfig.importPath="J:/audio_edma_bob_engine_v1;C:/CCStudio_v3.3/bios_5_41_07_24/packages" audio_edma_c6748.tcf

    J:/audio_edma_bob_engine_v1 is where this project is located.

    The dsplink-omapl138gem-base.tci has not been modified from stock other then where commented per

    /* BEF CHANGED per processors.wiki.ti.com/index.php/CCS_Project_OMAP-L137_HelloDSP_DSPLINK_example */


    I have "intentionally" put garbage in both the .tcf and .tci file and the compiler does flag the garbage when put in ether file.


    So I'm very certain that at least the audio_edma_c6748.tcf and dsplink-omapl138gem-base.tci are being compiled from where I expect...

    Any other "stray files"... I can not find them...
    And would they not have to be in the -Dcnfig.importPath ?

    Any further hints / suggestions / solutions would be appreciated..

    Thanks
    Brian

  • Brad: etc.

    My bad !!

    I have a user.cmd file (the only .cmd file in the Source File view for the project) where I am defining my own SECTIONS for some critical code and data in my app.

    In it, I am including the Configuration Tool generated xcfg.cmd file with a "hard coded" path... as in

    file user.cmd

    J:\c6747_audio_edma_v2\audio_edma_c6747cfg.cmd          <--------------------- BAD THING TO DO !
    SECTIONS
    {   
        .audio_buf      :>IRAM
        .critical_code    :>IRAM
    }

    It should have been pointing to location of the new / modified project as in

    J:\audio_edma_bob_engine_v1\audio_edma_bobcfg.cmd   <----------  Still a bad thing to do
    SECTIONS
    {    
        .audio_buf      :>IRAM
        .critical_code    :>IRAM
    }

    I have it fixed now to not include a "hard coded" path to the Configuration Tool generated xcfg.cmd and the generated file is in the Source File view for the project, so there are now 2 .cmd files in the Source File view for the project, so its not hidden where you wouldn't think about it... and cause me to question other things.

    Thanks

    Brian

    Please close this thread as answered...

     

     

  • Brian,

    Thanks for letting us know what the root cause of your issue was.  That makes sense that the hard-coded path could lead to this behavior.  Also, I agree with your solution, i.e. the proper way to setup your project is to remove the reference altogether and have 2 command files as part of the project.

    Brad