cancel
Showing results for 
Search instead for 
Did you mean: 

Minimum Memory requirement for lwIP stack integration on stm32 devices?

BChav.1
Associate III

Hi,

I am trying to integrate lwIP stack on stm32L0 controller(which does not have on board ETH port hence LAN IC is interfaced using SPI). i have integrated the stack but while sending the UDP packets, I am observing "hard fault".

I have few questions regarding lwIP stack-

1)what is the minimum RAM and flash requirement to integrate the lwIP stack?

2)My controller is having 20Kb of RAM and 192Kb of flash. My code is using 15-16Kb of RAM after integrating the stack. Is this memory enough to operate stack properly without hard faults?

3)if yes ,what are the possible reasons that can cause hard fault while sending the UDP packet?

4)in no, do i need to consider using controller with much more RAM size?

5)Is 20Kb enough memory for operation of user application and lwIP stack?

Any inputs on above points will be very helpful.

Thanks!

1 REPLY 1

Step#1 would be to really understand the source of the Hard Fault. These are gross faults and should be easy enough to pin point in the code and relate to the source, and execution paths. You have ALL the source.

Use a proper HardFault handler so you can establish the failure point without a debugger.

Specific areas of concern would be the size of the heap, and potential issues with fragmentation (very common on embedded 365-7-24 systems), resource leaks, and thread safeness of the allocation methods. Ultimately usage patterns will actually determine the type of usage of resources you'll get.

Pointer issues

Stack corruption

Out-of-bounds buffer usage

Failure to catch NULL return from malloc()

Multiple free() of the same memory

Failure to free() memory based on exit paths in code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..