Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
sdram2: sdram@d0000000 {
compatible = "zephyr,memory-region", "mmio-sram";
device_type = "memory";
reg = <0xd0000000 DT_SIZE_M(16)>; /* 128Mbit */
/* 128Mbit, but only half is available by HW design */
reg = <0xd0000000 DT_SIZE_M(8)>;
zephyr,memory-region = "SDRAM2";
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_RAM)>;
};
Expand Down Expand Up @@ -274,7 +275,7 @@
STM32_FMC_SDRAM_MWID_16
STM32_FMC_SDRAM_NB_4
STM32_FMC_SDRAM_CAS_2
STM32_FMC_SDRAM_SDCLK_PERIOD_2
STM32_FMC_SDRAM_SDCLK_PERIOD_3
STM32_FMC_SDRAM_RBURST_ENABLE
STM32_FMC_SDRAM_RPIPE_0>;
st,sdram-timing = <2 7 4 7 2 2 2>;
Expand Down
5 changes: 3 additions & 2 deletions boards/st/stm32h750b_dk/stm32h750b_dk-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
sdram2: sdram@d0000000 {
compatible = "zephyr,memory-region", "mmio-sram";
device_type = "memory";
reg = <0xd0000000 DT_SIZE_M(16)>; /* 128Mbit */
/* 128Mbit, but only half is available by HW design */
reg = <0xd0000000 DT_SIZE_M(8)>;
zephyr,memory-region = "SDRAM2";
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_RAM)>;
};
Expand Down Expand Up @@ -236,7 +237,7 @@
STM32_FMC_SDRAM_MWID_16
STM32_FMC_SDRAM_NB_4
STM32_FMC_SDRAM_CAS_3
STM32_FMC_SDRAM_SDCLK_PERIOD_2
STM32_FMC_SDRAM_SDCLK_PERIOD_3
STM32_FMC_SDRAM_RBURST_ENABLE
STM32_FMC_SDRAM_RPIPE_1>;
st,sdram-timing = <2 7 4 7 2 2 2>;
Expand Down
13 changes: 13 additions & 0 deletions tests/drivers/memc/ram/boards/stm32f769i_disco.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2025 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/* Test the full SDRAM accesses. Discable LTDC to prevent conflicts */

ram0: &sdram1 {};

&ltdc {
status = "disabled";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2025 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/* Test the full SDRAM accesses. Discable LTDC to prevent conflicts */

ram0: &sdram2 {};

&ltdc {
status = "disabled";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2025 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/* Test the full SDRAM accesses. Discable LTDC to prevent conflicts */

ram0: &sdram2 {};

&ltdc {
status = "disabled";
};
13 changes: 13 additions & 0 deletions tests/drivers/memc/ram/boards/stm32h750b_dk.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2025 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/* Test the full SDRAM accesses. Discable LTDC to prevent conflicts */

ram0: &sdram2 {};

&ltdc {
status = "disabled";
};
13 changes: 8 additions & 5 deletions tests/drivers/memc/ram/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@
#define BUF_SIZE_SDRAM 64U
#define BUF_SIZE_SRAM 64U

#define BUF_DEF(label, size) static uint32_t buf_##label[size] \
#define BUF_DEF(label, size) static uint32_t buf_##label[(size) / sizeof(uint32_t)] \
Z_GENERIC_SECTION(LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(label)))

/**
* @brief Helper function to test RAM r/w.
*
* @param mem RAM memory location to be tested.
*/
static void test_ram_rw(uint32_t *mem, size_t size)
static void test_ram_rw(uint32_t *mem, size_t size_byte)
{
size_t size_32b = size_byte / sizeof(uint32_t);

/* fill memory with number range (0, BUF_SIZE - 1) */
for (size_t i = 0U; i < size / sizeof(uint32_t); i++) {
for (size_t i = 0U; i < size_32b; i++) {
mem[i] = i;
}

/* check that memory contains written range */
for (size_t i = 0U; i < size / sizeof(uint32_t); i++) {
zassert_equal(mem[i], i, "Unexpected content on byte %zd", i);
for (size_t i = 0U; i < size_32b; i++) {
zassert_equal(mem[i], i, "Unexpected content @%p: 0x%x != 0x%zx",
mem + i, mem[i], i);
}
}

Expand Down