my application is composed by many threads.
One of this threads at each execution alocates some variables in the heap (I'm using the heap_4.c) end free those variables after their use.This task run periodically.
One other thread manage some memory transfer through the DMA and run only one time. At the end of this task, a vTaskDelete(NULL) is called.
Problem is following:
Until the second thread is alive, all it's ok. variables of first task are allocates and deletes alwais at same addresses.
But when the second thread terminates, FreeRTOS goes in hard fault after the first thread execution.
What can be the problem?
I can't really say without seeing more of your application.
Does the Idle task ever get any processing time? If a task deletes
itself, which in this case it is, the heap and TCP used by the task will
be freed in the Idle task, so if the Idle task is not running the memory
will never get freed - but that should not result in a crash unless you
run out of heap without noticing and subsequently attempt to access a
Other than that, the usual replies apply (do you have stack overflow
checking on, do you have configASSERT() defined, have you tried to debug
the hard fault, etc.) info on all of which can be obtained from the
following page: http://www.freertos.org/FAQHelp.html