stack overflow when IDLE task is created

Hello all, I am working on the IAR workbench, with AT91sam7s256 processor. I have ported the freertos to this processor based on the relevant docs. I have a problem with the freertos IDLE task. When the IDLE task is created by the freertos vTaskStartSchedulervTaskStartScheduler function, its stack and TCB is being allocated, the problem is that it’s run over other tasks that created before by the user. Then I get "stack overflow" (using freertos hook) on tasks that really not doing anything. Does any one have a clue what can be the problem? thanks

stack overflow when IDLE task is created

First I would check if there is enough space in your heap memory, which is used for allocation for stacks for all tasks. I suspect also that one of your task stack size might be set too small and it overruns idle task stack. Regards, Adam

stack overflow when IDLE task is created

hi I saw that when the the IDLE stack is created its overrun others tasks. I get overflow because the TCB of other tasks is overrun (by the IDLE task) and therefore the overflow-check function of freertos recognize it as stack overflow. i don’t think that the problem is because of small stack of other tasks.  

stack overflow when IDLE task is created

Idle task is created the same way as the other tasks are. First the memory for TCB and task stack is allocated on heap. Maybe there is a problem if allocate function returns wrong pointer. Please have a check if prvAllocateTCBAndStack function call in xTaskCreate works fine. What heap implementation are you using?

stack overflow when IDLE task is created

hi i am using heap_2 implementation, I think the allocation works fine, I have set breakpoint if the allocation has failed (memory limitation) I have got only 2 more tasks which allocation less then 0.5K ram. how can I check if the address return from the allocation function is valid (alignment problems???) thanks

stack overflow when IDLE task is created

sorry, i am using heap_3

stack overflow when IDLE task is created

xTaskCreate calls prvAllocateTCBAndStack function and this returns the pointer to allocated memory. Suggest set the breakpoint there and check if pointers returned during TCB/stack allocation have values as expected. P.S. A basic point. Almost all FreeRTOS features (queue/mutexes/semaphores etc.) use heap to allocate needed memory. I assume that you have commented out all of them and still there is an issue. If you haven’t I suggest to have a look in pvPortMalloc function which will be used for all this allocation – please check if pointer returned doesn’t show any unexpected behaviour.

stack overflow when IDLE task is created

xTaskCreate calls prvAllocateTCBAndStack function and this returns the pointer to allocated memory. Suggest set the breakpoint there and check if pointers returned during TCB/stack allocation have values as expected. P.S. A basic point. Almost all FreeRTOS features (queue/mutexes/semaphores etc.) use heap to allocate needed memory. I assume that you have commented out all of them and still there is an issue. If you haven’t I suggest to have a look in pvPortMalloc function which will be used for all this allocation – please check if pointer returned doesn’t show any unexpected behaviour.

stack overflow when IDLE task is created

using heap3 so heap size is set in the linker script. Probably linker script is the cause.