cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX 6.16.0 Memory Management Tool: Rx_PoolSection size vs Eth "Rx Buffers Length"?

JohannesWilde
Associate III

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

4 REPLIES 4
Ghofrane GSOURI
ST Employee

Hello @JohannesWilde 

Please share your .ioc file so I can review your STM32CubeMX configuration and better understand the situation you are facing.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @Ghofrane GSOURI ,

I created a minimal example - where I first enabled the Memory Management, then ETH and LwIP for an STM32H755ZI.

Best regards

Johannes

JohannesWilde
Associate III

A further note regarding an only marginally connected topic - if I should create a separate ticket, please let me know:

1. When using the Memory Management tool, then I am unable to en-/disable the "CPU ICache" and "CPU DCache" in System Core -> Coretex_M7 -> Cortex Interface Settings.

Disabling the Management Tool, manually en-/disabling the CPU caching options and afterwards re-enabling the Management Tool seems to work.

2. Also, when moving the RX_PoolSection, TxDescripSection, RxDescripSection to 0x30040000, no MPU region configuration is added for that region. And I am unable to manually add a configuration under System Core -> Coretex_M7 -> Cortex Memory Protection Unit Region x Settings.

Disabling the Management Tool, manually adding the MPU region settings and afterwards re-enabling the Management Tool deletes the manually added region.

 

Is there currently a work-flow where the Memory Management tool can be used and those settings configured via CubeMX 6.16.0?

JohannesWilde
Associate III

As further information here my source for how to use the MMT:

https://wiki.st.com/stm32mcu/wiki/Getting_started_with_MMT