Skip to content

Commit a416e82

Browse files
committed
soc: st: stm32: h7rs: Add memory region to MPU region list
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]>
1 parent c6847fe commit a416e82

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

soc/st/stm32/stm32h7rsx/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ zephyr_sources(
66
)
77

88
zephyr_sources(mpu_regions.c)
9+
zephyr_linker_sources(SECTIONS sections.ld)
910

1011
zephyr_include_directories(.)
1112

soc/st/stm32/stm32h7rsx/mpu_regions.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ static const struct arm_mpu_region mpu_regions[] = {
2626

2727
/* Region 3 */
2828
MPU_REGION_ENTRY("SRAM_0", CONFIG_SRAM_BASE_ADDRESS, REGION_RAM_ATTR(REGION_SRAM_SIZE)),
29+
30+
/* Region 4 - Ready only flash with unique device id */
31+
MPU_REGION_ENTRY("ID", 0x08FFF800, REGION_FLASH_ATTR(REGION_2K)),
32+
33+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mac))
34+
#define sram_eth_node DT_NODELABEL(sram2)
35+
#if DT_NODE_HAS_STATUS_OKAY(sram_eth_node)
36+
/* Region 5 - Ethernet DMA buffer RAM */
37+
MPU_REGION_ENTRY("SRAM_ETH_BUF", DT_REG_ADDR(sram_eth_node),
38+
REGION_RAM_NOCACHE_ATTR(REGION_16K)),
39+
/* Region 6 - Ethernet DMA descriptor RAM (overlays the first 256B of SRAM_ETH_BUF)*/
40+
MPU_REGION_ENTRY("SRAM_ETH_DESC", DT_REG_ADDR(sram_eth_node), REGION_PPB_ATTR(REGION_256B)),
41+
#endif
42+
#endif
2943
};
3044

3145
const struct arm_mpu_config mpu_config = {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2020 Mario Jaun
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mac))
8+
#define sram_eth_node DT_NODELABEL(sram2)
9+
#if DT_NODE_HAS_STATUS_OKAY(sram_eth_node)
10+
SECTION_DATA_PROLOGUE(eth_stm32,(NOLOAD),)
11+
{
12+
. = ABSOLUTE(DT_REG_ADDR(sram_eth_node));
13+
*(.eth_stm32_desc)
14+
. = ABSOLUTE(DT_REG_ADDR(sram_eth_node)) + 256;
15+
*(.eth_stm32_buf)
16+
. = ABSOLUTE(DT_REG_ADDR(sram_eth_node)) + 16K;
17+
} GROUP_DATA_LINK_IN(LINKER_DT_NODE_REGION_NAME(sram_eth_node), LINKER_DT_NODE_REGION_NAME(sram_eth_node))
18+
#endif
19+
20+
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay) */

0 commit comments

Comments
 (0)