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.

RTOS/TMS320C6670: Priority 1

Part Number: TMS320C6670
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hello!

I'm playing with the basic NDK example. And I decided to add a new task.

my netopenhook:

 void NetOpenHook()
{
  platform_write (" ok");
  Error_init(&eb);
   Task_Params_init(&taskParams);
  taskParams.stackSize = 2048;
  taskParams.priority = 4; //OS_TASKPRINORM;//OS_TASKPRINORM;
  ETH_Task_hndl = Task_create((Task_FuncPtr)Task2Func , &taskParams, &eb);
  if (ETH_Task_hndl == NULL) {
	printf("Task create failed");
   }
    hHello = DaemonNew( SOCK_DGRAM, 0,12288,dtask_udp_hello,OS_TASKPRINORM,OS_TASKSTKNORM, 0, 1 );
   
}

my task:

void Task2Func(void)
{
 printf("here is no sock or ndk");
 static int ii=0;
 int lichi;
 int tmp1;
 while(1)
 {
  printf("here is no sock or ndk");
  xx=xx+0.01;
  yy= sin(xx);
  res[iter]=yy;
  iter++;
  if (iter==800)
   iter=0;
 }

}

And all works well. Daemon (server)  does not  interupt my task and it (task) works without interupts.

But when I'm set taskParams.priority to 1.. Server works  and  my PC application receive answer from server.
But server  works not long. After 3-4 pollings  I  receive error message  in  console  in debug mode.

Error:

ti.sysbios.heaps.HeapMem: line 294: out of memory: handle=0x138e88d8, size=4096
xdc.runtime.Error.raise: terminating execution

And I have two questions:

1. Why Server interupt task only when  taskParams.priority = 1?

2. Who and how causes this error?

Thanks.



 

     

  

  • I've forwarded your query to the software experts. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • Hi,

    In the NDK, the netopenhook() where the Daemon created is part of the StackTest() function, this is task configured in .cfg with:

    var tskNdkStackTest = Task.create("&StackTest");
    tskNdkStackTest.stackSize = 0x1400;
    tskNdkStackTest.priority = 0x5;

    How you NetOpenHook() started? Is this part of the SYSBIOS task? What if you change Task2Func() task priority with a higher number like 6 or 10?

    If the SYSBIOS crashed with heap issue, can you increase the heap to see if it helps?

    Regards, Eric
  • Hi,

    My config is

    var Memory  =   xdc.useModule('xdc.runtime.Memory');
    
    var BIOS    =   xdc.useModule('ti.sysbios.BIOS');
    
    var Task    =   xdc.useModule('ti.sysbios.knl.Task');
    
    /////// sss //////
    var HeapBuf =   xdc.useModule('ti.sysbios.heaps.HeapBuf');
    
    var Log     =   xdc.useModule('xdc.runtime.Log');
    var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    var Ip = xdc.useModule('ti.ndk.config.Ip');
    var Udp = xdc.useModule('ti.ndk.config.Udp');
    
    /*
    ** Allow storing of task names. By default if you name a task with a friendly display name it will not be saved
    ** to conserve RAM. This must be set to true to allow it. We use friendly names on the Task List display.
    */
    //Defaults.common$.namedInstance = true; 
    Task.common$.namedInstance = true;
    
    /* 
    ** Interface with IPC. Depending on the version of BIOS you are using the 
    ** module name may have changed.
    */
    /* Use this for pre BIOS 6.30 */
    /* var Sem	    =	  xdc.useModule ('ti.sysbios.ipc.Semaphore'); */
    
    /* Use this for BIOS 6.30 plus to get the IPC module */
    var Sem	= xdc.useModule ('ti.sysbios.knl.Semaphore');
    
    var Hwi	= xdc.useModule ('ti.sysbios.hal.Hwi');
    
    var Ecm = xdc.useModule ('ti.sysbios.family.c64p.EventCombiner');
    
    /*
    ** Configure this to turn on the CPU Load Module for BIOS.
    **
    */
    /*
    var Load       =   xdc.useModule('ti.sysbios.utils.Load');
    Load.common$.diags_USER4 = Diags.ALWAYS_ON;
    */
    
    var Diags       = xdc.useModule('xdc.runtime.Diags');
    
    
    /* Load the CSL package */
    var Csl 					    = 	xdc.useModule('ti.csl.Settings');
    
    /* Load the CPPI package */
    var Cppi                        =   xdc.loadPackage('ti.drv.cppi');     
    
    /* Load the QMSS package */
    var Qmss                        =   xdc.loadPackage('ti.drv.qmss');
    
    /* Load the PA package */
    var Pa 							= 	xdc.useModule('ti.drv.pa.Settings');
    
    /* Load the Platform/NDK Transport packages */
    /////// sss ////// 
    var PlatformLib  = xdc.loadPackage('ti.platform.evmc6670l');
    var NdkTransport = xdc.loadPackage('ti.transport.ndk');
    
    /* 
    ** Sets up the exception log so you can read it with ROV in CCS 
    */
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Exc = xdc.useModule('ti.sysbios.family.c64p.Exception');
    Exc.common$.logger = LoggerBuf.create();
    Exc.enablePrint = true; /* prints exception details to the CCS console */
    
    /*
    **  Give the Load module it's own LoggerBuf to make sure the
    **  events are not overwritten.
    */
    /* var loggerBufParams = new LoggerBuf.Params();
    loggerBufParams.exitFlush = true;
    loggerBufParams.numEntries = 64;
    Load.common$.logger = LoggerBuf.create(loggerBufParams); 
    */
    
    /*
    ** Use this load to configure NDK 2.2 and above using RTSC. In previous versions of
    ** the NDK RTSC configuration was not supported and you should comment this out.
    */
    var Global       = xdc.useModule('ti.ndk.config.Global');
    ///////Global.autoOpenCloseFD = true;   //// sss ////
    Global.stackLibType = Global.MIN;
    /* 
    ** This allows the heart beat (poll function) to be created but does not generate the stack threads 
    **
    ** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
    ** to create any stack threads (services) as we configure those ourselves in our Main Task
    ** thread hpdspuaStart.
    */  
    Global.enableCodeGeneration = 
    true;
    // false;
    
    
    /* Define a variable to set the MAR mode for MSMCSRAM as all cacheable */
    var Cache       =   xdc.useModule('ti.sysbios.family.c66.Cache');
    //Cache.MAR224_255 = 0x0000000f;
    
    
    var Startup     =   xdc.useModule('xdc.runtime.Startup');
    
    var System      =   xdc.useModule('xdc.runtime.System');
    
    
    
    /*
    ** Create a Heap. 
    */
    /*  ///////////// sss MAMORY MAP /////////////// */ /**/
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 0x30000;//0x30000;// 0x30000-MIN!!!!;//////0x300000;
    heapMemParams.sectionName = "systemHeap";
    Program.sectMap["systemHeap"] =  "MSMCSRAM"; //// sss //// "DDR3";//
    Program.global.heap0 = HeapMem.create(heapMemParams);
    Memory.defaultHeapInstance  =   Program.global.heap0;
    
    /* This is the default memory heap. */
    ////////// sss /////
    //Memory.defaultHeapInstance  =   Program.global.heap0;
    Program.sectMap["sharedL2"] = "L2SRAM"; 
    ////// sss /////  Program.sectMap["systemHeap"] = "MSMCSRAM";
    Program.sectMap[".sysmem"]  = "L2SRAM";
    Program.sectMap[".args"]    = "L2SRAM";
    Program.sectMap[".cio"]     = "L2SRAM";
    Program.sectMap[".far"] 	= 	"L2SRAM";
    Program.sectMap[".rodata"] 	= 	"L2SRAM";
    Program.sectMap[".neardata"]= 	"L2SRAM";
    Program.sectMap[".cppi"] 	= 	"L2SRAM";
    Program.sectMap[".init_array"]= "L2SRAM";
    Program.sectMap[".qmss"] 	=  	"L2SRAM";
    Program.sectMap[".cinit"] 	=  	"L2SRAM";
    Program.sectMap[".bss"]		= 	"L2SRAM";
    Program.sectMap[".const"]	= "L2SRAM";
    Program.sectMap[".text"]	=  "L2SRAM";  
    Program.sectMap[".code"]	=	"L2SRAM";
    Program.sectMap[".switch"]	=  "L2SRAM";
    Program.sectMap[".data"]	=  "L2SRAM";  
    Program.sectMap[".fardata"] = 	"L2SRAM";
    //Program.sectMap[".args"] 	= 	"L2SRAM";
    //Program.sectMap[".cio"] 	= 	"L2SRAM";
    Program.sectMap[".vecs"] 	= 		"L2SRAM";
    Program.sectMap["platform_lib"]= 	"L2SRAM";
    
    Program.sectMap[".far:taskStackSection"] =  "L2SRAM";
    Program.sectMap[".stack"]	=  "L2SRAM";
    Program.sectMap[".nimu_eth_ll2"] = 	 "L2SRAM";
    Program.sectMap[".resmgr_memregion"] = {loadSegment: "L2SRAM", loadAlign:128};	/* QMSS descriptors region 	*/
    Program.sectMap[".resmgr_handles"] = {loadSegment: "L2SRAM", loadAlign:16};	/* CPPI/QMSS/PA Handles			*/
    Program.sectMap[".resmgr_pa"]	= {loadSegment: "L2SRAM", loadAlign:8};		/* PA Memory					*/
    Program.sectMap[".far:IMAGEDATA"] = {loadSegment: "L2SRAM", loadAlign: 8};
    Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "L2SRAM", loadAlign: 8};
    Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "L2SRAM", loadAlign: 128};
    
    
    
    /* Required if using System_printf to output on the console */
    SysStd          		=   xdc.useModule('xdc.runtime.SysStd');
    System.SupportProxy     =   SysStd;
    
    /********************************************************************************************************************
    * Define hooks and static tasks  that will always be running.               										*
     ********************************************************************************************************************/
    
    
    ////DDR_CNTRL
    Startup.lastFxns.$add('&DDR_CNTRL'); ////////////// sss //////////
    
    /* 
    ** Create the stack Thread Task for our application.
    */
    var tskNdkStackTest  		=   Task.create("&StackTest");
    tskNdkStackTest.stackSize  	= 	0x1400;
    tskNdkStackTest.priority    = 	0x5;
    
    
    /* 
    ** Create a Periodic task to handle all NDK polling functions. 
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default and 
    ** you do not need to do this.
    */
    /*var prdNdkClkParams         =   new Clock.Params ();
    prdNdkClkParams.period      =   0x64;   
    prdNdkClkParams.startFlag   =   true;
    Program.global.clockInst1   =   Clock.create("&llTimerTick", 5, prdNdkClkParams);
    */
    
    /* 
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
    ** register hooks so that the stack can track all Task creation 
    Task.common$.namedInstance  =   true;
    Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });
    
    /* Enable BIOS Task Scheduler */
    BIOS.taskEnabled			=   true;
    
    /*
     * Enable Event Groups here and registering of ISR for specific GEM INTC is done
     * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
     */
    
    Ecm.eventGroupHwiNum[0] = 7;
    Ecm.eventGroupHwiNum[1] = 8;
    Ecm.eventGroupHwiNum[2] = 9;
    Ecm.eventGroupHwiNum[3] = 10;
    var sem0Params = new Sem.Params();
    sem0Params.instance.name = "semaNDK";
    sem0Params.mode = Sem.Mode_BINARY;
    Program.global.semaNDK = Sem.create(null, sem0Params);
    var timer0Params = new Timer.Params();
    timer0Params.instance.name = "timer0";
    timer0Params.period = 500000;
    timer0Params.periodType = xdc.module("ti.sysbios.interfaces.ITimer").PeriodType_COUNTS;
    Program.global.timer0 = Timer.create(-1, "&Timer0_Func", timer0Params);
    BIOS.libType = BIOS.LibType_Debug;
    BIOS.cpuFreq.lo = 1200000000;
    Global.IPv6 = false;
    Global.netSchedulerPri = Global.NC_PRIORITY_LOW;
    Global.networkOpenHook = "&NetOpenHook";
    Global.networkCloseHook = "&NetCloseHook";
    Ip.autoIp = false;
    Ip.address = "192.168.30.78";
    Ip.mask = "255.255.255.0";
    Ip.gatewayIpAddr = "192.168.30.1";
    Global.kernTaskPriLevel = 9;
    Global.highTaskPriLevel = 7;
    Task.numPriorities = 16;

    If I change Task2Func() priority to another number from 2 to 10 dtask_udp_hello do not run. And Task2Func() works without interupts.
    When I increase the heap it works longer but in result I receive the same error.
  • If I change Task2Func() priority to another number from 2 to 10 dtask_udp_hello do not run. And Task2Func() works without interupts.When I increase the heap it works longer but in result I receive the same error.