lwIP on STM32H7: tcp_write() causes exception / HardFault_Handler() when it is low of memory
Hi,
I have a lwIP implementation running on an STM32H723 using a CubeMX HAL implementation, so no OS-like stuff involved. In case of heavy outgoing traffic, it seems it is running low on memory at some point. This is not dramatic as tcp_write() knows an error-code ERR_MEM which would give the possibility to deal with that situation.
Unfortunately it seems this error code is not used here. Instead of that, the system dies and ends up in HardFault_Handler() via following stacktrace:
HardFault_Handler() at stm32h7xx_it.c:85 0x8002f04
<signal handler called>() at 0xffffffe9
mem_malloc() at mem.c:934 0x800d7fe
pbuf_alloc() at pbuf.c:284 0x800e348
tcp_pbuf_prealloc() at tcp_out.c:263 0x801299a
tcp_write() at tcp_out.c:610 0x8012e48 So...how can I change that? What do I have to do to let tcp_write() return with a proper error code instead of letting the whole system crash?
Thanks!
