Hard fault on allocating in second region using `heap_5`

I’m having trouble with hard faults when trying to use heap_5.c. We are using both the internal SRAM and an exteral SRAM to store the heap. Whenever heap is trying to allocate memory on the second region on external RAM the controller is running into an hard fault.
I tracked this down to the function prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ). First time pxBlockToInsert will be on the external RAM the for loop on top of the function will crash because pxIterator->pxNextFreeBlock will become NULL after the last block in first section, so pxIterator will become NULL thus referencing pxIterator->pxNextFreeBlock will lead to the hardfault.

We are setting up heap like this

static uint8_t au8HeapInternalRAM[(10 * 1024)];  //everything without defined section will get placed in internal RAM
__attribute__ ((section (".extram"))) static uint8_t au8HeapExternalRAM[(80 * 1024)];  // section ".extram" is defined using linker script, starting at `0x60000000`
const HeapRegion_t xHeapRegions[] =
{
    { ( uint8_t* ) &au8HeapInternalRAM, (10 * 1024) },
    { ( uint8_t* ) &au8HeapExternalRAM, (80 * 1024) },
    { NULL, 0 } /* Terminates the array. */
};

vPortDefineHeapRegions(xHeapRegions); is called right after the hardware initialization and I made sure this is called before the first call to pvPortMalloc (or any other creation causing allocation).
I have configASSERT() defined like this

#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}

but this does not stop the program at any point.

The code is build using GCC (Embitz IDE) and is running on a STM32F439NGH6.
The external RAM is an 512KB SRAM connected via the FSMC interface of the controller.

Starting addresses:
* au8HeapInternalRAM 0x20004A0C
* au8HeapExternalRAM 0x60029850

Can anyone help me by telling me what could be the problem here?

It is interesting that your problem occurs while trying to allocate the block, not when trying to use the block.

Sorry to start with basic questions - but can you verify that the external RAM is functioning as you expect before you try using it for real. For example, if
you write a basic RAM test function that is called from main() without any other functionality (no FreeRTOS), do the RAM tests pass? By RAM test I mean doing something like a walking 1s test across the whole RAM (search “walking 1” on this page
http://www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/software-based-memory-testing.html
).

Thanks for the fast response.
We actually have a RAM test function but accidentally it got called AFTER the heap initialization, which of course reset the heap structure on external RAM.
Sorry to have bothered you.