在main函数通过DNUM函数获取核数打印时候没有打印出核0,在经过Ipc_start()同步后,通过status检测同步正常,但是MutiProc_self()获取不到核0.
Nancy Wang:
您是参考的哪个例程?麻烦贴出来相关的代码以及配置文件。
haotian chang:
回复 Nancy Wang:
配置文件如下:
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
/*
* Get the list of names that the build device supports.
* I.e. ["CORE0", "CORE1", "CORE2" … ]
*/
//var nameList = MultiProc.getDeviceProcNames();
//MultiProc.setConfig(null, nameList);
MultiProc.setConfig(null, ["CORE0", "CORE1", "CORE2", "CORE3", "CORE4", "CORE5", "CORE6", "CORE7"]);
/*
* The SysStd System provider is a good one to use for debugging
* but does not have the best performance. Use xdc.runtime.SysMin
* for better performance.
*/
var System = xdc.useModule('xdc.runtime.System');
var SysStd = xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy = SysStd;
/* Modules explicitly used in the application */
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 MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
/* BIOS/XDC modules */
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.heapSize = 0xa000;
Program.stack = 0xf000;
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
var ECM = xdc.useModule ("ti.sysbios.family.c64p.EventCombiner");
var C64_Hwi = xdc.useModule ("ti.sysbios.family.c64p.Hwi");
var ti_sysbios_family_c66_tci66xx_CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
ECM.eventGroupHwiNum[0] = 7;
ECM.eventGroupHwiNum[1] = 8;
ECM.eventGroupHwiNum[2] = 9;
ECM.eventGroupHwiNum[3] = 10;
//var tsk0 = Task.create('&tsk0_func');
//tsk0.instance.name = "tsk0";
/* Synchronize all processors (this will be done in Ipc_start) */
Ipc.procSync = Ipc.ProcSync_ALL;
System.SupportProxy = SysStd;
Program.sectMap[".myL1"] = {runSegment:"L1DSRAM"};
Program.sectMap[".myL2"] = {runSegment:"L2SRAM_1"};
Program.sectMap[".myMSMC"]= {runSegment:"MSMCSRAM_1"};
Program.sectMap[".myOutMem"]={runSegment: "DDR_1"};
/* Shared Memory base address and length */
//var SHAREDMEM = 0x0C000000;
//var SHAREDMEMSIZE = 0x00200000;
var SHAREDMEM = 0x0C000000;
var SHAREDMEMSIZE = 0x00100000;/*var SHAREDMEMSIZE = 0x00200000;*/
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
SharedRegion.numEntries =8; // 最大共享区域的数目
SharedRegion.translate = true; // 是否需要进行地址转换
SharedRegion.setEntryMeta(0,
{ base: SHAREDMEM,
len: SHAREDMEMSIZE,
ownerProcId: 0,
isValid: true,
name: "MSMCSRAM",
});
/* Reset function initialize HW */
var Reset = xdc.useModule("xdc.runtime.Reset");
Reset.fxns[Reset.fxns.length++] = "&vlmat_system_reset";
主函数如下:
Int main(Int argc, Char* argv[])
{
HeapBufMP_Handle heapHandle;
HeapBufMP_Params heapBufParams;
Task_Params params;
/* The ROM bootloader sets the IE04 bit for IPC interrupt.
* This needs to be cleared for IPC.
*/
/* Clear interrupt enable register at startup */
// IER = 0;
//#ifdef ENABLE_SYSTEM_TRACE_LOGS
// initializeSTM();
//#endif
/*
* Ipc_start() calls Ipc_attach() to synchronize all remote processors
* because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
*/
int coreId = DNUM;
printf("hello world from core %d\n", coreId);
int status = Ipc_start();
if (status < 0) {
//System_abort("Ipc_start failed\n");
printf("Ipc_start failed\n");
}
printf("I am core %d\n", coreId);
if (MultiProc_self() == 0) {
printf("Is in core %d\n", coreId);
#if !FUNCTIONAL_SIMULATOR
clearRegisters(0);
#endif
/*
* Create the heap that will be used to allocate messages.
*/
HeapBufMP_Params_init(&heapBufParams);
heapBufParams.regionId = 0;
heapBufParams.name = HEAP_NAME;
heapBufParams.numBlocks = 24;
heapBufParams.align = 128;
heapBufParams.blockSize = sizeof(vlmatMessageQ_Msg);
heapHandle = HeapBufMP_create(&heapBufParams);
if (heapHandle == NULL) {
//System_abort("HeapBufMP_create failed\n" );
printf("HeapBufMP_create failed\n");
}
/* Register this heap with MessageQ */
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(core0QueueName, "CORE%d", 0 );
System_sprintf(core1QueueName, "CORE%d", 1 );
System_sprintf(core2QueueName, "CORE%d", 2 );
System_sprintf(core3QueueName, "CORE%d", 3 );
System_sprintf(core4QueueName, "CORE%d", 4 );
System_sprintf(core5QueueName, "CORE%d", 5 );
System_sprintf(core6QueueName, "CORE%d", 6 );
System_sprintf(core7QueueName, "CORE%d", 7 );
/* Create a unique 'master' Task if on proc 0 */
Task_Params_init(¶ms);
params.stackSize = 0x2000;
if (MultiProc_self() == 0) {
//Task_create(tsk0_func, NULL, NULL);
Task_create(vlmat_master, ¶ms, NULL);
}
else {
//Task_create(tsk1_func, NULL, NULL);
Task_create(vlmat_slave, ¶ms, NULL);
}
BIOS_start();
return (0);
}
Nancy Wang:
回复 haotian chang:
尝试一下在Multiproc_self前调用MultiProc_setLocalId。
processors.wiki.ti.com/…/MultiProc_Module
haotian chang:
回复 Nancy Wang:
你好我参考vlfft历程,有个setMyId函数,这个函数已经显示调用MultiProc_setLocalId(procId)
Nancy Wang:
回复 haotian chang:
您的问题解决了吗?可以将您的project传上来吗?我转给相关的工程师看一下。