From c4097153ca3e3122bab88c5d4d013e8513fec2a7 Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Fri, 11 Jun 2021 00:00:24 +0200 Subject: [PATCH 1/4] boards: arm: nucleo_h745zi_q add sramnocache label pointing to sram3 Signed-off-by: Alexander Kozhinov --- boards/arm/nucleo_h745zi_q/nucleo_h745zi_q_m7.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/arm/nucleo_h745zi_q/nucleo_h745zi_q_m7.dts b/boards/arm/nucleo_h745zi_q/nucleo_h745zi_q_m7.dts index 265b34aca42e7..8ab308da9fe1f 100644 --- a/boards/arm/nucleo_h745zi_q/nucleo_h745zi_q_m7.dts +++ b/boards/arm/nucleo_h745zi_q/nucleo_h745zi_q_m7.dts @@ -42,6 +42,7 @@ led0 = &green_led; pwm-led0 = &red_pwm_led; sw0 = &user_button; + sramnocache = &sram3; }; }; From 193106747c7c02a2214d0ea4c848d19b9e543ba2 Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Fri, 11 Jun 2021 00:01:12 +0200 Subject: [PATCH 2/4] drivers: ethernet: eth_stm32_hal use sram by alias istead of label Signed-off-by: Alexander Kozhinov --- drivers/ethernet/eth_stm32_hal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index b41d145cbfdec..16ebfe0736d24 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -70,7 +70,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #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) + DT_NODE_HAS_STATUS(DT_ALIAS(sramnocache), okay) #define __eth_stm32_desc __attribute__((section(".eth_stm32_desc"))) #define __eth_stm32_buf __attribute__((section(".eth_stm32_buf"))) #elif defined(CONFIG_NOCACHE_MEMORY) From e73f2ce7772f5dfad88b24ed0c007d70d789799e Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Fri, 11 Jun 2021 00:03:25 +0200 Subject: [PATCH 3/4] soc: arm: st_stm32: stm32h7 add non-cached MPU region section by alias instead of label Signed-off-by: Alexander Kozhinov --- soc/arm/st_stm32/stm32h7/mpu_regions.c | 10 +++++----- soc/arm/st_stm32/stm32h7/sections.ld | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/soc/arm/st_stm32/stm32h7/mpu_regions.c b/soc/arm/st_stm32/stm32h7/mpu_regions.c index 0b098f48c6a80..4c02ed52d257b 100644 --- a/soc/arm/st_stm32/stm32h7/mpu_regions.c +++ b/soc/arm/st_stm32/stm32h7/mpu_regions.c @@ -12,13 +12,13 @@ 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) && \ +#if DT_NODE_HAS_STATUS(DT_ALIAS(sramnocache), okay) && \ DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay) - MPU_REGION_ENTRY("SRAM3_ETH_BUF", - DT_REG_ADDR(DT_NODELABEL(sram3)), + MPU_REGION_ENTRY("SRAM_NO_CACHE_ETH_BUF", + DT_REG_ADDR(DT_ALIAS(sramnocache)), REGION_RAM_NOCACHE_ATTR(REGION_16K)), - MPU_REGION_ENTRY("SRAM3_ETH_DESC", - DT_REG_ADDR(DT_NODELABEL(sram3)), + MPU_REGION_ENTRY("SRAM_NO_CACHE_ETH_DESC", + DT_REG_ADDR(DT_ALIAS(sramnocache)), REGION_PPB_ATTR(REGION_256B)), #endif }; diff --git a/soc/arm/st_stm32/stm32h7/sections.ld b/soc/arm/st_stm32/stm32h7/sections.ld index 45092f2284a8f..792dd00b58ca5 100644 --- a/soc/arm/st_stm32/stm32h7/sections.ld +++ b/soc/arm/st_stm32/stm32h7/sections.ld @@ -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_ALIAS(sramnocache), okay) && 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_ALIAS(sramnocache))); *(.eth_stm32_desc) - . = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3))) + 256; + . = ABSOLUTE(DT_REG_ADDR(DT_ALIAS(sramnocache))) + 256; *(.eth_stm32_buf) - . = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3))) + 16K; -} GROUP_DATA_LINK_IN(SRAM3, SRAM3) + . = ABSOLUTE(DT_REG_ADDR(DT_ALIAS(sramnocache))) + 16K; +} GROUP_DATA_LINK_IN(sramnocache, sramnocache) #endif From 849ccb1e2dc76f1635eec340c3475bdf82d6caae Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Fri, 11 Jun 2021 00:04:22 +0200 Subject: [PATCH 4/4] arm: aarch32: cortex-M update linker script to use noncaheable region by alias Signed-off-by: Alexander Kozhinov --- .../arm/aarch32/cortex_m/scripts/linker.ld | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/include/arch/arm/aarch32/cortex_m/scripts/linker.ld b/include/arch/arm/aarch32/cortex_m/scripts/linker.ld index da045f7b90f3e..c356e10df3448 100644 --- a/include/arch/arm/aarch32/cortex_m/scripts/linker.ld +++ b/include/arch/arm/aarch32/cortex_m/scripts/linker.ld @@ -92,11 +92,33 @@ MEMORY LINKER_DT_REGION_FROM_NODE(SRAM1, rw, DT_NODELABEL(sram1)) LINKER_DT_REGION_FROM_NODE(SRAM2, rw, DT_NODELABEL(sram2)) /* STM32 alternate RAM configurations */ - LINKER_DT_REGION_FROM_NODE(SRAM3, rw, DT_NODELABEL(sram3)) - LINKER_DT_REGION_FROM_NODE(SRAM4, rw, DT_NODELABEL(sram4)) - LINKER_DT_REGION_FROM_NODE(SDRAM1, rw, DT_NODELABEL(sdram1)) - LINKER_DT_REGION_FROM_NODE(SDRAM2, rw, DT_NODELABEL(sdram2)) - LINKER_DT_REGION_FROM_NODE(BACKUP_SRAM, rw, DT_NODELABEL(backup_sram)) + +#if DT_NODE_HAS_STATUS(DT_ALIAS(sramnocache), okay) + DT_REGION_FROM_NODE_STATUS_OKAY(sramnocache, rw, DT_ALIAS(sramnocache)) + +#if !DT_SAME_NODE(DT_ALIAS(sramnocache), DT_NODELABEL(sram3)) + DT_REGION_FROM_NODE_STATUS_OKAY(SRAM3, rw, DT_NODELABEL(sram3)) +#endif +#if !DT_SAME_NODE(DT_ALIAS(sramnocache), DT_NODELABEL(sram4)) + DT_REGION_FROM_NODE_STATUS_OKAY(SRAM4, rw, DT_NODELABEL(sram4)) +#endif +#if !DT_SAME_NODE(DT_ALIAS(sramnocache), DT_NODELABEL(sdram1)) + DT_REGION_FROM_NODE_STATUS_OKAY(SDRAM1, rw, DT_NODELABEL(sdram1)) +#endif +#if !DT_SAME_NODE(DT_ALIAS(sramnocache), DT_NODELABEL(sdram2)) + DT_REGION_FROM_NODE_STATUS_OKAY(SDRAM2, rw, DT_NODELABEL(sdram2)) +#endif +#if !DT_SAME_NODE(DT_ALIAS(sramnocache), DT_NODELABEL(backup_sram)) + DT_REGION_FROM_NODE_STATUS_OKAY(BACKUP_SRAM, rw, DT_NODELABEL(backup_sram)) +#endif + +#else + DT_REGION_FROM_NODE_STATUS_OKAY(SRAM3, rw, DT_NODELABEL(sram3)) + DT_REGION_FROM_NODE_STATUS_OKAY(SRAM4, rw, DT_NODELABEL(sram4)) + DT_REGION_FROM_NODE_STATUS_OKAY(SDRAM1, rw, DT_NODELABEL(sdram1)) + DT_REGION_FROM_NODE_STATUS_OKAY(SDRAM2, rw, DT_NODELABEL(sdram2)) + DT_REGION_FROM_NODE_STATUS_OKAY(BACKUP_SRAM, rw, DT_NODELABEL(backup_sram)) +#endif /* Used by and documented in include/linker/intlist.ld */ IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K }