Skip to content

Commit

Permalink
stm32h7: merge eth and eth_dma MPU regions (#1669)
Browse files Browse the repository at this point in the history
Currently, the stm32h7 chip config defines two separate MPU regions for
the Ethernet peripheral, `eth` and `eth_dma`. But, these regions are
contiguous in memory. So, we can combine them into one region and get an
entire MPU slot back, which seems nice.

Tested on my Gimletlet to confirm that the netstack still, you know, works:


```console
eliza@theseus $ humility net ip
humility: attached via ST-Link V3
MAC address:  0e:1d:de:f0:d9:21
IPv6 address: fe80::0c1d:deff:fef0:d921

eliza@theseus $ ping fe80::0c1d:deff:fef0:d921%eth0
PING fe80::0c1d:deff:fef0:d921%eth0 (fe80::c1d:deff:fef0:d921%eth0) 56 data bytes
64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=2 ttl=64 time=0.219 ms
64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=3 ttl=64 time=0.233 ms
64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=4 ttl=64 time=0.238 ms
64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=5 ttl=64 time=0.250 ms
64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=6 ttl=64 time=0.354 ms
64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=7 ttl=64 time=0.284 ms
64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=8 ttl=64 time=0.315 ms
^X64 bytes from fe80::c1d:deff:fef0:d921%eth0: icmp_seq=9 ttl=64 time=0.228 ms
^C
--- fe80::0c1d:deff:fef0:d921%eth0 ping statistics ---
9 packets transmitted, 8 received, 11.1111% packet loss, time 8211ms
rtt min/avg/max/mdev = 0.219/0.265/0.354/0.045 ms


```
  • Loading branch information
hawkw authored Mar 20, 2024
1 parent 7a57527 commit 9edefbe
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/demo-stm32h7-nucleo/app-h743.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ priority = 2
max-sizes = {flash = 65536, ram = 8192, sram1 = 32768}
features = ["h743"]
sections = {eth_bulk = "sram1"}
uses = ["eth", "eth_dma", "tim16"]
uses = ["eth", "tim16"]
start = true
notifications = ["eth-irq", "mdio-timer-irq", "wake-timer"]
interrupts = {"eth.irq" = "eth-irq", "tim16.irq" = "mdio-timer-irq"}
Expand Down
2 changes: 1 addition & 1 deletion app/demo-stm32h7-nucleo/app-h753.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ priority = 2
max-sizes = {flash = 131072, ram = 16384, sram1 = 32768}
features = ["h753"]
sections = {eth_bulk = "sram1"}
uses = ["eth", "eth_dma", "tim16"]
uses = ["eth", "tim16"]
start = true
notifications = ["eth-irq", "mdio-timer-irq", "wake-timer"]
interrupts = {"eth.irq" = "eth-irq", "tim16.irq" = "mdio-timer-irq"}
Expand Down
2 changes: 1 addition & 1 deletion app/gimlet/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ priority = 5
features = ["mgmt", "h753", "gimlet", "vlan", "vpd-mac"]
max-sizes = {flash = 131072, ram = 65536, sram1 = 16384}
sections = {eth_bulk = "sram1"}
uses = ["eth", "eth_dma", "tim16"]
uses = ["eth", "tim16"]
start = true
interrupts = {"eth.irq" = "eth-irq", "tim16.irq" = "mdio-timer-irq"}
task-slots = ["sys", "packrat", { spi_driver = "spi2_driver" }, "jefe"]
Expand Down
2 changes: 1 addition & 1 deletion app/gimletlet/app-mgmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ priority = 3
features = ["mgmt", "h753", "use-spi-core", "spi2"]
max-sizes = {flash = 131072, ram = 16384, sram1 = 16384}
sections = {eth_bulk = "sram1"}
uses = ["eth", "eth_dma", "tim16", "spi2"]
uses = ["eth", "tim16", "spi2"]
start = true
notifications = ["eth-irq", "mdio-timer-irq", "spi-irq", "wake-timer"]
task-slots = ["sys", "user_leds", "jefe"]
Expand Down
2 changes: 1 addition & 1 deletion app/gimletlet/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ priority = 3
features = ["h753", "vlan", "gimletlet-nic", "use-spi-core", "spi4"]
max-sizes = {flash = 131072, ram = 65536, sram1 = 16384}
sections = {eth_bulk = "sram1"}
uses = ["eth", "eth_dma", "tim16", "spi4"]
uses = ["eth", "tim16", "spi4"]
start = true
task-slots = ["sys", "jefe"]
notifications = ["eth-irq", "mdio-timer-irq", "spi-irq", "wake-timer"]
Expand Down
2 changes: 1 addition & 1 deletion app/psc/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ priority = 4
features = ["mgmt", "h753", "psc", "vlan", "vpd-mac", "use-spi-core", "spi2"]
max-sizes = {flash = 131072, ram = 65536, sram1 = 16384}
sections = {eth_bulk = "sram1"}
uses = ["eth", "eth_dma", "tim16", "spi2"]
uses = ["eth", "tim16", "spi2"]
start = true
notifications = [
"eth-irq",
Expand Down
2 changes: 1 addition & 1 deletion app/sidecar/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ priority = 5
features = ["mgmt", "h753", "sidecar", "vlan", "vpd-mac", "use-spi-core", "spi3"]
max-sizes = {flash = 131072, ram = 65536, sram1 = 16384}
sections = {eth_bulk = "sram1"}
uses = ["eth", "eth_dma", "tim16", "spi3"]
uses = ["eth", "tim16", "spi3"]
start = true
notifications = ["eth-irq", "mdio-timer-irq", "spi-irq", "wake-timer"]
task-slots = ["sys", "packrat", { seq = "sequencer" }, "jefe"]
Expand Down
6 changes: 1 addition & 5 deletions chips/stm32h7/chip.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,9 @@ interrupts = { irq = 92 }

[eth]
address = 0x40028000
size = 0x1000
size = 0x2000
interrupts = { irq = 61 }

[eth_dma]
address = 0x40029000
size = 0x400

[hash]
address = 0x48021400
size = 4096
Expand Down

0 comments on commit 9edefbe

Please sign in to comment.