2025-10-09 11:09 AM - edited 2025-10-09 11:11 AM
Hello,
I am working to implement LwIP onto my MCU (STM32H750VBT6TR) with the PHY (DP83825IRMQR).
I got everything set up and was able to do a ping test and create a basic UDP client to send and receive packets (see this thread). This works well on my bare project with just these elements. The issue is that the amount of flash memory taken up by just adding the LwIP peripheral is absurd (it is a combined 110.8 kB out of 128 kB). This leaves little space for the rest of the code this needs to interface with.
Looking at tutorials for LwIP implementations show that only around 77 kB is typically used. I am wondering if anyone can help me track down why so much flash memory is being used in my implementation and if it can be minimized?
Project files are attached. Thanks in advance.
Solved! Go to Solution.
2025-10-10 3:46 AM - edited 2025-10-10 3:50 AM
Lwip isn't a peripheral, that's the "ETH", and I guess you are using HAL ? That takes a lot of flash.
Check if you have some more lwip options enabled that you don't need.
EDIT:
1) I guess you have some more HAL drivers in use... I first thought you meant that only lwip uses the 110k.
2) Especially for development, I always like to start with the biggest flash (and RAM) available. Sizing things down is always easier later on, than running out of memory in the design stage.
2025-10-09 11:43 AM
Note that if the flash consumption cannot easily be brought down, I will likely swap to a pin-compatible part with more flash storage (STM32H753VIT6). Lots more code needs to run on this, so I don't want to run into flash bottlenecks.
2025-10-10 3:46 AM - edited 2025-10-10 3:50 AM
Lwip isn't a peripheral, that's the "ETH", and I guess you are using HAL ? That takes a lot of flash.
Check if you have some more lwip options enabled that you don't need.
EDIT:
1) I guess you have some more HAL drivers in use... I first thought you meant that only lwip uses the 110k.
2) Especially for development, I always like to start with the biggest flash (and RAM) available. Sizing things down is always easier later on, than running out of memory in the design stage.
2025-10-10 4:06 AM
About used flash: what optimizer setting ? try -O2 .
+
H750 is intended to be used with external flash, see quad spi ...xip.
So the internal 128KB are for bootloader etc, big programs are in external spi-flash.
2025-10-10 8:15 AM
BTW, you can check what's eating your flash a little more detailed in the IDE by opening the "text" part under memory details / flash, and you can order that by size.
This can be very interesting!
In my current "big" H733 project by far the biggest "flash-eater" is a UART printf debugging output, so much const char text...
2025-10-13 5:03 AM
This is a vey fair approach. I am getting used to this family of MCU, so I'm still figuring out the kinks. I will up my flash size and then see if it makes sense to decrease it again in the future.
2025-10-13 5:04 AM
Thanks! The use of external flash does seem to be intended. Good to know going forward.