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.

static tsk object in dspbios



Hi

I'm using a C++ image compression apllication on dsp C64x+ with dspbios  but I can't process images larger than 1Mo.It seems to be an allocation memory problem, the application freeze on MEM_free. I read in TMS320 DSP/BIOS v5.41 User’s Guide that  new and delete should be used by TSK objects only.  I tried to create a static tsk object in Tconf but Iget unresolved symbol at link on the function associated to tsk object.

Here is my configuration script

 

 

utils.loadPlatform("ti.platforms.evmDM6467T");

 

/* The following DSP/BIOS Features are enabled.  */

bios.enableRealTimeAnalysis(prog);

bios.enableRtdx(prog);

bios.enableTskManager(prog);

 

bios.GBL.SPECIFYRTSLIB = 1;

bios.GBL.RTSLIB = "rts64plus_eh.lib";

bios.MEM.STACKSIZE = 0x4000;

bios.MEM.NOMEMORYHEAPS = 0;

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

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

bios.MEM.BSSSEG = prog.get("DDR2");

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

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

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

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

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

bios.MEM.CIOSEG = prog.get("DDR2");

bios.MEM.instance("DDR2").createHeap = 1;

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

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

bios.GBL.C64PLUSMAR128to159 = 0x0000ffff;

bios.GBL.C64PLUSL2CFG = "0k";

bios.MEM.instance("DDR2").heapSize = 0x02512d00;

bios.GBL.C64PLUSL2CFG = "64k";

bios.MEM.instance("CACHE_L2").space = "data";

bios.MEM.instance("IRAM").len = 0x00010000;

bios.MEM.instance("CACHE_L2").space = "data";

bios.MEM.instance("IRAM").space = "code/data";

bios.MEM.USERCOMMANDFILE = 0;

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

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

bios.MEM.instance("ARM_RAM").space = "code/data";

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

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

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

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

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

bios.MEM.ENABLELOADADDR = 1;

bios.MEM.LOADBIOSSEG = prog.get("ARM_RAM");

bios.MEM.LOADSYSINITSEG = prog.get("ARM_RAM");

bios.MEM.LOADHWISEG = prog.get("ARM_RAM");

bios.MEM.LOADRTDXTEXTSEG = prog.get("ARM_RAM");

bios.MEM.LOADBIOSSEG = prog.get("IRAM");

bios.MEM.LOADSYSINITSEG = prog.get("IRAM");

bios.MEM.LOADHWISEG = prog.get("IRAM");

bios.MEM.LOADRTDXTEXTSEG = prog.get("IRAM");

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

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

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

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

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

bios.MEM.ENABLELOADADDR = 0;

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

bios.GBL.ENABLEALLTRC = 0;

bios.STS.OBJMEMSEG = prog.get("ARM_RAM");

bios.LOG.create("trace");

bios.LOG.OBJMEMSEG = prog.get("IRAM");

bios.LOG.instance("LOG_system").bufSeg = prog.get("IRAM");

bios.GBL.ENABLEALLTRC = 1;

bios.TSK.create("TSK0");

bios.TSK.instance("TSK0").order = 1;

bios.TSK.STACKSEG = prog.get("DDR2");

bios.TSK.instance("TSK0").priority = 15;

bios.TSK.instance("TSK0").fxn = prog.extern("Uncomp", "asm");

// !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!

 

prog.gen();

 

 

EVM : DM6467T

CCSv 4.1

DSP/BIOS 5.41.02.14

C6000 7.0.1 compiler

Windows 7 pro 64 bits

Any help would be great

Thanks,

CC

 

  • Did you resolve this issue?  It wasn't clear from your description what was going on.  It sounds like your fundamental problem is a linker error?

  • Hi,

    It was a linker problem because when you make changes in DSP/BIOS configuration tool, it keeps the old configuration in the scrpt  Now it 's ok , I suppressed the line bios.TSK.instance("TSK0").fxn = prog.extern("Uncomp", "asm");

    In the first place, it was a memory allocation problem. If I try to compress/uncompress image larger than 1Mo with my codec, It doesn't work, most of the time, it freezes in MEM_free, so I thouht about using task but it's not better at the moment. 

    Any help is welcomed

    CC

     

  • You should definitely only be calling the MEM_alloc/free functions from a task.  So did you get that working?  I believe your issue was that you forgot to put a leading underscore in the bios config GUI.  For example if your function is called "myfunc" you need to enter the symbol as "_myfunc" since you are entering the assembly label.

  • Hi brad,

     I got the task working but I still have the same problem, the application freeze in a MEM_free call. The strange thing is that it happens only with images larger than 1 MB.

    It works fine for some delete in my application but not far from the end of uncompressing process (I wasn't able yet to find where from is the MEM_free call )  it freezes in MEM_free.

    CC

  • What do you mean by "freeze"?  That the call to MEM_free() never returns?  Is the entire application aborting?  Do other tasks continue to run?

     

  • Yes the call to MEM_free() never return. I have only one task running, so the entire application is stopped.

  • The only thing I can think of that would cause this problem would be if your MEM free list is somehow corrupted.   MEM maintains a free list of available memory.   This list is sorted by address.  MEM_free() traverses this list looking for the right slot to insert the free block.  If the linked list is corrupted (bad memory write by some other part of the application), then the free list could be inconsistent and might even have a loop so MEM_free() will loop forever.   Can you try using Kernel/Object View  (KOV) (if you are in CCSv3) or the ROV (runtime object view in CCSv4) to inspect the MEM module?   These tools will show you the status of the MEM heaps.  If the heaps are corrupt, these tools will generate an error.   Check the state of the MEM heaps at main(), and again right after you alloc the big block, and again right before you call MEM_free().

  • Along the lines of what Karl mentions, here is an entire wiki page devoted to various issues that commonly cause unpredictable behavior in the program:

    http://processors.wiki.ti.com/index.php?title=DSP_BIOS_Debugging_Tips

    Let us know if you have found the root cause yet.

  • I checked the heap with ROV and everything seems ok untill the MEM_free() call

    I get this message after bieng stopped in MEM_free()

    Received exception from ROV server: "baseAddr" is undefined (C:/Program Files

    I suppress the delete that causes the MEM_free() crash and now my application crashes somewhere else, although it was running fine with smaller image.

    There  are many stange things :

    it works fine with smaller images (1MB) 

    with large images it doesn't crash at the first call of this delete or others delete 

    application using new and delete  not called from a task runs well with small image (1MB) 

  • It looks like something is corrupting the heap.   Is is possible to make a test case and attach as .zip file to this forum so that we can build and run here?  Will your app run on a standard EVM?

    What is the size of your alloc and free?   Can you verify that the size parameter that you pass to MEM_free() matches the size parameter you passed to MEM_alloc()?  And that the 'ptr' parameter to MEM_free() is same as the ptr returned from MEM_alloc()?

    Thanks,
    -Karl-