data abort in heap_4.c

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.

data abort in heap_4.c

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.

data abort in heap_4.c

Have you implemented the functions in sysarch.c to make lwip safe to use with FreeRTOS? Search for sysarch in FreeRTOSDemoCommonethernetlwip-1.4.0ports to see examples.

data abort in heap_4.c

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

data abort in heap_4.c

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.

data abort in heap_4.c

heap4.c has been thoroughly tested, both systematically and by thrashing. Although obviously we can’t guarantee there aren’t any problems with heap4 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.