data abort in heap_4.c

agnishant wrote on Monday, February 10, 2014:

I get a data abort, at a random point of program execution inside the heap_4 function prvInsertBlockIntoFreeList, at the line “pxIterator->pxNextFreeBlock = pxBlockToInsert;”. I went through the application to see if there is are memory leaks and greatly reduced the memory allocation calls to the required minimum. But the same heap is also being used by lwIP. What could have caused the problem or at which should I test to pin point the cause.

agnishant wrote on Monday, February 10, 2014:

I further checked and found that the value of pxIterator is 0. If I am correct, if pxIterator was 0 from the start, the code would not reach here, but when this function is being called, all the tasks are suspended so I dont see how this problem could occur. Desperately need some feedback. If it would help, the controller in use is LPC2387.

davedoors wrote on Monday, February 10, 2014:

Have you implemented the functions in sys_arch.c to make lwip safe to use with FreeRTOS? Search for sys_arch in FreeRTOS\Demo\Common\ethernet\lwip-1.4.0\ports to see examples.

agnishant wrote on Monday, February 10, 2014:

Yes I have done that, called vTaskSuspendAll for protect and xTaskResumeAll for unprotect.

agnishant wrote on Monday, February 10, 2014:

I also changed the sys_arch functions to disable/enable the interrupts as well but still the problem exists. Also variable “pxIterator” is 0 after the for loop at the start of the function “prvInsertBlockIntoFreeList” which is causing the data abort.

rtel wrote on Monday, February 10, 2014:

heap_4.c has been thoroughly tested, both systematically and by thrashing. Although obviously we can’t guarantee there aren’t any problems with heap_4 it is most likely that your problem lies elsewhere in your system. lwIP being the most obvious place, but also it could simply be a configuration problem.

Which port of FreeRTOS are you using? Is it up to date (newer version have more configASSERT() statements to trap common misconfigurations). Do you have configASSERT() defined? Do you have a stack overflow hook defined? Have you looked through the “my application does not run what could be wrong?” page of the FAQ?

Regards.