您好:C6678多核编程,每个核的task stack放在自己heap上:
Task_Handle tsk;
Error_Block eb;
Error_init(&eb);
Error_Block eb;
Error_init(&eb);
Task_Params taskParams0;
Task_Params_init(&taskParams0);
taskParams0.stackSize = 0x40000;//256KB
taskParams0.priority = 1;
taskParams0.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap0);
Task_Params_init(&taskParams0);
taskParams0.stackSize = 0x40000;//256KB
taskParams0.priority = 1;
taskParams0.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap0);
Task_Params taskParams1;
Task_Params_init(&taskParams1);
taskParams1.stackSize = 0x40000;//256KB
taskParams1.priority = 1;
taskParams1.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap1);
Task_Params_init(&taskParams1);
taskParams1.stackSize = 0x40000;//256KB
taskParams1.priority = 1;
taskParams1.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap1);
Task_Params taskParams2;
Task_Params_init(&taskParams2);
taskParams2.stackSize = 0x40000;//256KB
taskParams2.priority = 1;
taskParams2.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap2);
Task_Params_init(&taskParams2);
taskParams2.stackSize = 0x40000;//256KB
taskParams2.priority = 1;
taskParams2.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap2);
Task_Params taskParams3;
Task_Params_init(&taskParams3);
taskParams3.stackSize = 0x40000;//256KB
taskParams3.priority = 1;
taskParams3.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap3);
Task_Params_init(&taskParams3);
taskParams3.stackSize = 0x40000;//256KB
taskParams3.priority = 1;
taskParams3.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap3);
Task_Params taskParams4;
Task_Params_init(&taskParams4);
taskParams4.stackSize = 0x40000;//256KB
taskParams4.priority = 1;
taskParams4.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap4);
Task_Params_init(&taskParams4);
taskParams4.stackSize = 0x40000;//256KB
taskParams4.priority = 1;
taskParams4.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap4);
Task_Params taskParams5;
Task_Params_init(&taskParams5);
taskParams5.stackSize = 0x40000;//256KB
taskParams5.priority = 1;
taskParams5.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap5);
Task_Params_init(&taskParams5);
taskParams5.stackSize = 0x40000;//256KB
taskParams5.priority = 1;
taskParams5.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap5);
Task_Params taskParams6;
Task_Params_init(&taskParams6);
taskParams6.stackSize = 0x40000;//256KB
taskParams6.priority = 1;
taskParams6.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap6);
Task_Params taskParams7;
Task_Params_init(&taskParams7);
taskParams7.stackSize = 0x40000;//256KB
taskParams7.priority = 1;
taskParams7.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap7);
Task_Params_init(&taskParams6);
taskParams6.stackSize = 0x40000;//256KB
taskParams6.priority = 1;
taskParams6.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap6);
Task_Params taskParams7;
Task_Params_init(&taskParams7);
taskParams7.stackSize = 0x40000;//256KB
taskParams7.priority = 1;
taskParams7.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(heap7);
if(coreID == 0){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams0, &eb);
printf("%x\n", tsk);
}else if(coreID == 1){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams1, &eb);
printf("%x\n", tsk);
}else if(coreID == 2){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams2, &eb);
printf("%x\n", tsk);
}else if(coreID == 3){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams3, &eb);
printf("%x\n", tsk);
}else if(coreID == 4){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams4, &eb);
printf("%x\n", tsk);
}else if(coreID == 5){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams5, &eb);
printf("%x\n", tsk);
}else if(coreID == 6){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams6, &eb);
printf("%x\n", tsk);
}else if(coreID == 7){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams7, &eb);
printf("%x\n", tsk);
}
if( tsk == NULL){
printf("create tsk failed\n");
return false;
}
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams0, &eb);
printf("%x\n", tsk);
}else if(coreID == 1){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams1, &eb);
printf("%x\n", tsk);
}else if(coreID == 2){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams2, &eb);
printf("%x\n", tsk);
}else if(coreID == 3){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams3, &eb);
printf("%x\n", tsk);
}else if(coreID == 4){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams4, &eb);
printf("%x\n", tsk);
}else if(coreID == 5){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams5, &eb);
printf("%x\n", tsk);
}else if(coreID == 6){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams6, &eb);
printf("%x\n", tsk);
}else if(coreID == 7){
tsk = Task_create((Task_FuncPtr)tsk_func, &taskParams7, &eb);
printf("%x\n", tsk);
}
if( tsk == NULL){
printf("create tsk failed\n");
return false;
}
最后,我打印每个核创建的线程的句柄tsk,发现这些句柄都在系统堆上,都不在自己的堆上,请问是什么问题?
谢谢!
Shine:
请参考下面的帖子。 https://e2e.ti.com/support/embedded/tirtos/f/355/t/88351
qq z:
回复 Shine:
您好:我就是这么做的啊,怎么不对了,您能帮忙指明一下吗?