2024-11-28 01:46 PM - last edited on 2025-01-07 02:47 AM by Andrew Neil
Hi ST Community,
I am working on a project using the STM32H723 MCU and the KSZ8863 Ethernet switch. I initially encountered issues while using a modified TCP echo server example, but after reverting to the unmodified example, the same issue persists. Communication is functional, but the system eventually crashes with the following assertion:
Assertion "mem_free: illegal memory: non-linked: double free" failed at line 661 in ../Middlewares/Third_Party/LwIP/src/core/mem.c
Here are the configurations:
Cortex M7:
Ethernet:
LwIP:
Thanks in advance for any guidance!
Best regards,
Russel Mahmud
2025-01-15 06:36 AM
Hello @wsrrasel ,
Your memory configuration is lacking and don't cover parts where LwIP heap and descriptors will be placed.
You need to take care when allocating memory make sure you have the permission in MPU configuration for that address range and calculate the amount of allocated Heap according to the available memory on your case the SRAM.
Also, you will need to handle the freeing of allocated memory when not used to make sure you don't run out of usable memory.
you can have some references and documentations on LwIP which might help you:
-How to create a project for STM32H7 with Ethernet ... - STMicroelectronics Community
-https://github.com/stm32-hotspot/STM32H7-LwIP-Examples
-Developing applications on STM32Cube with LwIP TCP/IP stack
-STM32CubeH7/Projects/NUCLEO-H723ZG/Applications/LwIP at master · STMicroelectronics/STM32CubeH7 · GitHub
Regards