Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Here's a new type of bug that I haven't encountered before and I'm having some trouble debugging it. I've got a small project, currently it has a main Task which adds items to a queue when the queue is empty and an HWI which pops items off the queue until it is empty. After a short while I get a stack overflow in the kernel idle task (ti.sysbios.knl.Task.IdleTask). Unfortunately that's not a task that I defined and have no idea how to debug it. As I understand it, if no idle task is defined the kernel has its own idle task. If I disable the queue operations the stack overflow disappears.
One odd observation is that the stack size doesn't creep up slowly in the idle task, it suddenly overflows.
Idle Task "ti.sysbios.knl.Task.IdleTask"
stack base at 0x8000, normal steady state (peak) usage is 142 words. After a while this one overflows into the stack space of "My Task"
My Task
stack base at 0x8100, normal steady state (peak) usage is 120words.
A simplified version of my code is below:
typedef struct QUEUE_REC {
Queue_Elem elem;
Uint16 data;
} queue_rec_t;
queue_rec_t queue_rec_buf[16];
queue_rec_t *rec_tmp_ptr;
void epwm_1_hwi_48(void) {
if(!Queue_empty(queue_hndl)) {
rec_tmp_ptr = Queue_get(queue_hndl);
temp_uint16 = rec_tmp_ptr->data
}
// ... do stuff with temp_uint16 ...
EPwm1Regs.ETCLR.bit.INT = 1;
return;
}
void main_task() {
Task_sleep(100);
for(;;) {
queue_rec_buf[0].data = 0;
Queue_put(queue_hndl, &(queue_rec_buf[0].elem));
queue_rec_buf[1].data= 1;
Queue_put(queue_hndl, &(queue_rec_buf[1].elem));
queue_rec_buf[2].data = 2;
Queue_put(queue_hndl, &(queue_rec_buf[2].elem));
queue_rec_buf[3].data = 3;
Queue_put(queue_hndl, &(queue_rec_buf[3].elem));
while(!Queue_empty(queue_hndl)) {
Task_sleep(100);
}
}
}
EDIT: I forgot to add version info, they're below
- Compiler: v18.1.2.LTS
- SYS/BIOS 6.73.1.01
- XDCtools: 3.50.8.24_core
And an unrelated question, should I still be using SYS/BIOS or should I be transitioning to TI-RTOS (for C2000)?