I'm trying to implement my Default System Heap using 1 core on a C6678 with the HeapCallback package.
My configuration is as follows:
App.cfg:
var heapMem0Params = new HeapMem.Params(); heapMem0Params.instance.name = "H0"; heapMem0Params.size = 0x4000000 /*204857600*3/2;*/ heapMem0Params.sectionName = "myHeap0"; Program.global.task0Heap = HeapMem.create(heapMem0Params); Program.sectMap["myHeap0"] = "DDR3"; var HeapCallback = xdc.useModule('ti.sysbios.heaps.HeapCallback'); HeapCallback.initInstFxn = '&myInitFxn'; HeapCallback.createInstFxn = '&myCreateFxn'; HeapCallback.deleteInstFxn = '&myDeleteFxn'; HeapCallback.allocInstFxn = '&myAllocFxn'; HeapCallback.freeInstFxn = '&myFreeFxn'; HeapCallback.isBlockingInstFxn = '&myIsBlockingFxn'; HeapCallback.getStatsInstFxn = '&myGetStatsFxn'; var heapCallback0Params = new HeapCallback.Params(); heapCallback0Params.instance.name = "heapCallback0"; Memory.defaultHeapInstance = HeapCallback.create(heapCallback0Params); Main.cpp: /* * ======== getDefaultHeap ======== * Helper function to find the default heap for this c */ static IHeap_Handle getDefaultHeap() { extern __cregister volatile unsigned int DNUM; IHeap_Handle myHeap; if (DNUM == 0) { myHeap = HeapMem_Handle_upCast(task0Heap); } return (myHeap); } /* * ======== myInitFxn ======== */ UArg myInitFxn(UArg arg) { /* * This is called during startup (e.g. before main * For this application nothing needs to be done h */ return (NULL); } /* * ======== myCreateFxn ======== */ UArg myCreateFxn(UArg arg) { /* * This is called when creating a new Callback ins * For this application nothing needs to be done h */ return (NULL); } /* * ======== myDeleteFxn ======== */ Void myDeleteFxn(UArg arg) { /* * This is called when deleting a Callback instanc * For this application nothing needs to be done h */ return (NULL); } /* * ======== myAllocFxn ======== */ Ptr myAllocFxn(UArg arg, SizeT size, SizeT align) { Error_Block eb; IHeap_Handle myHeap = getDefaultHeap(); Error_init(&eb); return (Memory_alloc(myHeap, size, align, &eb)); } /* * ======== myFreeFxn ======== */ Void myFreeFxn(UArg arg, Ptr addr, SizeT size) { IHeap_Handle myHeap = getDefaultHeap(); Memory_free(myHeap, addr, size); } /* * ======== myGetStatsFxn ======== */ Void myGetStatsFxn(UArg arg, Memory_Stats *stats) { IHeap_Handle myHeap = getDefaultHeap(); Memory_getStats(myHeap, stats); } /* * ======== myIsBlockingFxn ======== */ Bool myIsBlockingFxn(UArg arg) { IHeap_Handle myHeap = getDefaultHeap(); return (Memory_query(myHeap, Memory_Q_BLOCKING));
I have more than enough space in my Heap, but when loading the program onto the core I get the following error.
ti.sysbios.HeapMem: line 307: out of memory
Why would I be seeing this error, when it seems that I have everything setup correctly?