Skip to content

Commit

Permalink
ethernet: stm32h7: Move DMA buffers from sram3 to sram2
Browse files Browse the repository at this point in the history
PR zephyrproject-rtos#30403 implemented nocache regions for ethernet DMA buffers in sram3.
Unfortunately, chip variants STM32H742xx do not have any sram, so they still
suffer from zephyrproject-rtos#29915. All H7 variants have sram2 though, so lets use that
instead.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
  • Loading branch information
zagor committed Jan 30, 2023
1 parent ef9d5bb commit 5a0b97a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions drivers/ethernet/eth_stm32_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay)
#define __eth_stm32_desc __dtcm_noinit_section
#define __eth_stm32_buf __dtcm_noinit_section
#elif defined(CONFIG_SOC_SERIES_STM32H7X) && \
DT_NODE_HAS_STATUS(DT_NODELABEL(sram3), okay)
#elif defined(CONFIG_SOC_SERIES_STM32H7X)
#define __eth_stm32_desc __attribute__((section(".eth_stm32_desc")))
#define __eth_stm32_buf __attribute__((section(".eth_stm32_buf")))
#elif defined(CONFIG_NOCACHE_MEMORY)
Expand Down
11 changes: 5 additions & 6 deletions soc/arm/st_stm32/stm32h7/mpu_regions.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ static const struct arm_mpu_region mpu_regions[] = {
REGION_FLASH_ATTR(REGION_FLASH_SIZE)),
MPU_REGION_ENTRY("SRAM", CONFIG_SRAM_BASE_ADDRESS,
REGION_RAM_ATTR(REGION_SRAM_SIZE)),
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram3), okay) && \
DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay)
MPU_REGION_ENTRY("SRAM3_ETH_BUF",
DT_REG_ADDR(DT_NODELABEL(sram3)),
#if DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay)
MPU_REGION_ENTRY("SRAM2_ETH_BUF",
DT_REG_ADDR(DT_NODELABEL(sram2)),
REGION_RAM_NOCACHE_ATTR(REGION_16K)),
MPU_REGION_ENTRY("SRAM3_ETH_DESC",
DT_REG_ADDR(DT_NODELABEL(sram3)),
MPU_REGION_ENTRY("SRAM2_ETH_DESC",
DT_REG_ADDR(DT_NODELABEL(sram2)),
REGION_PPB_ATTR(REGION_256B)),
#endif

Expand Down
10 changes: 5 additions & 5 deletions soc/arm/st_stm32/stm32h7/sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram3), okay) && DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay)
#if DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay)

SECTION_DATA_PROLOGUE(eth_stm32,(NOLOAD),)
{
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3)));
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram2)));
*(.eth_stm32_desc)
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3))) + 256;
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram2))) + 256;
*(.eth_stm32_buf)
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3))) + 16K;
} GROUP_DATA_LINK_IN(LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(sram3)), LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(sram3)))
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram2))) + 16K;
} GROUP_DATA_LINK_IN(LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(sram2)), LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(sram2)))

#endif

0 comments on commit 5a0b97a

Please sign in to comment.