Other Parts Discussed in Thread: 66AK2G12,
Hi,
I'm using:
66AK2G12
CCS 10.2.0
Processor SDK RTOS K2G 6.03.00.106, including PDK K2G 1.0.16
XDCtools 3.61.02.27
SYS/BIOS 6.76.03.01
In main() I am doing this:
int main(void)
{
Task_Params task_params;
Task_Handle task0 = NULL;
Error_Block task0_eb;
EDMA3_DRV_Handle edma_handle = NULL;
// Initialize DMA driver
edma_handle = DmaDriverInit();
assert(edma_handle);
//**** Create Draw Task ****
Task_Params_init(&task_params);
task_params.priority = 7;
task_params.stackSize = 2048;
// Pass DMA driver handle into the task
task_params.arg0 = (uintptr_t) edma_handle;
task0 = Task_create(DrawTask, &task_params, &task0_eb);
assert(!Error_check(&task0_eb)); // FAILS THIS ASSERTION!!!
BIOS_start();
return (0);
}
On execution, the console prints the following error message:
[CortexA15] assertion "!Error_check(&task0_eb)" failed: file "../main_arm.cpp", line 339, function: int main()
Using the debugger, I stepped into the Task_create() function, and found that the problem occurs when the code tries to allocate memory for the 2048-byte task stack. Specifically, the sysbios kernel function Task_Instance_init() does this:
/* deal with undefined Task_Params defaults */
if (params->stackHeap == NULL) {
tsk->stackHeap = Task_defaultStackHeap;
}
but the variable Task_defaultStackHeap contains 0. Further down, Memory_alloc() is called:
tsk->stack = (Char *)Memory_alloc(tsk->stackHeap, tsk->stackSize, align, eb);
but the first parameter, tsk->stackHeap, is NULL. I believe this causes Memory_alloc() to return with a null pointer (and an error in eb).
How do I solve this?