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.

NDK + My application = Crash

Other Parts Discussed in Thread: SYSBIOS

Hi everyone,

 

I develop a big application on C6678, with lot of big array (put on DDR3) and many functions.

  • If I run my application without NDK, everything work fine.
  • If I run only NDK with one UDP server, everything work fine

If on UDP server, I call my function (PC send "execute" command), nothing work fine. My target keep running, I have no specific error on debug mode, I have no stack or heap overflow on ROV view.  My application do not work (very strange behaviour), and if I stop the target, my DSP is lock on :

$C$DW$L$ti_sysbios_knl_Clock_workFunc__E$11$B, $C$L585, $C$DW$L$ti_sysbios_knl_Clock_workFunc__E$10$E:
0c03ab88:   00102A5A            CMPEQ.L2      1,B4,B0
0c03ab8c:   30468121     [!B0]  BNOP.S1       $C$RL437 (PC+280 = 0x0c03ac98),4
0c03ab90:   222C62E6 ||  [ B0]  LDW.D2T2      *+B11[3],B4
0c03ab94:   00348A7B            CMPEQ.L2      B4,B13,B0
0c03ab98:   00000001 ||         NOP          
0c03ab9c:   00000000 ||         NOP

I have make lot of work around stack size, heap size, but I do not find an answer. At the moment, my application is mono-core, with no IPC or Multiproc function call.

 

Thanking you in advance for some ideas to solve this trouble.

 

Regards,

 

My .cfg file :

 

var Memory    = xdc.useModule('xdc.runtime.Memory');
var Log       = xdc.useModule('xdc.runtime.Log');
var Error     = xdc.useModule('xdc.runtime.Error');
var Diags     = xdc.useModule('xdc.runtime.Diags');
var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
var Startup   = xdc.useModule('xdc.runtime.Startup');
var System    = xdc.useModule('xdc.runtime.System');
var SysStd    = xdc.useModule('xdc.runtime.SysStd');

System.SupportProxy = SysStd;

/* Load and configure SYSBIOS packages */
var BIOS      = xdc.useModule('ti.sysbios.BIOS');
var Task      = xdc.useModule('ti.sysbios.knl.Task');
var Clock     = xdc.useModule('ti.sysbios.knl.Clock');
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');
var BiosCache = xdc.useModule('ti.sysbios.hal.Cache');
var HeapBuf   = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var HeapMem   = xdc.useModule('ti.sysbios.heaps.HeapMem');
var Exc       = xdc.useModule('ti.sysbios.family.c64p.Exception');
var Cache     = xdc.useModule('ti.sysbios.family.c66.Cache');
var Idle    = xdc.useModule('ti.sysbios.knl.Idle');

BIOS.taskEnabled = true;
Task.common$.namedInstance = true;
Task.defaultStackSize = 0x8000;

/*
 * 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;

/* Create a Heap. */
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0x300000;
heapMemParams.sectionName = "systemHeapMaster";
Program.global.heap0 = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance = Program.global.heap0;

/* Load and configure NDK */
var Global = xdc.useModule('ti.ndk.config.Global');

/*
** 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.
*/ 
Global.enableCodeGeneration = false;

/* Load the PDK packages */
var Csl  = xdc.useModule('ti.csl.Settings');
var Pa   = xdc.useModule('ti.drv.pa.Settings');
var Cppi = xdc.loadPackage('ti.drv.cppi');    
var Qmss = xdc.loadPackage('ti.drv.qmss');

/* Load the Platform/NDK Transport packages */
var PlatformLib  = xdc.loadPackage('ti.platform.evmc6678l');
var NdkTransport = xdc.loadPackage('ti.transport.ndk');

/* Load and configure the IPC packages */
var MessageQ     = xdc.useModule('ti.sdo.ipc.MessageQ');
var Ipc          = xdc.useModule('ti.sdo.ipc.Ipc');
var HeapBufMP    = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
var MultiProc    = xdc.useModule('ti.sdo.utils.MultiProc');

MultiProc.setConfig(null, ["CORE0", "CORE1", "CORE2", "CORE3", "CORE4", "CORE5", "CORE6", "CORE7"]);

/* Synchronize all processors (this will be done in Ipc_start) */
Ipc.procSync = Ipc.ProcSync_ALL;

/* ================ Logger configuration ================ */
var LoggerCircBuf = xdc.useModule('ti.uia.runtime.LoggerCircBuf');
var Diags         = xdc.useModule('xdc.runtime.Diags');
var Defaults      = xdc.useModule('xdc.runtime.Defaults');
var Main          = xdc.useModule('xdc.runtime.Main');
var Load          = xdc.useModule('ti.sysbios.utils.Load');

Load.windowInMs = 50;
CpuTimestamp     = xdc.useModule('ti.uia.family.c66.TimestampC66XLocal');
GlobalTimestamp = xdc.useModule('ti.uia.family.c66.TimestampC66XGlobal');
LogSync       = xdc.useModule('ti.uia.runtime.LogSync');
LogSync.GlobalTimestampProxy = GlobalTimestamp;
LogSync.CpuTimestampProxy = CpuTimestamp;

CpuTimestamp.maxTimerClockFreq = {lo:1000000000,hi:0};
CpuTimestamp.maxBusClockFreq = {lo:1000000000,hi:0};
GlobalTimestamp.maxTimerClockFreq = {lo:250000000,hi:0};
GlobalTimestamp.maxBusClockFreq = {lo:1000000000,hi:0};
GlobalTimestamp.cpuCyclesPerTick = 4;

Exc.common$.logger = Main.common$.logger;
Exc.enablePrint = true;

var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
/* Increase the sysbios logger and turn Hwi and Swi logging off */
LoggingSetup.sysbiosLoggerSize = 32768;
LoggingSetup.mainLoggerSize = 8*1024;
LoggingSetup.loadLoggerSize = 32768;
LoggingSetup.loadLogging = true;
LoggingSetup.sysbiosTaskLogging = false;
LoggingSetup.sysbiosSwiLogging = false;
LoggingSetup.sysbiosHwiLogging = false;
LoggingSetup.eventUploadMode = LoggingSetup.UploadMode_NONJTAGTRANSPORT;

/* ================ UIA configuration ================ */
/*
 *  This example is a multi-core example, so UIA's ServiceMgr
 *  must be configured to collect events from multiple cores.
 */
var ServiceMgr = xdc.useModule('ti.uia.runtime.ServiceMgr');
ServiceMgr.topology = ServiceMgr.Topology_MULTICORE;
ServiceMgr.masterProcId = 0;

/* The application is using the UIA benchmark events. */
var UIABenchmark  = xdc.useModule('ti.uia.events.UIABenchmark');
   
/*
** Create a Heap.
*/
var Memory      = xdc.useModule('xdc.runtime.Memory');
Program.sectMap[".vecs"]             = {loadSegment: "MSMCSRAM_MASTER", loadAlign:1024};
Program.sectMap[".switch"]           = {loadSegment: "MSMCSRAM_MASTER", loadAlign:8};
Program.sectMap[".cio"]              = {loadSegment: "L2SRAM", loadAlign:8};
Program.sectMap[".args"]             = {loadSegment: "L2SRAM", loadAlign:8};
Program.sectMap[".cppi"]             = {loadSegment: "L2SRAM", loadAlign:16};
Program.sectMap[".qmss"]             = {loadSegment: "L2SRAM", loadAlign:16};

// Linker section of Network Interface Management Unit
Program.sectMap[".nimu_eth_ll2"]     = {loadSegment: "L2SRAM", loadAlign:16};

// NDK section (See HOGSimulator - Memory Map for more explain
Program.sectMap[".far:NDK_PACKETMEM"]= {loadSegment: "MSMCSRAM_MASTER", loadAlign: 128};
Program.sectMap[".far:NDK_OBJMEM"]   = {loadSegment: "MSMCSRAM_MASTER", loadAlign: 16};


// Those memory section was used on resourcemgr.c
Program.sectMap[".resmgr_memregion"]  = {loadSegment: "L2SRAM", loadAlign:128};
Program.sectMap[".resmgr_handles"]    = {loadSegment: "L2SRAM", loadAlign:16};
Program.sectMap[".resmgr_pa"]         = {loadSegment: "L2SRAM", loadAlign:8};
Program.sectMap[".mp_array_icp"]      = "DDR3_PART2"; // BIG DATA
Program.sectMap[".mn_array_icp"]      = "DDR3_PART2"; // BIG DATA
Program.sectMap[".roivalue"]       = "DDR3_PART2"; // BIG DATA
Program.sectMap["systemHeapMaster"]     = "MSMCSRAM_IPC";
Program.sectMap[".cinit"]               = "MSMCSRAM_MASTER";
Program.sectMap[".const"]               = "MSMCSRAM_MASTER";
Program.sectMap[".text"]                = "MSMCSRAM_MASTER";
Program.sectMap[".far"]                 = "L2SRAM";
Program.sectMap[".bss"]                 = "L2SRAM";
Program.sectMap[".rodata"]              = "L2SRAM";
Program.sectMap[".neardata"]            = "L2SRAM";
Program.sectMap[".code"]                = "L2SRAM";
Program.sectMap[".data"]                = "L2SRAM";
Program.sectMap[".sysmem"]              = "L2SRAM";
Program.sectMap[".defaultStackSection"] = "L2SRAM";
Program.sectMap[".stack"]               = "L2SRAM";
Program.sectMap[".plt"]                 = "L2SRAM";
Program.sectMap["platform_lib"]         = "L2SRAM";

/* Add init function */
Startup.lastFxns.$add('&EVM_init');
/* Create the stack Thread Task for our application.  */
var tskMainThread        =  Task.create("&master_main");
tskMainThread.stackSize  = 0x8000;
tskMainThread.priority   = 0x5;
tskMainThread.instance.name = "master_main";


Task.enableIdleTask = false;
Task.allBlockedFunc = Idle.run;

 

 

 

  • For me, the main difference between calling function into UDP server or out is task context :  

    • When everything works fine, I execute my app under master_task (Before Network_init)
    • When my apps do not work, I execute my app under the task create by "DaemonNew" (according to NDK user guide)

    But I do not understand why it is work on one side, and not on the other ...

     

    Jean-Baptiste

  • Hi Jean-Baptiste,

    To start, could you please answer these two questions?

    • Which version of the NDK are you using?
    • Which version of BIOS are you using?

    Jean-Baptiste Theou said:
    If on UDP server, I call my function (PC send "execute" command), nothing work fine.

    Can you elaborate on this?  Does this mean you are sending some command from your PC to the 6678 board?  It may help to explain your network setup (e.g. PC connected to 6678 through a router, switch, or directly via crossover cable?).

    Jean-Baptiste Theou said:
    Task.enableIdleTask = false;
    Task.allBlockedFunc = Idle.run;

    Just curious ... wondering why you have added this to your configuration?

    Jean-Baptiste Theou said:
    When everything works fine, I execute my app under master_task (Before Network_init)

    Can you show me the code for this?

    Jean-Baptiste Theou said:

    When my apps do not work, I execute my app under the task create by "DaemonNew" (according to NDK user guide)

    Can you show me the code for this?

    Steve

  • Hi Steven,

    I find my mistake ... My application is big one, and with more investigation, I find a huge stack overflow during execution (So no error on CCS because no task context switch). I have many call of different functions, with big struct as parameter, and rather than used the address of the struct as parameter, I used directly the struct. So for each call, a new BIG local struct was create -> Huge stack overflow. I fix my trouble by using address only any time.

    Concerning this line :

    Jean-Baptiste Theou said:
    Task.enableIdleTask = false; Task.allBlockedFunc = Idle.run;

    I used that on my .cfg because of an other trouble when I move my stack and my heap on DDR3.  (Some topic about that on 6678 forum). It was not useful anymore for me, I just forgot to remove this line.

     

    Thank you for your answer anyway.

    Jean-Baptiste