CubeMX 6.16.0 Memory Management Tool: Rx_PoolSection size vs Eth "Rx Buffers Length"?
CubeMX 6.16.0's "Memory Management" Tool assumes Rx_PoolSection size to coincide with the Eth "Rx Buffers Length" - is that correct?
I used CubeMX 6.16.0 to create a project for an STM32 H755ZI-Q.
Then I opted to use the Tools -> "Memory Management" tool and afterwards enabled the ETH [ethernet] component. This automatically generated the required sections in the "Memory Management" tool. Great.
Then I enabled LwIP [with RTOS and CMSIS v2] and generated code.
Compiling this code worked - linking however did not. It told me the contents of Rx_PoolSection were too big, i.e. the section too small:
EBoxNG3_CM7.elf section `.Rx_PoolSection' will not fit in region `Rx_PoolSection'
region `Rx_PoolSection' overflowed by 225668
The buffer for the RX_POOL is declared in CM7\LWIP\Target\ethernetif.c:98:
#define ETH_RX_BUFFER_CNT 12U
LWIP_MEMPOOL_DECLARE(RX_POOL, ETH_RX_BUFFER_CNT, sizeof(RxBuff_t), "Zero-copy RX PBUF pool");with
__attribute__((section(".Rx_PoolSection"))) extern u8_t memp_memory_RX_POOL_base[];residing in the Rx_PoolSection.
Thus for ETH_RX_BUFFER_CNT greater than 1 this will not work!
My solution was to increase the Rx_PoolSection Size in the Memory Management tool to be able to accomodate all 12 buffers [(1536 + 4) * 12 bytes = 18480 bytes]. But then CubeMx assumes ETH "Rx Buffers Length" to also be this big [and correctly shows an error in the GUI]. This again leads to a section overflow.
So as a second step I had to manually adapt the following to lines of code:
- CM7\LWIP\Target\lwipopts.h:51
#define ETH_RX_BUFFER_SIZE 1536
- CM7\LWIP\Target\ethernetif.c:234:
heth.Init.RxBuffLen = 1536;
The actual problem to me seems to be that the Memory Management assumes the Rx Buffers Length to be the same as the Rx_PoolSection's size.
Can anyone confirm this observation?
Or tell me that I did something wrong and instruct me as to the correct way?
Thanks in advance
Johannes
