-
Notifications
You must be signed in to change notification settings - Fork 33
Description
See STM32 forum "LWIP/ V6.5.0. STMH32H735_DISCO (https://github.com/stm32-hotspot/STM32H7-LwIP-Examples) .Rx_PoolSection. (former .RxArraySection) seems not to be guarded by the MPU against cache coherency issues. Is this the right way?"
the readme provided stipulates:
_“For STM32H72x/H73x devices, the D2 SRAM is more limited (only 32kB). The RX buffers need to be placed in AXI SRAM, since they won't fit to D2 RAM, together with LwIP heap.
The LwIP heap is reduced to fit the rest of D2 RAM together with DMA descriptors.
Variable | STM32H72x/H73x address | Size | Source file |
---|---|---|---|
DMARxDscrTab | 0x30000000 | 96 (256 max.) | ethernetif.c |
DMATxDscrTab | 0x30000100 | 96 (256 max.) | ethernetif.c |
memp_memory_RX_POOL_base | AXI SRAM (32-byte aligned) | 12*(1536 + 24) | ethernetif.c |
LwIP heap | 0x30000200 | 32232 (32kB - 512 - 24) | lwipopts.h_ |
My issue: Relocating of the RX_POOL to AXI SRAM in the provided example has a result that the MPU is no longer protecting the RX_POOL from cache coherency problems. (=Possible BUG ?) As I understand it, this analysis has been confirmed by exprienced forum members;
I propose the solution to move the Rx_Pool back to D2 change the linker script:
The required .mx settings are:
Note:
The exact starting point of the LWIP_RAM_HEAP can be deduced from the map file.
In my example: RX_PoolSection stops at 0x30004b84 ie 19332 therefor 13804 bytes remain for LWIP stack. In many cases this is sufficient. The statement “does not fit in ram” seems to be incorrect.
(One must make sure that the size of the HEAP is a multiple of 32 bytes as otherwise #define MEM_SIZE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEM_SIZE) in mem.c causes a round-up of the MEM_SIZE and this can result in addressing area’s above D2_RAM resulting in hardware_fault. Your documentation also correctly indicates that one has to pay attention to this aspect;)