Skip to content

Conversation

TD-JBL
Copy link
Contributor

@TD-JBL TD-JBL commented Oct 10, 2025

This PR adds ethernet support for STM32H7RS series microcontrollers.
It's almost a 1:1 copy of h7x ethernet configuration. Only register addresses, clock sources and interrupt numbers changed in device tree and the used RAM for DMA buffer.

Changes:

  • Add ethernet node with mac and mdio subnodes to dts similar to h7-family.
  • Add SOC_SERIES_STM32H7RSX where appicable next to SOC_SERIES_STM32H7X.
  • Add ethernet DMA buffer/descriptor region (sram2) and read only flash region (0x08FFF800) with unique device ID registers to MPU region list.
  • Ethernet DMA buffer/descriptor memory section is added to soc linker script.
  • Enable support for ethernet on nucleo_h7s3l8 board.

Used DMA memory

As all h7rs variants have the same memory configuration, there is no need to support multiple memories as DMA buffer. sram1 and sram2 (AHB SRAM1 and AHB SRAM2) are identical, so I hardcoded the DMA buffer into sram2.

At first I tried not defining any special memory and let the driver use the NOCACHE memory, but after reading #29915 and #30403 I decided to keep it as near as possible to the h7x implementation.

Edit: Is it possible or useful to add a Kconfig option or dts property to select the used sram node?

0x08FFF800 read only flash region with unique device ID registers

The controller memfaults without this region in the MPU list while trying to read the uniqe device ID registers. The PR #94019 introduced a different way of preventing speculative access in entire memory space than the one used for h7x:
MPU_REGION_ENTRY("UNMAPPED", 0, {REGION_4G | MPU_RASR_XN_Msk | P_NA_U_NA_Msk}),
Every accessed memory must get a MPU region after blocking access to the complete memory space with this entry.

The unique device ID is used to create a random mac address by the ethernet driver in some conditions.

Testing Status:

  • It responds to ping ;)
  • Tested on NUCLEO-H7S3L8 with custom bootloader/app. As I'm not familiar with mcuboot, I didn't run tests with samples like echo_server, they are too big to fit into internal flash and need XiP.

Maybe someone more familiar with running mcuboot+samples on this board can run some tests?

Add ethernet node with mac and mdio subnodes to dts similar to h7-family.

Signed-off-by: Thomas Decker <[email protected]>
@decsny decsny removed their request for review October 10, 2025 16:09
@TD-JBL TD-JBL changed the title stm32h7rs ethernet support STM32: add ethernet support to stm32h7rs Oct 13, 2025
@erwango erwango added this to the v4.3.0 milestone Oct 13, 2025
Copy link

@juickar juickar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @TD-JBL , thanks for the contribution. Could you add the pin layout used for the Ethernet in the index.rst of the board in the last commit?

zephyr/boards/st/nucleo_h7s3l8/doc/index.rst :

In the Default Zephyr Peripheral Mapping part :

+ -ETH : PA2, PA7, PB6, PG4, PG5, PG6, PG11, PG12, PG13

Otherwise it looks goods to me

@TD-JBL
Copy link
Contributor Author

TD-JBL commented Oct 14, 2025

Hello @TD-JBL , thanks for the contribution. Could you add the pin layout used for the Ethernet in the index.rst of the board in the last commit?

Sure, added the documentation. I also fixed a wrong heading format in this file (I added with FDCAN documentation). Is it ok to add this in a extra commit to this PR?

@TD-JBL TD-JBL requested a review from juickar October 14, 2025 13:47
compatible = "st,stm32-ethernet-controller";
clock-names = "stm-eth";
clocks = <&rcc STM32_CLOCK(AHB1, 15)>;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status = "disabled"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disable the parent ethernet node as well? Sounds correct. I copied the ethernet node from stm32h7.dtsi, there it is also missing.

&ethernet {status = "okay";} is then needed in all boards.

I don't have enough experience with Zephyr to decide that... But I'll add it if needed/wanted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was introduced with the split of the mac from the ethernet node.
Fixing this would have a wide impact and should be done in a dedicated PR if we think it should be fixed. Meanwhile, I think it is ok to use the same pattern on h7rs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the parent is there just to provide common props that are shared by the mac and mdio and it doesn't have a driver on it's own, it is fine that we don't use the status.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the parent is there just to provide common props that are shared by the mac and mdio and it doesn't have a driver on it's own, it is fine that we don't use the status.

Fine to me as well.

@@ -0,0 +1,20 @@
/*
* Copyright (c) 2020 Mario Jaun
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright up to date?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the sections.ld including the copyright from h7 and changed only the sram node selection. That's fine for me.

Add SOC_SERIES_STM32H7RSX to applicable Kconfig parameters and enable
use of .eth_stm32_desc and .eth_stm32_buf linker sections for ethernet
dma.

Signed-off-by: Thomas Decker <[email protected]>
Add ethernet DMA buffer/descriptor region (sram2) and read only
flash region 0x08FFF800 with unique device ID registers to MPU region
list. The unique device ID is used to create a random mac address by
the ethernet driver. Ethernet DMA buffer/descriptor memory section is
also added to linker script.

Signed-off-by: Thomas Decker <[email protected]>
Enable support for ethernet on nucleo_h7s3l8 board.

Signed-off-by: Thomas Decker <[email protected]>
Fix wrong heading type in index.rst introduced with PR zephyrproject-rtos#95388

Signed-off-by: Thomas Decker <[email protected]>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants