2021-05-13 03:47 PM
After re-reading the STM32H7 Ethernet related threads in this forum it seems that most complaints and bug reports are about DMA descriptors and buffers (cache management, allocation etc). At the same time, operations on the descriptors and buffers is the area where customization is desired (see for example the FreeRTOS+ IP fork of the STM32H7 driver).
Thus I'd like to propose dividing the existing HAL driver to "Core" and "Middleware" parts, similar to the USB drivers.
The "Middleware" part deals with the descriptors and buffers, and every network stack project (LwIP, FreeRTOS, ThreadX) can have their own variant.
The "Core" part is meant to be common and maintained by ST.
A quick preview of how this separation could look is here.
(warning: Not tested yet, just for review)
The "Middleware" module goes between application code and the HAL driver.
For example, LwIP projects have this structure:
ethernetif.c ---> stm32h7xx_hal_eth.c
This will change to :
ethernetif.c ---> stm32h7xx_eth_MW.c --> stm32h7xx_[hal]_eth.c
where stm32h7xx_eth_MW.c is arbitrary name for LwIP - compatible middleware layer, this filename can be changed to ... _eth_LwIP.c or whatever.
Or, application level module can be merged with "middleware" (for the above example, ethernetif.c with stm32h7xx_eth_MW.c)
Regards,
-- pa