I’m trying to implement the producer-consumer algorithm on ATMega323_WinAVR using FreeRTOS. I get this error in AVR Studio 4 when debugging:
AVR Simulator: Excessive stack overflow, stop sim
The stack pointer stops at this line:
static void prvCopyDataToQueue (
xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xPosition){
Why does this error appears?
Thanks!
When you build a program, the linker defines where in RAM the stack will go, and the debugger will expect to find it there. When you have the FreeRTOS scheduler running, the stacks will come from the FreeRTOS heap, as each task is allocated a stack when it is created. The debugger will have no way of knowing if a task has overflowed its stack or not, because it does not know where the stack is, and has no knowledge of FreeRTOS.
I recommend turning that check in the debugger off, then turning the stack checking on in FreeRTOS (if you want to check for stack overflows at all, recommended during development only).
Regards.