Platform:EVM 6472
XDCtools version: 3.20.04.68
IPC: 1.21.02.23
BIOS: 6.30.03.46
Who can tell me if two or more messages can be created with the same heapId? When I created msg and msg1 with
heaId=0, the program broken with an error of "out of memory". What is the problem? I don't know how to configure Memory.defaultHeapSize and Program.heap. Must Memory.defaultHeapSize and Program.heap be the same?
#define HEAP_NAME "myHeapBuf"
#define HEAPID 0
Void tsk0_func(UArg arg0, UArg arg1)
{
MessageQ_Msg msg;
MessageQ_Msg msg1;
MessageQ_Handle messageQ;
MessageQ_QueueId remoteQueueId;
Int status;
UInt16 msgId = 0;
HeapBufMP_Handle heapHandle;
HeapBufMP_Params heapBufParams;
HeapBufMP_Params_init(&heapBufParams);
heapBufParams.regionId = 0;
heapBufParams.name = HEAP_NAME;
heapBufParams.numBlocks = 1;
heapBufParams.blockSize = sizeof(MessageQ_MsgHeader);
heapHandle = HeapBufMP_create(&heapBufParams);
MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);
/* Generate queue names based on own proc ID and total number of procs */
System_sprintf(localQueueName, "CORE%d", MultiProc_self());
System_sprintf(nextQueueName, "CORE%d", (MultiProc_self() + 1) % MultiProc_getNumProcessors()));
messageQ = MessageQ_create(localQueueName, NULL);
/* Open the remote message queue. Spin until it is ready. */
do {
status = MessageQ_open(nextQueueName, &remoteQueueId);
} while (status < 0);
/* Allocate a message to be ping-ponged around the processors */
msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
if (msg == NULL) {
System_abort("MessageQ_alloc failed\n" );
}
msg1 = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
if (msg1 == NULL) {
System_abort("MessageQ_alloc failed\n" );
}
}
segment of message_single.cfg:
Memory.defaultHeapSize = 0x8000;
Program.heap = 0x8000;
/* Synchronize all processors (this will be done in Ipc_start) */
Ipc.procSync = Ipc.ProcSync_ALL;
/* Shared Memory base address and length */
var SHAREDMEM = 0x200000;
var SHAREDMEMSIZE = 0xC0000;