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.

HeapBufMP_create创建不成功



前情提要:核间通讯真是多灾多难,到现在这都要一个星期过去了,目前还没打通core0和core1 ,Notify方法已经翻车:e2echina.ti.com/.../944077

正准备使用MessageQ做核间通信,到第一步又被卡主了,创建HeapBufMP_create就是不成功,这个创建的方法和例子里是一模一样的,就是不成功,代码如下:

#define HEAP_NAME   "myHeapBuf"//这个在任务之外定义的
//下面代码在任务里
HeapBufMP_Handle heapHandle;
HeapBufMP_Params heapBufParams;

HeapBufMP_Params_init(&heapBufParams);
heapBufParams.regionId = 0;
heapBufParams.name = HEAP_NAME;
heapBufParams.numBlocks = 1;
heapBufParams.blockSize = 1 * sizeof(MessageQ_MsgHeader);

heapHandle = HeapBufMP_create(&heapBufParams);

提示:"../main.c", line 40: error #167: too few arguments in function call

这怎么可能少参数嘛,我都把函数定义翻出来了:C:\ti\ipc_3_50_04_08\packages\ti\sdo\ipc\heaps->HeapBufMP.c文件中明明写了:

HeapBufMP_Handle HeapBufMP_create(const HeapBufMP_Params *sparams)
{
    ti_sdo_ipc_heaps_HeapBufMP_Params params;
    ti_sdo_ipc_heaps_HeapBufMP_Object *obj;
    Error_Block eb;

    Error_init(&eb);

    if (sparams != NULL) {
        HeapBufMP_getRTSCParams(&params, (Ptr)sparams);

        /* call the module create */
        obj = ti_sdo_ipc_heaps_HeapBufMP_create(&params, &eb);
    }
    else {
        obj = ti_sdo_ipc_heaps_HeapBufMP_create(NULL, &eb);
    }

    return ((HeapBufMP_Handle)obj);
}

就一个输入参数啊!

就算你说少参数,那我加参数,参考CCS10.1 HELP文档中搜索到的定义:HeapBufMP_Handle HeapBufMP_create(const HeapBufMP_Params *params, Error_Block *eb);

params — per-instance config params, or NULL to select default values (target-domain only)

eb — active error-handling block, or NULL to select default policy (target-domain only)

(明明是同一个函数,在.C文件和HELP文件里定义不一样 感觉就离谱 )

按照这个定义加一个NULL,其他代码同上就 heapHandle = HeapBufMP_create(&heapBufParams,NULL); 这个改变,再编译,编译是成功了,但是运行到这句话就卡住!为啥啊,这是按照标准例子创建啊,到我这里就不好用么?

附件是程序完整版:

#include "EVM_init.h"
#include <ti/sysbios/syncs/SyncSem.h>
MessageQ_Handle   messageQ;
MessageQ_Params   messageQParams;
SyncSem_Handle    syncSemHandle;
MessageQ_QueueId   remoteQueueId;

#define HEAPID   0
#define HEAP_NAME   "myHeapBuf"
#define Qname_Core0_to_Core1  "Core0_to_Core1"

typedef struct  {
    MessageQ_MsgHeader reserved;     // Required
    UInt32             cmd;
} MyMsg;
MyMsg *msg;

Void ledPlayTask(UArg a0, UArg a1)
{
    //Int      status;
    uint32_t coreId;
    //UInt16   msgId ;
    coreId = CSL_chipReadReg (CSL_CHIP_DNUM);

    HeapBufMP_Handle heapHandle;
    HeapBufMP_Params heapBufParams;

    switch(coreId)
    {
    case 0:
        platform_write("Core %d is working!\n",coreId);
        //Create the heap that will be used to allocate messages.
        HeapBufMP_Params_init(&heapBufParams);
        heapBufParams.regionId       = 0;
        heapBufParams.name           = HEAP_NAME;
        heapBufParams.numBlocks      = 1;
        heapBufParams.blockSize      = 1 * sizeof(MessageQ_MsgHeader);

        heapHandle = HeapBufMP_create(&heapBufParams,NULL);
        //heapHandle = HeapBufMP_create(&heapBufParams);
        platform_write("Core %d mission complete!\n",coreId);
        if (heapHandle == NULL) {
            platform_write("HeapBufMP_create failed\n" );
        }
        platform_write("Core %d mission complete!\n",coreId);
    case 1:

        break;
    }

}
Int main()
{ 
    platform_write("Start BIOS\n");
    BIOS_start();
    return(0);
}

和.cfg文件:6685.app.cfg