LWIP heap memory issue in STM32F7 series
Hi, I am using STM32F767ZI for ethernet communication. I update my CUBEIDE version from 1.16.1 to 1.17 latest version. After I update my ethernet program was show HardFault_Handler() during Execution. This was working fine in the previous version(1.16.1). In the new version(1.17) It hit the fault in mem_init() at mem.c (line no. 18).
void
mem_init(void)
{
struct mem *mem;
LWIP_ASSERT("Sanity check alignment",
(SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT - 1)) == 0);
/* align the heap */
ram = (u8_t *)LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER);
/* initialize the start of the heap */
mem = (struct mem *)(void *)ram;
mem->next = MEM_SIZE_ALIGNED;
mem->prev = 0;
mem->used = 0;
/* initialize the end of the heap */
ram_end = ptr_to_mem(MEM_SIZE_ALIGNED);
ram_end->used = 1;
ram_end->next = MEM_SIZE_ALIGNED;
ram_end->prev = MEM_SIZE_ALIGNED; (In this line the hardware fault was occur)
MEM_SANITY();
/* initialize the lowest-free pointer to the start of the heap */
lfree = (struct mem *)(void *)ram;
MEM_STATS_AVAIL(avail, MEM_SIZE_ALIGNED);
if (sys_mutex_new(&mem_mutex) != ERR_OK) {
LWIP_ASSERT("failed to create mem_mutex", 0);
}
}
In LWIP setting, the HTTPD setting -> set the MEM_SIZE(Heap) = 10*1024.
I refer compare the previous version and latest version lwipopts.h file. The below line was added in the header file
/*----- Default Value for F7/H7 devices: 0x30044000 -----*/
#define LWIP_RAM_HEAP_POINTER 0x30044000 (updated version).
Let's give the guidance how to rectify this error during execution.
Thank you
Ramachandran.S
